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
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
AzureCompletionRequestRef 🔒
The wire shape of AzureCompletionRequest, borrowing its conversation instead of owning it.
LLMResponse
Response from LLM for simple completions
MessageContentItem
RefusalContentItem
StoreDisabled
The store: false every request sends, as a type rather than a bool so that no construction site can send the other value.

Enums§

MessageContent

Functions§

azure_chatbot_configuration
The Azure chatbot (Foundry) section of the application configuration, or an error naming what’s missing.
azure_configuration
The Azure section of the application configuration, or an error naming what’s missing.
azure_search_configuration
The Azure AI Search section of the application configuration, or an error naming what’s missing.
azure_search_request
A request to the Azure AI Search management API, carrying the headers every one of its endpoints wants. The search API key is exposed only here.
build_llm_headers
Builds common headers for LLM requests
estimate_tokens
Estimate the number of tokens in a given text.
get_params_for_model
llm_http_error 🔒
Builds the error for a failed LLM HTTP response, parsing error_text as an Azure error body when possible and attaching it as the error’s Azure source.
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
reasoning_include 🔒
The include a reasoning request asks for, or None for a model that produces no reasoning.
request_structured_json
Sends input as a one-shot structured-JSON request and deserializes the reply as T.
stored_summary 🔒
A stored summary text as the summary parts that go back to Azure.
string_list_response_format
The structured output format for a feature whose whole answer is a list of strings.
summarize_input_for_log 🔒
Logs the shape and order of a request’s input items when Azure rejects it.
summary_as_stored 🔒
Summary parts as the database round trip spells them.
summary_text 🔒
The single summary text that ChatbotConversationMessageReasoning::summary can hold, or None for an item with no summary. Azure streams a summary in parts; a row keeps one.