mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
fix potential pydantic ValidationError
This commit is contained in:
parent
191a86f93e
commit
e53188f898
2 changed files with 6 additions and 2 deletions
|
|
@ -130,10 +130,12 @@ class SimpleEngine(RetrieverQueryEngine):
|
|||
retriever_configs: Configuration for retrievers. If more than one config, will use SimpleHybridRetriever.
|
||||
ranker_configs: Configuration for rankers.
|
||||
"""
|
||||
objs = objs or []
|
||||
retriever_configs = retriever_configs or []
|
||||
|
||||
if not objs and any(isinstance(config, BM25RetrieverConfig) for config in retriever_configs):
|
||||
raise ValueError("In BM25RetrieverConfig, Objs must not be empty.")
|
||||
|
||||
objs = objs or []
|
||||
nodes = [ObjectNode(text=obj.rag_key(), metadata=ObjectNode.get_obj_metadata(obj)) for obj in objs]
|
||||
index = VectorStoreIndex(
|
||||
nodes=nodes,
|
||||
|
|
|
|||
|
|
@ -33,7 +33,9 @@ class RAGLLM(CustomLLM):
|
|||
@property
|
||||
def metadata(self) -> LLMMetadata:
|
||||
"""Get LLM metadata."""
|
||||
return LLMMetadata(context_window=self.context_window, num_output=self.num_output, model_name=self.model_name)
|
||||
return LLMMetadata(
|
||||
context_window=self.context_window, num_output=self.num_output, model_name=self.model_name or "unknown"
|
||||
)
|
||||
|
||||
@llm_completion_callback()
|
||||
def complete(self, prompt: str, **kwargs: Any) -> CompletionResponse:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue