Chat Models¶
aana.core.models.chat
¶
Role
¶
The role of a participant in a conversation.
- "system": Used for instructions or context provided to the model.
- "user": Represents messages from the user.
- "assistant": Represents LLM responses.
ChatMessage
¶
Bases: BaseModel
A chat message.
ATTRIBUTE | DESCRIPTION |
---|---|
content |
the text of the message
TYPE:
|
role |
the role of the message
TYPE:
|
ChatDialog
¶
Bases: BaseModel
A chat dialog.
ATTRIBUTE | DESCRIPTION |
---|---|
messages |
the messages in the dialog
TYPE:
|
from_list
¶
Create a ChatDialog from a list of dictionaries.
PARAMETER | DESCRIPTION |
---|---|
messages |
the list of messages
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ChatDialog
|
the chat dialog
TYPE:
|
Source code in aana/core/models/chat.py
from_prompt
¶
Create a ChatDialog from a prompt.
PARAMETER | DESCRIPTION |
---|---|
prompt |
the prompt
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
ChatDialog
|
the chat dialog
TYPE:
|
Source code in aana/core/models/chat.py
ChatCompletionRequest
¶
Bases: BaseModel
A chat completion request for OpenAI compatible API.
ATTRIBUTE | DESCRIPTION |
---|---|
model |
the model name (name of the LLM deployment)
TYPE:
|
messages |
a list of messages comprising the conversation so far
TYPE:
|
temperature |
float that controls the randomness of the sampling
TYPE:
|
top_p |
float that controls the cumulative probability of the top tokens to consider
TYPE:
|
max_tokens |
the maximum number of tokens to generate
TYPE:
|
repetition_penalty |
float that penalizes new tokens based on whether they appear in the prompt and the generated text so far
TYPE:
|
stream |
if set, partial message deltas will be sent
TYPE:
|
ChatCompletionChoice
¶
Bases: BaseModel
A chat completion choice for OpenAI compatible API.
ATTRIBUTE | DESCRIPTION |
---|---|
index |
the index of the choice in the list of choices
TYPE:
|
message |
a chat completion message generated by the model
TYPE:
|
ChatCompletion
¶
Bases: BaseModel
A chat completion for OpenAI compatible API.
ATTRIBUTE | DESCRIPTION |
---|---|
id |
a unique identifier for the chat completion
TYPE:
|
model |
the model used for the chat completion
TYPE:
|
created |
the Unix timestamp (in seconds) of when the chat completion was created
TYPE:
|
choices |
a list of chat completion choices
TYPE:
|
object |
the object type, which is always
TYPE:
|