Skip to content

Commit 736d4ee

Browse files
committed
feat(py/genkit): added the resolve method dummy for vectorstore plugin.
1 parent ffe2c07 commit 736d4ee

File tree

3 files changed

+66
-1
lines changed

3 files changed

+66
-1
lines changed

py/plugins/dev-local-vectorstore/src/genkit/plugins/dev_local_vectorstore/plugin_api.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from genkit.ai import GenkitRegistry, Plugin
2222
from genkit.core.action import Action
2323
from genkit.types import Docs
24-
24+
from genkit.core.registry import ActionKind
2525
from .indexer import (
2626
DevLocalVectorStoreIndexer,
2727
)
@@ -31,6 +31,7 @@
3131
)
3232

3333

34+
3435
class DevLocalVectorStore(Plugin):
3536
"""Local file-based vectorstore plugin that provides retriever and indexer.
3637
@@ -60,6 +61,14 @@ def initialize(self, ai: GenkitRegistry) -> None:
6061
self._configure_dev_local_retriever(ai=ai)
6162
self._configure_dev_local_indexer(ai=ai)
6263

64+
def resolve_action( # noqa: B027
65+
self,
66+
ai: GenkitRegistry,
67+
kind: ActionKind,
68+
name: str,
69+
) -> None:
70+
...
71+
6372
def _configure_dev_local_retriever(self, ai: GenkitRegistry) -> Action:
6473
"""Registers Local Vector Store retriever for provided parameters.
6574
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import pytest
2+
3+
from genkit.plugins.dev_local_vectorstore import DevLocalVectorStore
4+
from genkit.plugins.google_genai import VertexEmbeddingModels
5+
from unittest import mock
6+
from unittest.mock import AsyncMock, MagicMock, patch
7+
8+
@pytest.fixture
9+
@patch('ollama.AsyncClient')
10+
def vectorstore_plugin_instance(ollama_async_client):
11+
"""Common instance of ollama plugin."""
12+
return DevLocalVectorStore(
13+
name='menu-items',
14+
embedder=VertexEmbeddingModels.TEXT_EMBEDDING_004_ENG,
15+
embedder_options={'taskType': 'RETRIEVAL_DOCUMENT'},
16+
)
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
# SPDX-License-Identifier: Apache-2.0
16+
17+
"""Unit tests for Ollama Plugin."""
18+
19+
from unittest.mock import MagicMock
20+
21+
import pytest
22+
23+
from genkit.ai import Genkit
24+
from genkit.core.action.types import ActionKind
25+
26+
27+
@pytest.mark.parametrize(
28+
'kind, name',
29+
[
30+
(ActionKind.MODEL, 'test_model'),
31+
(ActionKind.EMBEDDER, 'test_embedder'),
32+
],
33+
)
34+
def test_action_resolve(kind, name, vectorstore_plugin_instance):
35+
"""Test initialize method of Ollama plugin."""
36+
ai_mock = MagicMock(spec=Genkit)
37+
assert hasattr(vectorstore_plugin_instance, "resolve_action")
38+
assert vectorstore_plugin_instance.resolve_action(ai_mock, kind, name) is None
39+
40+

0 commit comments

Comments
 (0)