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: fix chat completion request schema #46

Merged
merged 2 commits into from
May 24, 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
2 changes: 1 addition & 1 deletion taskingai/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__title__ = "taskingai"
__version__ = "0.2.4"
__version__ = "0.2.5"
1 change: 0 additions & 1 deletion taskingai/client/models/schemas/chat_completion_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,3 @@ class ChatCompletionRequest(BaseModel):
] = Field(...)
function_call: Optional[str] = Field(None)
functions: Optional[List[ChatCompletionFunction]] = Field(None)
save_logs: bool = Field(False)
6 changes: 4 additions & 2 deletions test/testcase/test_async/test_async_retrieval.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import os

import asyncio
from taskingai.retrieval import *
from taskingai.file import a_upload_file
from taskingai.client.models import UploadFilePurpose
Expand Down Expand Up @@ -393,6 +393,8 @@ async def test_update_chunk(self):
async def test_delete_chunk(self):
# List chunks.

await asyncio.sleep(Config.sleep_time)

chunks = await a_list_chunks(collection_id=self.collection_id, limit=5)
old_nums = len(chunks)
for index, chunk in enumerate(chunks):
Expand All @@ -404,6 +406,6 @@ async def test_delete_chunk(self):

# List chunks.

new_chunks = list_chunks(collection_id=self.collection_id)
new_chunks = await a_list_chunks(collection_id=self.collection_id)
chunk_ids = [chunk.chunk_id for chunk in new_chunks]
pytest.assume(chunk_id not in chunk_ids)
2 changes: 1 addition & 1 deletion test/testcase/test_sync/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def collection_id():
@pytest.fixture(scope="session")
def record_id(collection_id):
res = list_records(str(collection_id))
record_id = res[0].record_id
record_id = res[-1].record_id
return record_id


Expand Down
8 changes: 4 additions & 4 deletions test/testcase/test_sync/test_sync_retrieval.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest
import os

import time
from taskingai.retrieval import TokenTextSplitter, TextSplitter
from taskingai.retrieval import (
list_collections,
Expand Down Expand Up @@ -171,7 +171,7 @@ def test_create_record_by_web(self, collection_id):
res_dict = vars(res)
assume_record_result(create_record_data, res_dict)

@pytest.mark.run(order=31)
@pytest.mark.run(order=32)
@pytest.mark.parametrize("upload_file_data", upload_file_data_list[:2])
def test_create_record_by_file(self, collection_id, upload_file_data):
# upload file
Expand Down Expand Up @@ -267,7 +267,7 @@ def test_update_record_by_web(self, collection_id, record_id, text_splitter):
res_dict = vars(res)
assume_record_result(update_record_data, res_dict)

@pytest.mark.run(order=34)
@pytest.mark.run(order=35)
@pytest.mark.parametrize("upload_file_data", upload_file_data_list[2:3])
def test_update_record_by_file(self, collection_id, record_id, upload_file_data):
# upload file
Expand Down Expand Up @@ -295,7 +295,7 @@ def test_update_record_by_file(self, collection_id, record_id, upload_file_data)
@pytest.mark.run(order=79)
def test_delete_record(self, collection_id):
# List records.

time.sleep(Config.sleep_time)
records = list_records(collection_id=collection_id, order="desc", limit=20, after=None, before=None)
old_nums = len(records)
for index, record in enumerate(records):
Expand Down
2 changes: 1 addition & 1 deletion test_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pytest-ordering==0.6
pytest-xdist==3.6.1
PyYAML==6.0.1
pytest-assume==2.4.3
pytest-asyncio==0.23.6
pytest-asyncio==0.23.7
asyncio==3.4.3
pytest-tornasync>=0.6.0
pytest-trio==0.8.0
Expand Down
Loading