-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(py): Implementation of embedders api in Ollama Plugin
- Loading branch information
Showing
13 changed files
with
557 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2025 Google LLC | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
from genkit.ai.embedding import EmbedRequest, EmbedResponse | ||
from genkit.plugins.ollama.models import EmbeddingModelDefinition | ||
|
||
import ollama as ollama_api | ||
|
||
|
||
class OllamaEmbedder: | ||
def __init__( | ||
self, | ||
client: ollama_api.AsyncClient, | ||
embedding_definition: EmbeddingModelDefinition, | ||
): | ||
self.client = client | ||
self.embedding_definition = embedding_definition | ||
|
||
async def embed(self, request: EmbedRequest) -> EmbedResponse: | ||
return await self.client.embed( | ||
model=self.embedding_definition.name, | ||
input=request.documents, | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.