Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(agents-api): Fix the typespec bug and regenerate #462

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions agents-api/agents_api/autogen/Agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

class Agent(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
id: Annotated[UUID, Field(json_schema_extra={"readOnly": True})]
Expand Down Expand Up @@ -59,6 +60,7 @@ class CreateAgentRequest(BaseModel):
"""

model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
metadata: dict[str, Any] | None = None
Expand Down Expand Up @@ -92,6 +94,7 @@ class CreateAgentRequest(BaseModel):

class CreateOrUpdateAgentRequest(CreateAgentRequest):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
id: UUID
Expand Down Expand Up @@ -130,6 +133,7 @@ class PatchAgentRequest(BaseModel):
"""

model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
metadata: dict[str, Any] | None = None
Expand Down Expand Up @@ -167,6 +171,7 @@ class UpdateAgentRequest(BaseModel):
"""

model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
metadata: dict[str, Any] | None = None
Expand Down
29 changes: 23 additions & 6 deletions agents-api/agents_api/autogen/Chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Annotated, Literal
from uuid import UUID

from pydantic import AwareDatetime, BaseModel, ConfigDict, Field
from pydantic import AwareDatetime, BaseModel, ConfigDict, Field, StrictBool

from .Common import LogitBias
from .Docs import DocReference
Expand All @@ -16,6 +16,7 @@

class BaseChatOutput(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
index: int
Expand All @@ -31,6 +32,7 @@ class BaseChatOutput(BaseModel):

class BaseChatResponse(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
usage: CompetionUsage | None = None
Expand All @@ -54,6 +56,7 @@ class BaseChatResponse(BaseModel):

class BaseTokenLogProb(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
token: str
Expand All @@ -66,6 +69,7 @@ class BaseTokenLogProb(BaseModel):

class ChatInputData(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
messages: Annotated[list[InputChatMLMessage], Field(min_length=1)]
Expand All @@ -88,6 +92,7 @@ class ChatOutputChunk(BaseChatOutput):
"""

model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
delta: InputChatMLMessage
Expand All @@ -98,6 +103,7 @@ class ChatOutputChunk(BaseChatOutput):

class ChunkChatResponse(BaseChatResponse):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
choices: list[ChatOutputChunk]
Expand All @@ -112,6 +118,7 @@ class CompetionUsage(BaseModel):
"""

model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
completion_tokens: Annotated[
Expand All @@ -136,6 +143,7 @@ class CompetionUsage(BaseModel):

class CompletionResponseFormat(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
type: Literal["text", "json_object"] = "text"
Expand All @@ -146,6 +154,7 @@ class CompletionResponseFormat(BaseModel):

class LogProbResponse(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
content: Annotated[list[TokenLogProb] | None, Field(...)]
Expand All @@ -156,6 +165,7 @@ class LogProbResponse(BaseModel):

class MessageChatResponse(BaseChatResponse):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
choices: list[SingleChatOutput | MultipleChatOutput]
Expand All @@ -170,13 +180,15 @@ class MultipleChatOutput(BaseChatOutput):
"""

model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
messages: list[InputChatMLMessage]


class OpenAISettings(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
frequency_penalty: Annotated[float | None, Field(None, ge=-2.0, le=2.0)]
Expand All @@ -203,31 +215,34 @@ class SingleChatOutput(BaseChatOutput):
"""

model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
message: InputChatMLMessage


class TokenLogProb(BaseTokenLogProb):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
top_logprobs: list[BaseTokenLogProb]


class ChatInput(ChatInputData):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
remember: Annotated[bool, Field(False, json_schema_extra={"readOnly": True})]
remember: Annotated[StrictBool, Field(False, json_schema_extra={"readOnly": True})]
"""
DISABLED: Whether this interaction should form new memories or not (will be enabled in a future release)
"""
recall: bool = True
recall: StrictBool = True
"""
Whether previous memories and docs should be recalled or not
"""
save: bool = True
save: StrictBool = True
"""
Whether this interaction should be stored in the session history or not
"""
Expand All @@ -241,7 +256,7 @@ class ChatInput(ChatInputData):
"""
Identifier of the model to be used
"""
stream: bool = False
stream: StrictBool = False
"""
Indicates if the server should stream the response as it's generated
"""
Expand Down Expand Up @@ -305,6 +320,7 @@ class DefaultChatSettings(OpenAISettings):
"""

model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
repetition_penalty: Annotated[float | None, Field(None, ge=0.0, le=2.0)]
Expand All @@ -323,6 +339,7 @@ class DefaultChatSettings(OpenAISettings):

class ChatSettings(DefaultChatSettings):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
model: Annotated[
Expand All @@ -335,7 +352,7 @@ class ChatSettings(DefaultChatSettings):
"""
Identifier of the model to be used
"""
stream: bool = False
stream: StrictBool = False
"""
Indicates if the server should stream the response as it's generated
"""
Expand Down
3 changes: 3 additions & 0 deletions agents-api/agents_api/autogen/Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Offset(RootModel[int]):

class ResourceCreatedResponse(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
id: UUID
Expand All @@ -56,6 +57,7 @@ class ResourceCreatedResponse(BaseModel):

class ResourceDeletedResponse(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
id: UUID
Expand All @@ -74,6 +76,7 @@ class ResourceDeletedResponse(BaseModel):

class ResourceUpdatedResponse(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
id: UUID
Expand Down
12 changes: 12 additions & 0 deletions agents-api/agents_api/autogen/Docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

class BaseDocSearchRequest(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
limit: Annotated[int, Field(10, ge=1, le=100)]
Expand All @@ -26,6 +27,7 @@ class CreateDocRequest(BaseModel):
"""

model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
metadata: dict[str, Any] | None = None
Expand All @@ -46,6 +48,7 @@ class CreateDocRequest(BaseModel):

class Doc(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
id: Annotated[UUID, Field(json_schema_extra={"readOnly": True})]
Expand All @@ -71,6 +74,7 @@ class Doc(BaseModel):

class DocOwner(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
id: UUID
Expand All @@ -79,6 +83,7 @@ class DocOwner(BaseModel):

class DocReference(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
owner: DocOwner
Expand All @@ -96,6 +101,7 @@ class DocReference(BaseModel):

class DocSearchResponse(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
docs: list[DocReference]
Expand All @@ -110,6 +116,7 @@ class DocSearchResponse(BaseModel):

class EmbedQueryRequest(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
text: str | list[str]
Expand All @@ -120,6 +127,7 @@ class EmbedQueryRequest(BaseModel):

class EmbedQueryResponse(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
vectors: list[list[float]]
Expand All @@ -130,6 +138,7 @@ class EmbedQueryResponse(BaseModel):

class HybridDocSearchRequest(BaseDocSearchRequest):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
confidence: Annotated[float, Field(0.5, ge=0.0, le=1.0)]
Expand All @@ -152,6 +161,7 @@ class HybridDocSearchRequest(BaseDocSearchRequest):

class Snippet(BaseModel):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
index: int
Expand All @@ -160,6 +170,7 @@ class Snippet(BaseModel):

class TextOnlyDocSearchRequest(BaseDocSearchRequest):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
text: str
Expand All @@ -170,6 +181,7 @@ class TextOnlyDocSearchRequest(BaseDocSearchRequest):

class VectorDocSearchRequest(BaseDocSearchRequest):
model_config = ConfigDict(
extra="allow",
populate_by_name=True,
)
confidence: Annotated[float, Field(0.5, ge=0.0, le=1.0)]
Expand Down
Loading
Loading