Skip to main content

Module mock_azure

Module mock_azure 

Source

Structsยง

MockRequest ๐Ÿ”’
The parts of a request the mock picks its answer from.
SampledField ๐Ÿ”’
A field of the teacherโ€™s data file, as the mock reads it out of the sample in the prompt.
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.
chart_spec_payload ๐Ÿ”’
The Vega-Lite specification the CMS chart block offers, which is the whole answer. It carries no data of its own, as a generated specification must not: the teacherโ€™s data file is attached to it afterwards.
charted_fields ๐Ÿ”’
The first two fields of the teacherโ€™s data file, or placeholder_fields when the request carries no sample or the sample has fewer than two fields to chart.
completed_response_object ๐Ÿ”’
The response object of the response.completed event, the only lifecycle event Azure reports token usage and the reasoning context on.
csv_sample_fields ๐Ÿ”’
The columns of a CSV sample, typed from the first row of values under the header.
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.
json_sample_fields ๐Ÿ”’
The fields of the first row of a JSON array sample, in the order they are written there.
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.
placeholder_fields ๐Ÿ”’
What the chart encodes when the request carries no sample to read fields out of.
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.
split_unquoted_commas ๐Ÿ”’
Splits on the commas that separate an objectโ€™s members or a CSV lineโ€™s cells, which is every comma outside a quoted string.
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.
unquote ๐Ÿ”’
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.