Python
Integrate Latitude’s SDK into your Python project
Latitude’s Python integration has the following main features:
- Interact with Latitude’s prompt manager from code: create, update and delete prompts
- Run prompts with Latitude’s high-performing gateway
- Trigger LLM as judge and human in the loop evaluations
- Programmatically push external logs to Latitude for evaluation and monitoring
Installation
To install the Latitude SDK, use your preferred package manager:
Getting Started
First, import the Latitude class from the SDK and initialize it with your API key:
Examples
Check out our cookbook for more examples of how to use Latitude’s SDK.
Prompt Management
Get or create a prompt
To get or create a prompt, use the get_or_create
method:
Run a prompt through Latitude Gateway
Latitude’s Gateway is a high-performing gateway that proxies your LLM calls between your application and the LLM provider. It includes some additional features like automatic prompt caching based on content and prompt configuration.
In order to run a prompt through Latitude’s Gateway, use the run
method:
Log Management
Pushing a log to Latitude
To create a log programmatically, use the create
method:
Message follows OpenAI’s format.