Skip to content

Commit

Permalink
fix: fixed type of tokens in embeddings request from float to int (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
adubovik authored Jul 18, 2024
1 parent e315926 commit 608bd4e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions aidial_sdk/embeddings/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

from aidial_sdk.chat_completion.request import Attachment
from aidial_sdk.deployment.from_request_mixin import FromRequestDeploymentMixin
from aidial_sdk.pydantic_v1 import StrictFloat, StrictInt, StrictStr
from aidial_sdk.pydantic_v1 import StrictInt, StrictStr
from aidial_sdk.utils.pydantic import ExtraForbidModel


class AzureEmbeddingsRequest(ExtraForbidModel):
model: Optional[StrictStr] = None
input: Union[
StrictStr, List[StrictStr], List[StrictFloat], List[List[StrictFloat]]
StrictStr, List[StrictStr], List[StrictInt], List[List[StrictInt]]
]
encoding_format: Literal["float", "base64"] = "float"
dimensions: Optional[StrictInt] = None
Expand Down
14 changes: 13 additions & 1 deletion tests/test_embeddings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,19 @@
TestCase(
simple,
"embeddings",
{"input": "a", "custom_fields": {"type": "query"}},
{
"input": "a",
"custom_fields": {
"type": "query",
"instruction": "instruction",
},
},
expected_response_1,
),
TestCase(
simple,
"embeddings",
{"input": [15339]},
expected_response_1,
),
TestCase(
Expand Down

0 comments on commit 608bd4e

Please sign in to comment.