Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jxnl/kura/llms.txt

Use this file to discover all available pages before exploring further.

ConversationSummary

Extends GeneratedSummary with conversation-specific fields for tracking and retrieval.
chat_id
str
required
Unique identifier linking to the original conversation
metadata
dict
required
Metadata from the original conversation
embedding
Optional[list[float]]
Vector embedding of the summary for similarity search. Defaults to None
summary
str
required
request
Optional[str]
topic
Optional[str]
languages
Optional[list[str]]
task
Optional[str]
concerning_score
Optional[int]
user_frustration
Optional[int]
assistant_errors
Optional[list[str]]

GeneratedSummary

Base class containing all LLM-generated summary fields.
summary
str
required
A clear and concise summary of the conversation in at most two sentences, avoiding phrases like ‘Based on the conversation’ and excluding proper nouns or PII
request
Optional[str]
The user’s overall request for the assistant
topic
Optional[str]
The main high-level topic of the conversation (e.g., ‘software development’, ‘creative writing’, ‘scientific research’)
languages
Optional[list[str]]
Main languages present in the conversation including human and programming languages (e.g., [‘english’, ‘arabic’, ‘python’, ‘javascript’])
task
Optional[str]
The task the model is being asked to perform
concerning_score
Optional[int]
Safety concern rating from 1-5 scale. Constrained to values between 1 and 5 (ge=1, le=5)
user_frustration
Optional[int]
User frustration rating from 1-5 scale. Constrained to values between 1 and 5 (ge=1, le=5)
assistant_errors
Optional[list[str]]
List of errors the assistant made

Example

from kura.types import ConversationSummary

summary = ConversationSummary(
    chat_id="chat-123",
    summary="User asked for help with Python async code. Assistant provided examples and explained event loops.",
    request="Help understanding Python asyncio",
    topic="software development",
    languages=["english", "python"],
    task="code explanation",
    concerning_score=1,
    user_frustration=2,
    assistant_errors=[],
    metadata={
        "model": "claude-3-sonnet",
        "token_count": 450
    },
    embedding=[0.1, 0.2, 0.3, ...]  # 1536-dimensional vector
)

String Representation

The ConversationSummary class implements a custom __repr__() method that formats the summary as XML tags:
print(summary)
# Output:
# <summary>User asked for help with Python async code...</summary>
# <topic>software development</topic>
# <request>Help understanding Python asyncio</request>
# <task>code explanation</task>
# <languages>['english', 'python']</languages>
# <assistant_errors>[]</assistant_errors>
# <model>claude-3-sonnet</model>
# <token_count>450</token_count>
Metadata fields are included in the output with type checking for str, int, float, bool, and lists of these types.