To resolve the issue of VertexAI requests not appearing in Helicone, follow these steps to ensure your setup is correctly configured:
- Create an Account and Generate API Keys:
- Set API Keys as Environment Variables:
- Ensure your API keys are set as environment variables:
export HELICONE_API_KEY=<your API key>
export GCLOUD_API_KEY=<your Google Cloud API key>
- Install Necessary Packages:
- Make sure you have the required packages installed in your JavaScript project:
npm install @google-cloud/vertexai
- Import VertexAI and Configure the Client:
- Import the VertexAI module and configure the client with your project details:
```javascript
import { VertexAI } from "@google-cloud/vertexai";
const vertex_ai = new VertexAI({
project: "your-project-id",
location: "your-location",
apiEndpoint: "gateway.helicone.ai",
});
5. **Set Up Custom Headers**:
- Define custom headers to include the Helicone authentication and target URL:
javascript
const customHeaders = new Headers({
"Helicone-Auth":
Bearer ${process.env.HELICONE_API_KEY}
,
"Helicone-Target-URL":
https://${LOCATION}-aiplatform.googleapis.com
,
});
6. **Define Request Options**:
- Set up the request options to include the custom headers:
javascript
const requestOptions = {
customHeaders: customHeaders,
} as RequestOptions;
7. **Get the Generative Model**:
- Retrieve the generative model using the VertexAI client:
javascript
const generativeModel = vertex_ai.preview.getGenerativeModel(
{
model: "model-name"
},
requestOptions // Pass request options
);
```