sjyangkevin commented on code in PR #51396:
URL: https://github.com/apache/airflow/pull/51396#discussion_r2134414695
##########
providers/cohere/src/airflow/providers/cohere/hooks/cohere.py:
##########
@@ -100,8 +100,9 @@ def create_embeddings(
embedding_types=["float"],
request_options=self.request_options,
)
- embeddings = response.embeddings
- return embeddings
+ if response.embeddings.float_ is None:
+ raise ValueError("Embeddings response is missing float_ field")
+ return response.embeddings.float_
Review Comment:
I would like to provide some of my findings about this change. As shown
https://github.com/cohere-ai/cohere-python/blob/main/src/cohere/types/embed_by_type_response_embeddings.py.
There could be a case that the embedding is stored in other fields. I also
share some thoughts in the comment, and it will be better if the pydantic model
can be handled by XComs serde.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]