ai_sentinel.llm.AzureOpenAIClient
- class ai_sentinel.llm.AzureOpenAIClient(api_key: str, model: str, api_version: str, azure_endpoint: str, timeout: float | None = 30.0, **kwargs)
Client implementation for Azure OpenAI LLM
- __init__(api_key: str, model: str, api_version: str, azure_endpoint: str, timeout: float | None = 30.0, **kwargs)
Methods
__init__(api_key, model, api_version, ...[, ...])generate_text(prompt[, system_prompt, ...])Generate a response from LLM based on the prompt and optional inputs (sync wrapper).
generate_text_async(prompt[, system_prompt, ...])Generate a response from LLM based on the prompt and optional inputs (async).
validate()Validate the provided API key by making a call to the provider (sync wrapper).
Validate the provided API key by making a call to the provider (async).
Attributes
Return clean information about the LLM Client configuration.
Get the provider name
- generate_text(prompt: str, system_prompt: str | None = None, context: list[dict[str, str]] | None = None, temperature: float | None = 0.7, **kwargs) LLMResponse
Generate a response from LLM based on the prompt and optional inputs (sync wrapper).
This is a synchronous wrapper around the async method that is safe to run in any environment, including Jupyter notebooks.
- async generate_text_async(prompt: str, system_prompt: str | None = None, context: list[dict[str, str]] | None = None, temperature: float | None = 0.0, **kwargs) LLMResponse
Generate a response from LLM based on the prompt and optional inputs (async).
Warning: Implementations uses deprecated function “datetime.utcnow()”
Parameters: prompt (str): User input system_prompt (Optional[str]): System prompt to give the LLM as it’s role | default = None context (Optional[list[dict[str,str]]]): Conversation history | default = None temperature (Optional[float]): What sampling temperature to use | default = 0.7 **kwargs: Handles structured output ( ex. {‘response_format’: [Some Structure]} )
- property info
Return clean information about the LLM Client configuration.
- property provider_name: str
Get the provider name
- validate() bool
Validate the provided API key by making a call to the provider (sync wrapper).
- async validate_async() bool
Validate the provided API key by making a call to the provider (async). Return True if the API key is valid, False if not.