Skip to content

Commit

Permalink
Fix for OpenAI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandr Movchan committed Sep 10, 2024
1 parent 24ba6dc commit 421cca2
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions aana/core/models/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,16 @@ class ChatCompletionRequest(BaseModel):
temperature (float): float that controls the randomness of the sampling
top_p (float): float that controls the cumulative probability of the top tokens to consider
max_tokens (int): the maximum number of tokens to generate
repetition_penalty (float): float that penalizes new tokens based on whether they appear in the prompt and the generated text so far
stream (bool): if set, partial message deltas will be sent
"""

model: str = Field(..., description="The model name (name of the LLM deployment).")
messages: list[ChatMessage] = Field(
..., description="A list of messages comprising the conversation so far."
)
temperature: float | None = Field(
default=None,
temperature: float = Field(
default=1.0,
ge=0.0,
description=(
"Float that controls the randomness of the sampling. "
Expand All @@ -149,8 +150,8 @@ class ChatCompletionRequest(BaseModel):
"Zero means greedy sampling."
),
)
top_p: float | None = Field(
default=None,
top_p: float = Field(
default=1.0,
gt=0.0,
le=1.0,
description=(
Expand All @@ -161,6 +162,15 @@ class ChatCompletionRequest(BaseModel):
max_tokens: int | None = Field(
default=None, ge=1, description="The maximum number of tokens to generate."
)
repetition_penalty: float = Field(
default=1.0,
description=(
"Float that penalizes new tokens based on whether they appear in the "
"prompt and the generated text so far. Values > 1 encourage the model "
"to use new tokens, while values < 1 encourage the model to repeat tokens. "
"Default is 1.0 (no penalty)."
),
)

stream: bool | None = Field(
default=False,
Expand Down

0 comments on commit 421cca2

Please sign in to comment.