diff --git a/api.md b/api.md index ed52cc9..3106527 100644 --- a/api.md +++ b/api.md @@ -3,12 +3,12 @@ Types: ```python -from groq.types import EmbeddingCreateResponse +from groq.types import Embeddings ``` Methods: -- client.embeddings.create(\*\*params) -> EmbeddingCreateResponse +- client.embeddings.create(\*\*params) -> Embeddings # Chat diff --git a/src/groq/resources/embeddings.py b/src/groq/resources/embeddings.py index c83fc87..6f39012 100644 --- a/src/groq/resources/embeddings.py +++ b/src/groq/resources/embeddings.py @@ -24,7 +24,7 @@ from .._base_client import ( make_request_options, ) -from ..types.embedding_create_response import EmbeddingCreateResponse +from ..types.embeddings import Embeddings __all__ = ["EmbeddingsResource", "AsyncEmbeddingsResource"] @@ -52,7 +52,7 @@ def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmbeddingCreateResponse: + ) -> Embeddings: """ Creates an embedding vector representing the input text. @@ -94,7 +94,7 @@ def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=EmbeddingCreateResponse, + cast_to=Embeddings, ) @@ -121,7 +121,7 @@ async def create( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> EmbeddingCreateResponse: + ) -> Embeddings: """ Creates an embedding vector representing the input text. @@ -163,7 +163,7 @@ async def create( options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), - cast_to=EmbeddingCreateResponse, + cast_to=Embeddings, ) diff --git a/src/groq/types/__init__.py b/src/groq/types/__init__.py index 6555b64..46ad590 100644 --- a/src/groq/types/__init__.py +++ b/src/groq/types/__init__.py @@ -3,7 +3,7 @@ from __future__ import annotations from .model import Model as Model +from .embeddings import Embeddings as Embeddings from .model_list import ModelList as ModelList from .translation import Translation as Translation from .embedding_create_params import EmbeddingCreateParams as EmbeddingCreateParams -from .embedding_create_response import EmbeddingCreateResponse as EmbeddingCreateResponse diff --git a/src/groq/types/embedding_create_response.py b/src/groq/types/embeddings.py similarity index 91% rename from src/groq/types/embedding_create_response.py rename to src/groq/types/embeddings.py index 924808c..db16a46 100644 --- a/src/groq/types/embedding_create_response.py +++ b/src/groq/types/embeddings.py @@ -5,7 +5,7 @@ from .._models import BaseModel -__all__ = ["EmbeddingCreateResponse", "Data", "Usage"] +__all__ = ["Embeddings", "Data", "Usage"] class Data(BaseModel): @@ -31,7 +31,7 @@ class Usage(BaseModel): """The total number of tokens used by the request.""" -class EmbeddingCreateResponse(BaseModel): +class Embeddings(BaseModel): data: List[Data] """The list of embeddings generated by the model.""" diff --git a/tests/api_resources/test_embeddings.py b/tests/api_resources/test_embeddings.py index c95676a..41688e8 100644 --- a/tests/api_resources/test_embeddings.py +++ b/tests/api_resources/test_embeddings.py @@ -8,7 +8,7 @@ import pytest from groq import Groq, AsyncGroq -from groq.types import EmbeddingCreateResponse +from groq.types import Embeddings from tests.utils import assert_matches_type base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +23,7 @@ def test_method_create(self, client: Groq) -> None: input="The quick brown fox jumped over the lazy dog", model="nomic-embed-text-v1.5", ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) + assert_matches_type(Embeddings, embedding, path=["response"]) @parametrize def test_method_create_with_all_params(self, client: Groq) -> None: @@ -34,7 +34,7 @@ def test_method_create_with_all_params(self, client: Groq) -> None: encoding_format="float", user="string", ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) + assert_matches_type(Embeddings, embedding, path=["response"]) @parametrize def test_raw_response_create(self, client: Groq) -> None: @@ -46,7 +46,7 @@ def test_raw_response_create(self, client: Groq) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" embedding = response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) + assert_matches_type(Embeddings, embedding, path=["response"]) @parametrize def test_streaming_response_create(self, client: Groq) -> None: @@ -58,7 +58,7 @@ def test_streaming_response_create(self, client: Groq) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" embedding = response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) + assert_matches_type(Embeddings, embedding, path=["response"]) assert cast(Any, response.is_closed) is True @@ -72,7 +72,7 @@ async def test_method_create(self, async_client: AsyncGroq) -> None: input="The quick brown fox jumped over the lazy dog", model="nomic-embed-text-v1.5", ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) + assert_matches_type(Embeddings, embedding, path=["response"]) @parametrize async def test_method_create_with_all_params(self, async_client: AsyncGroq) -> None: @@ -83,7 +83,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncGroq) -> N encoding_format="float", user="string", ) - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) + assert_matches_type(Embeddings, embedding, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncGroq) -> None: @@ -95,7 +95,7 @@ async def test_raw_response_create(self, async_client: AsyncGroq) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" embedding = await response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) + assert_matches_type(Embeddings, embedding, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncGroq) -> None: @@ -107,6 +107,6 @@ async def test_streaming_response_create(self, async_client: AsyncGroq) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" embedding = await response.parse() - assert_matches_type(EmbeddingCreateResponse, embedding, path=["response"]) + assert_matches_type(Embeddings, embedding, path=["response"]) assert cast(Any, response.is_closed) is True