Skip to content

feat(py/genkit): added the resolve method dummy for vectorstore plugin. #3022

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from genkit.ai import GenkitRegistry, Plugin
from genkit.core.action import Action
from genkit.core.registry import ActionKind
from genkit.types import Docs

from .indexer import (
Expand Down Expand Up @@ -60,6 +61,14 @@ def initialize(self, ai: GenkitRegistry) -> None:
self._configure_dev_local_retriever(ai=ai)
self._configure_dev_local_indexer(ai=ai)

def resolve_action(
self,
ai: GenkitRegistry,
kind: ActionKind,
name: str,
) -> None:
...

def _configure_dev_local_retriever(self, ai: GenkitRegistry) -> Action:
"""Registers Local Vector Store retriever for provided parameters.

Expand Down
35 changes: 35 additions & 0 deletions py/plugins/dev-local-vectorstore/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

"""Conftest for Vectorstore plugin."""

from unittest.mock import patch

import pytest

from genkit.plugins.dev_local_vectorstore import DevLocalVectorStore
from genkit.plugins.google_genai import VertexEmbeddingModels


@pytest.fixture
@patch('ollama.AsyncClient')
def vectorstore_plugin_instance(ollama_async_client):
"""Common instance of ollama plugin."""
return DevLocalVectorStore(
name='menu-items',
embedder=VertexEmbeddingModels.TEXT_EMBEDDING_004_ENG,
embedder_options={'taskType': 'RETRIEVAL_DOCUMENT'},
)
40 changes: 40 additions & 0 deletions py/plugins/dev-local-vectorstore/tests/test_plugin_api.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

"""Unit tests for Vectorstore Plugin."""

from unittest.mock import MagicMock

import pytest

from genkit.ai import Genkit
from genkit.core.action.types import ActionKind


@pytest.mark.parametrize(
'kind, name',
[
(ActionKind.MODEL, 'test_model'),
(ActionKind.EMBEDDER, 'test_embedder'),
],
)
def test_action_resolve(kind, name, vectorstore_plugin_instance):
"""Test initialize method of Vectorstore plugin."""
ai_mock = MagicMock(spec=Genkit)
assert hasattr(vectorstore_plugin_instance, "resolve_action")
assert vectorstore_plugin_instance.resolve_action(ai_mock, kind, name) is None


Loading