refactor: switch to the new default nomic-embed-text-v1.5 embedding model in LS

This commit is contained in:
r3v5 2025-08-18 10:34:46 +01:00
parent f1748e2f92
commit 1d0f0a0d8e
No known key found for this signature in database
GPG key ID: C7611ACB4FECAD54
63 changed files with 16170 additions and 186 deletions

View file

@ -372,8 +372,20 @@ def test_openai_vector_store_search_with_ranking_options(
chunks=sample_chunks,
)
# First search without threshold to determine reasonable threshold
initial_search = compat_client.vector_stores.search(
vector_store_id=vector_store.id,
query="machine learning and artificial intelligence",
max_num_results=3,
)
# Use a threshold that's lower than the lowest score to ensure we get results
if initial_search.data:
threshold = min(result.score for result in initial_search.data) * 0.9
else:
threshold = 0.01
# Search with ranking options
threshold = 0.1
search_response = compat_client.vector_stores.search(
vector_store_id=vector_store.id,
query="machine learning and artificial intelligence",
@ -488,7 +500,12 @@ def test_openai_vector_store_attach_file(compat_client_with_empty_stores, client
test_content = b"The secret string is foobazbar."
with BytesIO(test_content) as file_buffer:
file_buffer.name = "openai_test.txt"
file = compat_client.files.create(file=file_buffer, purpose="assistants")
file = compat_client.files.create(
file=file_buffer,
purpose="assistants",
expires_after_anchor="created_at",
expires_after_seconds=86400, # 24 hours
)
# Attach the file to the vector store
file_attach_response = compat_client.vector_stores.files.create(
@ -534,7 +551,12 @@ def test_openai_vector_store_attach_files_on_creation(compat_client_with_empty_s
for i in range(3):
with BytesIO(f"This is a test file {i}".encode()) as file_buffer:
file_buffer.name = f"openai_test_{i}.txt"
file = compat_client.files.create(file=file_buffer, purpose="assistants")
file = compat_client.files.create(
file=file_buffer,
purpose="assistants",
expires_after_anchor="created_at",
expires_after_seconds=86400, # 24 hours
)
valid_file_ids.append(file.id)
# include an invalid file ID so we can test failed status
@ -590,7 +612,12 @@ def test_openai_vector_store_list_files(compat_client_with_empty_stores, client_
for i in range(3):
with BytesIO(f"This is a test file {i}".encode()) as file_buffer:
file_buffer.name = f"openai_test_{i}.txt"
file = compat_client.files.create(file=file_buffer, purpose="assistants")
file = compat_client.files.create(
file=file_buffer,
purpose="assistants",
expires_after_anchor="created_at",
expires_after_seconds=86400, # 24 hours
)
response = compat_client.vector_stores.files.create(
vector_store_id=vector_store.id,
@ -666,7 +693,12 @@ def test_openai_vector_store_retrieve_file_contents(compat_client_with_empty_sto
attributes = {"foo": "bar"}
with BytesIO(test_content) as file_buffer:
file_buffer.name = file_name
file = compat_client.files.create(file=file_buffer, purpose="assistants")
file = compat_client.files.create(
file=file_buffer,
purpose="assistants",
expires_after_anchor="created_at",
expires_after_seconds=86400, # 24 hours
)
# Attach the file to the vector store
file_attach_response = compat_client.vector_stores.files.create(
@ -709,7 +741,12 @@ def test_openai_vector_store_delete_file(compat_client_with_empty_stores, client
for i in range(3):
with BytesIO(f"This is a test file {i}".encode()) as file_buffer:
file_buffer.name = f"openai_test_{i}.txt"
file = compat_client.files.create(file=file_buffer, purpose="assistants")
file = compat_client.files.create(
file=file_buffer,
purpose="assistants",
expires_after_anchor="created_at",
expires_after_seconds=86400, # 24 hours
)
compat_client.vector_stores.files.create(
vector_store_id=vector_store.id,
@ -760,7 +797,12 @@ def test_openai_vector_store_delete_file_removes_from_vector_store(compat_client
test_content = b"The secret string is foobazbar."
with BytesIO(test_content) as file_buffer:
file_buffer.name = "openai_test.txt"
file = compat_client.files.create(file=file_buffer, purpose="assistants")
file = compat_client.files.create(
file=file_buffer,
purpose="assistants",
expires_after_anchor="created_at",
expires_after_seconds=86400, # 24 hours
)
# Attach the file to the vector store
file_attach_response = compat_client.vector_stores.files.create(
@ -798,7 +840,12 @@ def test_openai_vector_store_update_file(compat_client_with_empty_stores, client
test_content = b"This is a test file"
with BytesIO(test_content) as file_buffer:
file_buffer.name = "openai_test.txt"
file = compat_client.files.create(file=file_buffer, purpose="assistants")
file = compat_client.files.create(
file=file_buffer,
purpose="assistants",
expires_after_anchor="created_at",
expires_after_seconds=86400, # 24 hours
)
# Attach the file to the vector store
file_attach_response = compat_client.vector_stores.files.create(
@ -841,7 +888,12 @@ def test_create_vector_store_files_duplicate_vector_store_name(compat_client_wit
for i in range(3):
with BytesIO(f"This is a test file {i}".encode()) as file_buffer:
file_buffer.name = f"openai_test_{i}.txt"
file = compat_client.files.create(file=file_buffer, purpose="assistants")
file = compat_client.files.create(
file=file_buffer,
purpose="assistants",
expires_after_anchor="created_at",
expires_after_seconds=86400, # 24 hours
)
file_ids.append(file.id)
vector_store = compat_client.vector_stores.create(