Skip to content

Commit

Permalink
Merge pull request #1515 from voidking/main
Browse files Browse the repository at this point in the history
删除codecov
  • Loading branch information
geekan authored Oct 20, 2024
2 parents 8387e28 + ac4eb30 commit ae4e5d3
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 39 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/fulltest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
10 changes: 5 additions & 5 deletions .github/workflows/unittest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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() }}
26 changes: 4 additions & 22 deletions metagpt/provider/bedrock/bedrock_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,9 @@ def _get_completion_from_dict(self, rsp_dict: dict) -> str:

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:
Expand All @@ -92,17 +82,9 @@ def get_request_body(self, messages: list[dict], generate_kwargs, *args, **kwarg
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:
Expand Down
2 changes: 1 addition & 1 deletion metagpt/provider/bedrock/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
# 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.
Expand Down
2 changes: 1 addition & 1 deletion metagpt/provider/bedrock_api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import asyncio
import json
import os
from functools import partial
from typing import List, Literal

Expand Down
2 changes: 1 addition & 1 deletion metagpt/rag/factories/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(self):
BM25IndexConfig: self._create_bm25,
ElasticsearchIndexConfig: self._create_es,
ElasticsearchKeywordIndexConfig: self._create_es,
MilvusIndexConfig: self._create_milvus
MilvusIndexConfig: self._create_milvus,
}
super().__init__(creators)

Expand Down
4 changes: 3 additions & 1 deletion metagpt/rag/factories/retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ def _build_chroma_index(self, config: ChromaRetrieverConfig, **kwargs) -> Vector

@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)

Expand Down
2 changes: 1 addition & 1 deletion metagpt/rag/retrievers/milvus_retriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ def add_nodes(self, nodes: list[BaseNode], **kwargs) -> None:
def persist(self, persist_dir: str, **kwargs) -> None:
"""Support persist.
Milvus automatically saves, so there is no need to implement."""
Milvus automatically saves, so there is no need to implement."""
3 changes: 2 additions & 1 deletion metagpt/rag/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
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
Expand Down Expand Up @@ -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."""

Expand Down
Binary file added milvus_local.db
Binary file not shown.
3 changes: 2 additions & 1 deletion tests/metagpt/rag/factories/test_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
ChromaIndexConfig,
ElasticsearchIndexConfig,
ElasticsearchStoreConfig,
FAISSIndexConfig, MilvusIndexConfig,
FAISSIndexConfig,
MilvusIndexConfig,
)


Expand Down

0 comments on commit ae4e5d3

Please sign in to comment.