diff --git a/libs/community/langchain_community/embeddings/openai.py b/libs/community/langchain_community/embeddings/openai.py index 99f41e62856dd..14870572fc272 100644 --- a/libs/community/langchain_community/embeddings/openai.py +++ b/libs/community/langchain_community/embeddings/openai.py @@ -491,7 +491,7 @@ def _get_len_safe_embeddings( **self._invocation_params, ) if not isinstance(response, dict): - response = response.dict() + response = response.model_dump() batched_embeddings.extend(r["embedding"] for r in response["data"]) results: List[List[List[float]]] = [[] for _ in range(len(texts))] @@ -512,7 +512,7 @@ def _get_len_safe_embeddings( **self._invocation_params, ) if not isinstance(average_embedded, dict): - average_embedded = average_embedded.dict() + average_embedded = average_embedded.model_dump() average = average_embedded["data"][0]["embedding"] else: average = np.average(_result, axis=0, weights=num_tokens_in_batch[i]) @@ -616,7 +616,7 @@ async def _aget_len_safe_embeddings( ) if not isinstance(response, dict): - response = response.dict() + response = response.model_dump() batched_embeddings.extend(r["embedding"] for r in response["data"]) results: List[List[List[float]]] = [[] for _ in range(len(texts))]