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

[fix] remove calculate tokens for some depricated endpoints #224

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion edenai_apis/apis/google/google_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ def gemini_request(payload: dict, model: str, api_key: str):
message=original_response["error"]["message"],
code=response.status_code,
)
calculate_usage_tokens(original_response=original_response)
# calculate_usage_tokens(original_response=original_response)
return original_response


Expand Down
6 changes: 3 additions & 3 deletions edenai_apis/apis/google/google_image_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def _gemini_pro_vision_qa(
message="Internal Server Error",
code=500,
) from exc
calculate_usage_tokens(original_response=original_response)
# calculate_usage_tokens(original_response=original_response)
answer = original_response["candidates"][0]["content"]["parts"][0]["text"]

standardized_response = QuestionAnswerDataClass(
Expand Down Expand Up @@ -570,8 +570,8 @@ def image__embeddings(
raise ProviderException(message="No predictions found", code=400)

items: Sequence[EmbeddingDataClass] = []
for prediction in original_response["predictions"] :

for prediction in original_response["predictions"]:
embedding = prediction.get("imageEmbedding") or []
items.append(EmbeddingDataClass(embedding=embedding))

Expand Down
1 change: 0 additions & 1 deletion edenai_apis/apis/google/google_text_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ def _handle_non_streaming(
raise ProviderException(
"Provider did not return a valid JSON", code=response.status_code
) from exc
calculate_usage_tokens(original_response)
generated_text = original_response["candidates"][0]["content"]["parts"][0][
"text"
]
Expand Down
Loading