mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-13 23:11:40 +00:00
fix(voyage): ruff format + add missing query-string test coverage
This commit is contained in:
parent
be6487d33c
commit
e8ae29f135
2 changed files with 17 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
This module is used to transform the request and response for the Voyage contextualized embeddings API.
|
||||
This would be used for all the contextualized embeddings models in Voyage.
|
||||
"""
|
||||
|
||||
from typing import Any, Dict, List, Optional, Tuple, Union
|
||||
|
||||
import httpx
|
||||
|
|
|
|||
|
|
@ -300,6 +300,22 @@ class TestVoyageContextualEmbeddings:
|
|||
assert transformed["chunk_size"] == 32000
|
||||
assert transformed["input_type"] == "document"
|
||||
|
||||
def test_contextual_single_string_query_no_auto_chunk(self):
|
||||
"""A single string with input_type='query' is not auto-chunked."""
|
||||
from litellm.llms.voyage.embedding.transformation_contextual import (
|
||||
VoyageContextualEmbeddingConfig,
|
||||
)
|
||||
|
||||
config = VoyageContextualEmbeddingConfig()
|
||||
|
||||
transformed = config.transform_embedding_request(
|
||||
"voyage-context-4", "Hello", {"input_type": "query"}, {}
|
||||
)
|
||||
|
||||
assert transformed["inputs"] == ["Hello"]
|
||||
assert transformed["input_type"] == "query"
|
||||
assert "enable_auto_chunking" not in transformed
|
||||
|
||||
def test_contextual_nested_input_passthrough(self):
|
||||
"""Already-nested list[list[str]] input is passed through unchanged."""
|
||||
from litellm.llms.voyage.embedding.transformation_contextual import (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue