Module llm_utils

Source

Structs§

APIMessage
Common message structure used for LLM API requests
AzureCompletionRequest
Simple completion-focused LLM request for Azure OpenAI Note: In Azure OpenAI, the model is specified in the URL, not in the request body
LLMChoice
LLMCompletionResponse
Response from LLM for simple completions

Enums§

MessageRole
Role of a message in a conversation

Constants§

LLM_API_VERSION

Functions§

build_llm_headers
Builds common headers for LLM requests
estimate_tokens
Estimate the number of tokens in a given text.
make_blocking_llm_request
Makes a non-streaming request to an LLM using application configuration
make_llm_request 🔒
Makes a non-streaming request to an LLM
make_streaming_llm_request
Makes a streaming request to an LLM
prepare_azure_endpoint
Prepares Azure OpenAI endpoint with API version
process_llm_response 🔒
Process a non-streaming LLM response