Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update text_embedding.py #10240

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ def embed_documents(credentials_kwargs: dict, model: str, texts: list[str]) -> t
embedding_used_tokens += response.usage["total_tokens"]
else:
raise ValueError("Response usage is missing or does not contain total tokens.")


time.sleep(1) # Adjust delay as necessary

return [list(map(float, e)) for e in embeddings], embedding_used_tokens

def _calc_response_usage(self, model: str, credentials: dict, tokens: int) -> EmbeddingUsage:
Expand Down
Loading