Skip to content

Commit

Permalink
fix: switch gemini embed to sync (#7096)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 558fe7235766b48c942954e05a0f7e1027768459
  • Loading branch information
berkecanrizai authored and Manul from Pathway committed Aug 6, 2024
1 parent af03b30 commit f91b9ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]

### Fixed
- Switched `pw.xpacks.llm.embedders.GeminiEmbedder` to be sync to resolve compatibility issues with the Google Colab runs.
- Pinned `surya-ocr` module version for stability.

## [0.14.1] - 2024-08-05

### Added
Expand Down
4 changes: 2 additions & 2 deletions python/pathway/xpacks/llm/embedders.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def __init__(
if api_key is not None:
self.kwargs["api_key"] = api_key

async def __wrapped__(self, input: str, **kwargs) -> list[float]:
def __wrapped__(self, input: str, **kwargs) -> list[float]:
import google.generativeai as genai

kwargs = {**self.kwargs, **kwargs}
Expand All @@ -406,6 +406,6 @@ async def __wrapped__(self, input: str, **kwargs) -> list[float]:
if api_key is not None:
genai.configure(api_key=api_key)

response = await genai.embed_content_async(model, content=[input], **kwargs)
response = genai.embed_content(model, content=[input], **kwargs)
embedding = response["embedding"][0]
return embedding

0 comments on commit f91b9ff

Please sign in to comment.