diff --git a/.github/workflows/fulltest.yaml b/.github/workflows/fulltest.yaml index 2ab6444fa..32eb3da00 100644 --- a/.github/workflows/fulltest.yaml +++ b/.github/workflows/fulltest.yaml @@ -79,8 +79,8 @@ jobs: ./tests/data/rsp_cache_new.json retention-days: 3 if: ${{ always() }} - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - if: ${{ always() }} + # - name: Upload coverage reports to Codecov + # uses: codecov/codecov-action@v3 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # if: ${{ always() }} diff --git a/.github/workflows/unittest.yaml b/.github/workflows/unittest.yaml index 25f82b1e6..1fd193b52 100644 --- a/.github/workflows/unittest.yaml +++ b/.github/workflows/unittest.yaml @@ -91,8 +91,8 @@ jobs: ./tests/data/rsp_cache_new.json retention-days: 3 if: ${{ always() }} - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v3 - env: - CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - if: ${{ always() }} + # - name: Upload coverage reports to Codecov + # uses: codecov/codecov-action@v3 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # if: ${{ always() }} diff --git a/metagpt/provider/bedrock/bedrock_provider.py b/metagpt/provider/bedrock/bedrock_provider.py index 90475bf41..c5e3b7bd2 100644 --- a/metagpt/provider/bedrock/bedrock_provider.py +++ b/metagpt/provider/bedrock/bedrock_provider.py @@ -69,19 +69,9 @@ class CohereProvider(BaseBedrockProvider): def messages_to_prompt(self, messages: list[dict]) -> str: if "command-r" in self.model_name: - role_map = { - "user": "USER", - "assistant": "CHATBOT", - "system": "USER" - } + role_map = {"user": "USER", "assistant": "CHATBOT", "system": "USER"} messages = list( - map( - lambda message: { - "role": role_map[message["role"]], - "message": message["content"] - }, - messages - ) + map(lambda message: {"role": role_map[message["role"]], "message": message["content"]}, messages) ) return messages else: @@ -92,17 +82,9 @@ class CohereProvider(BaseBedrockProvider): prompt = self.messages_to_prompt(messages) if "command-r" in self.model_name: chat_history, message = prompt[:-1], prompt[-1]["message"] - body = json.dumps({ - "message": message, - "chat_history": chat_history, - **generate_kwargs - }) + body = json.dumps({"message": message, "chat_history": chat_history, **generate_kwargs}) else: - body = json.dumps({ - "prompt": prompt, - "stream": kwargs.get("stream", False), - **generate_kwargs - }) + body = json.dumps({"prompt": prompt, "stream": kwargs.get("stream", False), **generate_kwargs}) return body def get_choice_text_from_stream(self, event) -> str: diff --git a/metagpt/provider/bedrock/utils.py b/metagpt/provider/bedrock/utils.py index 66e98c759..e67796362 100644 --- a/metagpt/provider/bedrock/utils.py +++ b/metagpt/provider/bedrock/utils.py @@ -91,7 +91,7 @@ SUPPORT_STREAM_MODELS = { # Mistral Large (24.02) "mistral.mistral-large-2402-v1:0": 8192, # Mistral Large 2 (24.07) - "mistral.mistral-large-2407-v1:0": 8192 + "mistral.mistral-large-2407-v1:0": 8192, } # TODO:use a more general function for constructing chat templates. diff --git a/metagpt/provider/bedrock_api.py b/metagpt/provider/bedrock_api.py index 4cf22f41b..4e783f579 100644 --- a/metagpt/provider/bedrock_api.py +++ b/metagpt/provider/bedrock_api.py @@ -1,6 +1,6 @@ -import os import asyncio import json +import os from functools import partial from typing import List, Literal diff --git a/metagpt/rag/factories/index.py b/metagpt/rag/factories/index.py index 6da4900a0..4e6d6b167 100644 --- a/metagpt/rag/factories/index.py +++ b/metagpt/rag/factories/index.py @@ -30,7 +30,7 @@ class RAGIndexFactory(ConfigBasedFactory): BM25IndexConfig: self._create_bm25, ElasticsearchIndexConfig: self._create_es, ElasticsearchKeywordIndexConfig: self._create_es, - MilvusIndexConfig: self._create_milvus + MilvusIndexConfig: self._create_milvus, } super().__init__(creators) diff --git a/metagpt/rag/factories/retriever.py b/metagpt/rag/factories/retriever.py index 3342b8905..490df4906 100644 --- a/metagpt/rag/factories/retriever.py +++ b/metagpt/rag/factories/retriever.py @@ -139,7 +139,9 @@ class RetrieverFactory(ConfigBasedFactory): @get_or_build_index def _build_milvus_index(self, config: MilvusRetrieverConfig, **kwargs) -> VectorStoreIndex: - vector_store = MilvusVectorStore(uri=config.uri, collection_name=config.collection_name, token=config.token, dim=config.dimensions) + vector_store = MilvusVectorStore( + uri=config.uri, collection_name=config.collection_name, token=config.token, dim=config.dimensions + ) return self._build_index_from_vector_store(config, vector_store, **kwargs) diff --git a/metagpt/rag/retrievers/milvus_retriever.py b/metagpt/rag/retrievers/milvus_retriever.py index ff2562bd8..bcc66330b 100644 --- a/metagpt/rag/retrievers/milvus_retriever.py +++ b/metagpt/rag/retrievers/milvus_retriever.py @@ -14,4 +14,4 @@ class MilvusRetriever(VectorIndexRetriever): def persist(self, persist_dir: str, **kwargs) -> None: """Support persist. - Milvus automatically saves, so there is no need to implement.""" \ No newline at end of file + Milvus automatically saves, so there is no need to implement.""" diff --git a/metagpt/rag/schema.py b/metagpt/rag/schema.py index e4d97068d..1e04a546f 100644 --- a/metagpt/rag/schema.py +++ b/metagpt/rag/schema.py @@ -8,7 +8,7 @@ from llama_index.core.embeddings import BaseEmbedding from llama_index.core.indices.base import BaseIndex from llama_index.core.schema import TextNode from llama_index.core.vector_stores.types import VectorStoreQueryMode -from pydantic import BaseModel, ConfigDict, Field, PrivateAttr, model_validator, validator +from pydantic import BaseModel, ConfigDict, Field, PrivateAttr, model_validator from metagpt.config2 import config from metagpt.configs.embedding_config import EmbeddingType @@ -199,6 +199,7 @@ class ChromaIndexConfig(VectorIndexConfig): default=None, description="Optional metadata to associate with the collection" ) + class MilvusIndexConfig(VectorIndexConfig): """Config for milvus-based index.""" diff --git a/milvus_local.db b/milvus_local.db new file mode 100644 index 000000000..fdc101fa4 Binary files /dev/null and b/milvus_local.db differ diff --git a/tests/metagpt/rag/factories/test_index.py b/tests/metagpt/rag/factories/test_index.py index 9861e1242..e084eb6e7 100644 --- a/tests/metagpt/rag/factories/test_index.py +++ b/tests/metagpt/rag/factories/test_index.py @@ -7,7 +7,8 @@ from metagpt.rag.schema import ( ChromaIndexConfig, ElasticsearchIndexConfig, ElasticsearchStoreConfig, - FAISSIndexConfig, MilvusIndexConfig, + FAISSIndexConfig, + MilvusIndexConfig, )