models¶
models ¶
Simple data classes — no numpy imports to avoid JIT crashes.
AgentResult
module-attribute
¶
AgentResult = namedtuple(
"AgentResult",
[
"answer",
"sources",
"chunks",
"tools_called",
"search_used",
],
)
Result from a synchronous agent process() call.
Fields
answer: The agent's final text response. sources: List of source citation tags (e.g., [source: file.md]). chunks: List of ChunkResult objects from RAG retrieval. tools_called: List of dicts with 'name' and 'args' for each tool invoked. search_used: True if Tavily web search was used during this turn.
Chunk ¶
A single text chunk from the knowledge base.
Represents one segment of a source document, optionally scoped to a specific section heading. Chunks are the unit of retrieval and citation in RAG queries.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
The chunk's text content. |
|
source |
Source file path this chunk originated from. |
|
section |
Section heading under which this chunk falls (may be empty). |
__init__ ¶
Initialize a Chunk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The chunk's text content. |
required |
source
|
str
|
Source file path this chunk originated from. |
required |
section
|
str
|
Section heading under which this chunk falls (may be empty). |
''
|
ChunkResult ¶
A ranked retrieval result from a knowledge base query.
Returned by KnowledgeBase.query() and rag_retrieve(). Carries the matched chunk's content, its source file, and a cosine similarity score against the query vector.
Attributes:
| Name | Type | Description |
|---|---|---|
text |
The matched chunk's text content. |
|
source |
Source file path of the chunk. |
|
score |
Cosine similarity score (0.0 to 1.0 range). |
__init__ ¶
Initialize a ChunkResult.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The matched chunk's text content. |
required |
source
|
str
|
Source file path of the chunk. |
required |
score
|
float
|
Cosine similarity score (0.0 to 1.0 range). |
required |
ChatRequest
dataclass
¶
Request body for the /chat and /chat/stream endpoints.
Attributes:
| Name | Type | Description |
|---|---|---|
message |
str
|
The user's chat message or question. |
session_id |
Optional[str]
|
Optional UUID of an existing session to continue. |
axes |
Optional[dict]
|
Optional dict overriding the global axis values for this request. |
ChatResponse
dataclass
¶
Response body for the non-streaming /chat endpoint.
Attributes:
| Name | Type | Description |
|---|---|---|
reply |
str
|
The agent's complete text response. |
session_id |
Optional[str]
|
UUID of the session this turn belongs to. |
sources |
list
|
List of source filenames cited in the response. |
LoginRequest
dataclass
¶
Request body for the /auth/login endpoint.
Attributes:
| Name | Type | Description |
|---|---|---|
email |
str
|
User's email address. |
password |
str
|
User's plaintext password. |
LoginResponse
dataclass
¶
Response body for successful /auth/login requests.
Attributes:
| Name | Type | Description |
|---|---|---|
access_token |
str
|
JWT access token (15-minute expiry). |
token_type |
str
|
Token type, always 'bearer'. |