Coverage for app / router / app / models / models.py: 100%
22 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-10-31 11:21 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-10-31 11:21 +0000
1from uuid import UUID
2from pydantic import BaseModel
5class PromptRequest(BaseModel):
6 prompt: str
7 conversation_id: UUID | None = None
8 system_messages: list[str] = []
9 #: Documents of the workspace's library this message attaches
10 #: (``app/services/attachments.py``): sent beside the words.
11 file_ids: list[UUID] = []
12 temperature: float | None = None
13 output_format: str | None = None # "json" | "yaml" | "csv" | "xml" | "plain" | None
14 output_schema: str | None = None # schema string for json/yaml formats
15 #: The client's own id for this turn, so its Stop can name it
16 #: (``POST /app/turns/{id}/stop``) before the response arrives.
17 turn_id: UUID | None = None
20class PromptResponse(BaseModel):
21 response: str
22 conversation_id: UUID | None = None
23 output_tokens: int | None = None
24 # Rule-enforcement trace frames (node_start/system_node_result/node_end)
25 # so the chat UI can render governance actions applied to this exchange.
26 trace: list[dict] | None = None
27 #: Stop ended the turn: ``response`` is what it had written (or says it
28 #: was stopped), stored as the conversation now holds it.
29 stopped: bool = False
30 #: The turn's id: what "Why did it do this?" opens
31 #: (``GET /app/decisions/{id}``).
32 invocation_id: UUID | None = None
33 #: What the turn cost, read back from the usage ledger — the figure the
34 #: answer is served with once its conversation is reloaded. None when
35 #: nothing in it could be priced; ``unpriced_calls`` above 0 makes it a
36 #: floor.
37 cost_usd: float | None = None
38 unpriced_calls: int = 0
39 #: An answer an Output rule withheld (``rule_engine.Withheld.meta``):
40 #: ``response`` is the rule's message.
41 withheld: dict | None = None
42 #: What the turn's web searches came to, as the answer stores it
43 #: (``meta.web_search``, ``services/web_search_summary.py``); None when
44 #: it made none.
45 web_search: dict | None = None