Skip to main content

Module llm_utils

Module llm_utils 

Source

Structs§

APIInputMessage
Common message structure used for LLM API requests
APIOutputMessage
Common message structure used for LLM API requests
APITool
APIToolCall
An LLM tool call that is part of a request to Azure
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
LLMResponse
Response from LLM for simple completions

Enums§

MessageContent

Functions§

build_llm_headers
Builds common headers for LLM requests
estimate_tokens
Estimate the number of tokens in a given text.
get_params_for_model
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
model_is_thinking
Checks if the model_type is a thinking model type. This function defines which model types are thinking (reasoning)
parse_text_completion
Collects all the completion choices to a string. Assumes the completion has only text message content, no tool calls or tool output.
process_llm_response 🔒
Process a non-streaming LLM response