xintongsong commented on code in PR #439:
URL: https://github.com/apache/flink-agents/pull/439#discussion_r2693385896
##########
.github/workflows/ci.yml:
##########
@@ -173,6 +188,15 @@ jobs:
java-version: [ '17' ]
steps:
- uses: actions/checkout@v4
+ - name: Free disk space
+ uses:
jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
+ with:
+ tool-cache: true
+ android: true
+ dotnet: true
+ haskell: true
+ large-packages: true
+ docker-images: true
Review Comment:
Why do we need this step?
##########
python/flink_agents/e2e_tests/e2e_tests_resource_cross_language/vector_store_cross_language_agent.py:
##########
@@ -0,0 +1,207 @@
+################################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#################################################################################
+import os
+import time
+
+import pytest
+
+from flink_agents.api.agents.agent import Agent
+from flink_agents.api.decorators import (
+ action,
+ embedding_model_connection,
+ embedding_model_setup,
+ vector_store,
+)
+from flink_agents.api.embedding_models.java_embedding_model import (
+ JavaEmbeddingModelConnection,
+ JavaEmbeddingModelSetup,
+)
+from flink_agents.api.events.context_retrieval_event import (
+ ContextRetrievalRequestEvent,
+ ContextRetrievalResponseEvent,
+)
+from flink_agents.api.events.event import InputEvent, OutputEvent
+from flink_agents.api.resource import ResourceDescriptor, ResourceType
+from flink_agents.api.runner_context import RunnerContext
+from flink_agents.api.vector_stores.java_vector_store import (
+ JavaCollectionManageableVectorStore,
+)
+from flink_agents.api.vector_stores.vector_store import (
+ CollectionManageableVectorStore,
+ Document,
+)
+from flink_agents.integrations.embedding_models.local.ollama_embedding_model
import (
+ OllamaEmbeddingModelConnection,
+ OllamaEmbeddingModelSetup,
+)
+
+TEST_COLLECTION = "test_collection"
+MAX_RETRIES_TIMES = 10
+
+class VectorStoreCrossLanguageAgent(Agent):
+ """Example agent demonstrating cross-language embedding model testing."""
+
+ @embedding_model_connection
+ @staticmethod
+ def embedding_model_connection() -> ResourceDescriptor:
+ """EmbeddingModelConnection responsible for ollama model service
connection."""
+ if os.environ.get("EMBEDDING_TYPE") == "JAVA":
+ return ResourceDescriptor(
+ clazz=JavaEmbeddingModelConnection,
+
java_clazz="org.apache.flink.agents.integrations.embeddingmodels.ollama.OllamaEmbeddingModelConnection",
+ host="http://localhost:11434",
+ )
+ return ResourceDescriptor(
+ clazz=OllamaEmbeddingModelConnection,
+ host="http://localhost:11434",
+ )
+
+ @embedding_model_setup
+ @staticmethod
+ def embedding_model() -> ResourceDescriptor:
+ """EmbeddingModel which focus on math, and reuse
ChatModelConnection."""
+ if os.environ.get("EMBEDDING_TYPE") == "JAVA":
+ return ResourceDescriptor(
+ clazz=JavaEmbeddingModelSetup,
+
java_clazz="org.apache.flink.agents.integrations.embeddingmodels.ollama.OllamaEmbeddingModelSetup",
+ connection="embedding_model_connection",
+ model=os.environ.get(
+ "OLLAMA_EMBEDDING_MODEL", "nomic-embed-text:latest"
+ ),
+ )
+ return ResourceDescriptor(
+ clazz=OllamaEmbeddingModelSetup,
+ connection="embedding_model_connection",
+ model=os.environ.get("OLLAMA_EMBEDDING_MODEL",
"nomic-embed-text:latest"),
+ )
+
+ @vector_store
+ @staticmethod
+ def vector_store() -> ResourceDescriptor:
+ """Vector store setup for knowledge base."""
+ return ResourceDescriptor(
+ clazz=JavaCollectionManageableVectorStore,
+
java_clazz="org.apache.flink.agents.integrations.vectorstores.elasticsearch.ElasticsearchVectorStore",
+ embedding_model="embedding_model",
+ host=os.environ.get("ES_HOST", "http://localhost:9200"),
Review Comment:
The test case should not assume that it's always executed in the GHA
pipeline and the ES service always exist. We can set the ES_HOST env in the ci
pipeline. And if the env is not set, the test should be skipped.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]