Skip to content

feat: add models object property #44

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

Merged
merged 2 commits into from
May 23, 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
1 change: 1 addition & 0 deletions taskingai/client/models/entities/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@


class Action(BaseModel):
object: str = Field("Action")
action_id: str = Field(..., min_length=20, max_length=30)
name: str = Field(..., min_length=1, max_length=128)
operation_id: str = Field(...)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@


class Assistant(BaseModel):
object: str = Field("Assistant")
assistant_id: str = Field(..., min_length=20, max_length=30)
model_id: str = Field(..., min_length=8, max_length=8)
name: str = Field("", min_length=0, max_length=256)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


class Chat(BaseModel):
object: str = Field("Chat")
chat_id: str = Field(..., min_length=20, max_length=30)
assistant_id: str = Field(..., min_length=20, max_length=30)
name: str = Field("", min_length=0, max_length=127)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/chat_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


class ChatCompletion(BaseModel):
object: str = Field("ChatCompletion")
finish_reason: ChatCompletionFinishReason = Field(...)
message: ChatCompletionAssistantMessage = Field(...)
created_timestamp: int = Field(...)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/chat_completion_chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


class ChatCompletionChunk(BaseModel):
object: str = Field("ChatCompletionChunk")
role: ChatCompletionRole = Field("assistant")
index: int = Field(...)
delta: str = Field(...)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


class Chunk(BaseModel):
object: str = Field("Chunk")
chunk_id: str = Field(..., min_length=20, max_length=30)
record_id: Optional[str] = Field(..., min_length=20, max_length=30)
collection_id: str = Field(..., min_length=20, max_length=30)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


class Collection(BaseModel):
object: str = Field("Collection")
collection_id: str = Field(..., min_length=24, max_length=24)
name: str = Field("", min_length=0, max_length=256)
description: str = Field("", min_length=0, max_length=512)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


class Message(BaseModel):
object: str = Field("Message")
message_id: str = Field(..., min_length=20, max_length=30)
chat_id: str = Field(..., min_length=20, max_length=30)
assistant_id: str = Field(None, min_length=20, max_length=30)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/message_chunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


class MessageChunk(BaseModel):
object: str = Field("MessageChunk")
role: MessageRole = Field(...)
index: int = Field(...)
delta: str = Field(...)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/message_generation_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


class MessageGenerationLog(BaseModel):
object: str = Field("MessageGenerationLog")
session_id: str = Field(..., min_length=20, max_length=30)
event: str = Field(...)
event_id: str = Field(..., min_length=20, max_length=30)
Expand Down
1 change: 1 addition & 0 deletions taskingai/client/models/entities/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


class Record(BaseModel):
object: str = Field("Record")
record_id: str = Field(..., min_length=20, max_length=30)
collection_id: str = Field(..., min_length=20, max_length=30)
title: str = Field("", min_length=0, max_length=255)
Expand Down
2 changes: 1 addition & 1 deletion taskingai/client/models/schemas/chat_completion_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
from typing import Optional, List, Dict, Union
from ..entities.chat_completion_function_message import ChatCompletionFunctionMessage
from ..entities.chat_completion_system_message import ChatCompletionSystemMessage
from ..entities.chat_completion_user_message import ChatCompletionUserMessage
from ..entities.chat_completion_assistant_message import ChatCompletionAssistantMessage
from ..entities.chat_completion_user_message import ChatCompletionUserMessage
from ..entities.chat_completion_function import ChatCompletionFunction

__all__ = ["ChatCompletionRequest"]
Expand Down
16 changes: 0 additions & 16 deletions test/testcase/test_async/test_async_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,18 +305,6 @@ async def test_a_delete_record(self):

@pytest.mark.test_async
class TestChunk(Base):
chunk_list = [
"chunk_id",
"record_id",
"collection_id",
"content",
"metadata",
"num_tokens",
"score",
"updated_timestamp",
"created_timestamp",
]
chunk_keys = set(chunk_list)

@pytest.mark.run(order=41)
@pytest.mark.asyncio
Expand All @@ -332,7 +320,6 @@ async def test_a_query_chunks(self):
for chunk in res:
chunk_dict = vars(chunk)
assume_query_chunk_result(query_text, chunk_dict)
pytest.assume(chunk_dict.keys() == self.chunk_keys)
pytest.assume(chunk_dict["score"] >= 0.04)

@pytest.mark.run(order=42)
Expand All @@ -345,7 +332,6 @@ async def test_create_chunk(self):
}
res = await a_create_chunk(**create_chunk_data)
res_dict = vars(res)
pytest.assume(res_dict.keys() == self.chunk_keys)
assume_chunk_result(create_chunk_data, res_dict)
Base.chunk_id = res_dict["chunk_id"]

Expand Down Expand Up @@ -386,7 +372,6 @@ async def test_get_chunk(self):
res_dict = vars(res)
pytest.assume(res_dict["collection_id"] == self.collection_id)
pytest.assume(res_dict["chunk_id"] == chunk_id)
pytest.assume(res_dict.keys() == self.chunk_keys)

@pytest.mark.run(order=45)
@pytest.mark.asyncio
Expand All @@ -401,7 +386,6 @@ async def test_update_chunk(self):
}
res = await a_update_chunk(**update_chunk_data)
res_dict = vars(res)
pytest.assume(res_dict.keys() == self.chunk_keys)
assume_chunk_result(update_chunk_data, res_dict)

@pytest.mark.run(order=46)
Expand Down
16 changes: 0 additions & 16 deletions test/testcase/test_sync/test_sync_retrieval.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,18 +315,6 @@ def test_delete_record(self, collection_id):

@pytest.mark.test_sync
class TestChunk:
chunk_list = [
"chunk_id",
"record_id",
"collection_id",
"content",
"metadata",
"num_tokens",
"score",
"updated_timestamp",
"created_timestamp",
]
chunk_keys = set(chunk_list)

@pytest.mark.run(order=41)
def test_query_chunks(self, collection_id):
Expand All @@ -341,7 +329,6 @@ def test_query_chunks(self, collection_id):
for chunk in res:
chunk_dict = vars(chunk)
assume_query_chunk_result(query_text, chunk_dict)
pytest.assume(chunk_dict.keys() == self.chunk_keys)
pytest.assume(chunk_dict["score"] >= 0.04)

@pytest.mark.run(order=42)
Expand All @@ -353,7 +340,6 @@ def test_create_chunk(self, collection_id):
}
res = create_chunk(**create_chunk_data)
res_dict = vars(res)
pytest.assume(res_dict.keys() == self.chunk_keys)
assume_chunk_result(create_chunk_data, res_dict)

@pytest.mark.run(order=43)
Expand Down Expand Up @@ -391,7 +377,6 @@ def test_get_chunk(self, collection_id):
res_dict = vars(res)
pytest.assume(res_dict["collection_id"] == collection_id)
pytest.assume(res_dict["chunk_id"] == chunk_id)
pytest.assume(res_dict.keys() == self.chunk_keys)

@pytest.mark.run(order=45)
def test_update_chunk(self, collection_id, chunk_id):
Expand All @@ -405,7 +390,6 @@ def test_update_chunk(self, collection_id, chunk_id):
}
res = update_chunk(**update_chunk_data)
res_dict = vars(res)
pytest.assume(res_dict.keys() == self.chunk_keys)
assume_chunk_result(update_chunk_data, res_dict)

@pytest.mark.run(order=46)
Expand Down
Loading