Skip to main content

Module mock_azure

Module mock_azure 

Source

StructsΒ§

MockRequest πŸ”’
The parts of a request the mock picks its answer from.
Scenario πŸ”’
One shape of request the mock answers, and the answer it gives.
TriggeredToolCall πŸ”’
A tool call a message asked the mock to make.

ConstantsΒ§

CLIENT_TOOL_CALL_TRIGGER πŸ”’
Like TOOL_CALL_TRIGGER, but the call is one only the client can answer, so the chatbot suspends the turn instead of running anything. The turn is finished by the tool-response endpoint, whose request ends in the tool output and so gets the same text round.
CMS_SUGGESTION_PAYLOAD πŸ”’
The rewrites the CMS offers for a paragraph.
COURSE_DESCRIPTION_PAYLOAD πŸ”’
The course description summary, in the shape Sisu expects it in.
INCOMPLETE_ANSWER_TRIGGER πŸ”’
Drives an answer Azure cut short by max_output_tokens: the round ends on response.incomplete instead of response.completed.
MALFORMED_SEARCH_OUTPUT_TRIGGER πŸ”’
Drives a search round whose completed output fails to parse as the chatbot’s search-output schema: the same plain-text failure shape a real search backend can return, but on a completed item rather than the in-progress placeholder every other scenario here uses.
MESSAGE_SUGGESTION_PAYLOAD πŸ”’
The suggestions the chatbot offers as the learner’s next message.
MOCK_MULTIPLE_CHOICE_ARGUMENTS πŸ”’
The question CLIENT_TOOL_CALL_TRIGGER makes the mock ask. Has to pass the tool’s own argument validation, which the chatbot runs before it suspends the turn.
PROMPT_CREATION_PAYLOAD πŸ”’
SCENARIOS πŸ”’
The first scenario that matches answers, so the default chat answer, which takes any streamed message at all, comes last.
SEARCH_ANSWER_DELTAS πŸ”’
The default round’s answer, one delta per element. Each 【x:y†source】 is a citation marker the frontend replaces with a link to the document it points at.
TOOL_CALL_BY_NAME_PREFIX πŸ”’
Opens the trigger !MOCK_TOOL_CALL:<tool_name>:<arguments>!, which makes the mock call any registered tool, so exercising a new one end to end needs no scenario of its own here.
TOOL_CALL_TRIGGER πŸ”’
Anywhere in a chat message, this makes the mock answer with a function call instead of a text answer, which is how a test drives the chatbot’s tool loop. The chatbot then runs the tool and asks again with the tool output as the last input item, and the mock answers that with a text round, completing a two-round turn.
TRUNCATED_STREAM_TRIGGER πŸ”’
Drives a stream a proxy closed cleanly before Azure ever sent a terminal event β€” neither response.completed nor response.incomplete.
UNKNOWN_ITEM_TYPE_TRIGGER πŸ”’
Drives a round that includes an output item kind the chatbot has no variant for.

FunctionsΒ§

_add_routes
blocking_response πŸ”’
A response to a request that asked for structured output instead of a stream: one whole JSON object, whose text content is payload, the JSON the caller’s own schema describes.
completed_response_object πŸ”’
The response object of the response.completed event, the only lifecycle event Azure reports token usage and the reasoning context on.
function_call_round πŸ”’
A round in which the model calls tool_name with arguments.
incomplete_answer_round πŸ”’
An answer max_output_tokens cut short: it ends on response.incomplete, never on response.completed, with only a partial delta having streamed.
is_registered_tool πŸ”’
Whether either registry claims tool_name.
malformed_search_output_round πŸ”’
A completed Azure AI Search output whose output is the same plain-text failure shape a real search backend can return, rather than the AISearchOutput JSON the round otherwise expects β€” on a completed item, unlike the in-progress placeholder search_and_text_round always resolves through.
message_item πŸ”’
One assistant message as an output item, in the two shapes a round streams it in: content is empty while the item is in progress and carries the whole text once it is done.
message_item_events πŸ”’
The events that stream one assistant message: the item, its content part, one event per delta, and the finished item. output_index is the message’s place among the round’s output items, so it depends on how many items the round emitted before this one.
mock_azure_chat_responses πŸ”’
GET /api/v0/mock-azure/api/projects/test/openai/v1/responses POST /api/v0/mock-azure/api/projects/test/openai/v1/responses
mock_azure_embeddings πŸ”’
parse_tool_call_by_name πŸ”’
Reads a TOOL_CALL_BY_NAME_PREFIX trigger out of message.
pick_scenario πŸ”’
The scenario that answers request, or None when the mock answers nothing like it.
reasoning_item πŸ”’
The item reasoning_item_events streams, unchanged in both of its events.
reasoning_item_events πŸ”’
The events that stream the reasoning item a round emits before it calls anything or answers, which is what makes it the round’s first output item.
response_object πŸ”’
The response object of a lifecycle event before the last one. Only id and a possible error are read by the chatbot; Azure sends the full request parameters here as well. See completed_response_object for the terminal event.
round πŸ”’
Wraps a round’s own events in the lifecycle events every round shares: response.created, which is where the chatbot picks up the response id it needs before the round is classified, and the terminal response.completed.
search_and_text_round πŸ”’
The default chat answer: a search of the course material, the results it returns, and a text answer citing them.
search_results πŸ”’
What the search returns, as the JSON string Azure nests it in. Only get_urls is read: the chatbot fetches each of those to build the answer’s citations, so both they and the hits come from MOCK_DOCUMENTS, the documents the mock document storage serves.
sse_body πŸ”’
Renders events as a Server-Sent Events body in the order given, stamping every data: object with its own event name as type, the way Azure repeats it. The chatbot reads the event: line to decide what the data: line after it means, so the pairing and the order are what make a round parse as a tool call or as text.
tool_answer_round πŸ”’
The text answer the model gives once a tool has run.
tool_call_by_name_trigger πŸ”’
The trigger text that makes the mock call tool_name with arguments.
truncated_stream_round πŸ”’
A stream a proxy closed cleanly before Azure ever sent response.completed or response.incomplete β€” the shape a clean EOF produces, as opposed to the idle-timeout error a stalled connection produces.
unknown_item_type_round πŸ”’
A round that includes an output item kind the chatbot has no variant for, between the reasoning item and the answer, the way an Azure feature this code predates would arrive.
usage πŸ”’
What one round was billed for. cached_tokens is the part of the input Azure served from the prompt cache, and the rest of it is what the round wrote there.