The AI Gateway Concept
The AI Gateway acts as a proxy between your application and the underlying AI models configured for your prompt. When you publish a new version of a prompt in Latitude:- The AI Gateway endpoint associated with that prompt is automatically updated to use the newly published version.
- Your application continues calling the same stable endpoint URL.
- The gateway routes the request to the correct prompt version and configured model provider.
Publishing a Prompt Version
- Ensure your desired prompt changes are saved in the current draft version.
- Thoroughly test the draft in the Playground and potentially running experiments with evaluations.
- Click the “Publish” button within the prompt editor or version management interface.
- Add a descriptive version note (e.g., “Added handling for Spanish language queries”).
- Confirm the publication.
Referencing Deployed Endpoints
After publishing, your prompt is accessible via a unique, stable API endpoint.Finding the Endpoint URL
- Navigate to the prompt in the Latitude UI.
- Click the Deploy this prompt button on the right top corner of the prompt editor.
- Copy the endpoint URL under the HTTP API section.
Using the Endpoint
There are two main ways to interact with the deployed prompt endpoint:-
Latitude SDK (Recommended):
- Use the
latitude.run('your_prompt_id', { parameters: {...} })
method (or equivalent) in our Python or TypeScript SDKs. - The SDK handles authentication and communication with the correct endpoint based on the prompt ID.
- This abstracts away the raw HTTP call.
- Use the
-
Direct HTTP API Call:
- Make a POST request directly to the endpoint URL provided in the UI.
- Include necessary authentication headers (API Key). See API Access.
- Send parameters in the request body.
- Refer to the API Reference for detailed request/response formats.
Auto-Updating Prompts (No Redeployment Needed)
The key benefit of this system is that when you publish a new version of a prompt in Latitude:- The AI Gateway endpoint instantly starts using the new version.
- You do not need to change any code or redeploy your application.
Next Steps
- Integrate using the Latitude SDKs
- Learn about the HTTP API
- Set up API Access Keys