API Reference
- oju.agent.Agent(agent_name: str, model: str, provider: str, api_key: str, prompt_input: str, custom_system_prompt: str | None = None) str[source]
Executes an agent using the specified model provider and prompt.
- Parameters:
agent_name – Name of the agent (used to locate prompt file).
model – Name of the model to use (e.g., ‘gpt-4’, ‘claude-3-opus’).
provider – One of ‘openai’, ‘claude’, or ‘gemini’.
api_key – API key for the respective provider.
prompt_input – User input to be processed by the agent.
custom_system_prompt – Optional custom system prompt that overrides the file-based one.
- Returns:
The generated response from the model.
- Return type:
- Raises:
FileNotFoundError – If the prompt file is not found.
ValueError – If the prompt file is empty or provider is unsupported.
Exception – For errors during API calls to the model providers.
Module for handling different LLM provider APIs.
This module provides functions to interact with various language model providers like OpenAI, Anthropic, and Google’s Gemini.
- oju.providers.call_openai(model: str, system_prompt: str, prompt: str, api_key: str) str[source]
Call the OpenAI API with the given parameters.
- Parameters:
model – The model to use (e.g., ‘gpt-4’, ‘gpt-3.5-turbo’).
system_prompt – The system prompt to guide the model’s behavior.
prompt – The user’s input prompt.
api_key – The OpenAI API key.
- Returns:
The generated text response from the model.
- Raises:
ValueError – If the API key is invalid or missing.
Exception – For errors during the API call.
- oju.providers.call_claude(model: str, system_prompt: str, prompt: str, api_key: str) str[source]
Call the Anthropic Claude API with the given parameters.
- Parameters:
model – The model to use (e.g., ‘claude-3-opus-20240229’, ‘claude-3-sonnet-20240229’).
system_prompt – The system prompt to guide the model’s behavior.
prompt – The user’s input prompt.
api_key – The Anthropic API key.
- Returns:
The generated text response from the model.
- Raises:
ValueError – If the API key is invalid or missing.
Exception – For errors during the API call.
- oju.providers.call_gemini(model: str, system_prompt: str, prompt: str, api_key: str) str[source]
Call the Google Gemini API with the given parameters.
- Parameters:
model – The model to use (e.g., ‘gemini-pro’).
system_prompt – The system prompt to guide the model’s behavior.
prompt – The user’s input prompt.
api_key – The Google AI API key.
- Returns:
The generated text response from the model.
- Raises:
ValueError – If the API key is invalid or missing.
Exception – For errors during the API call.