mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-11 15:15:18 +02:00
reconstruct object in rag node
This commit is contained in:
parent
f37828c75e
commit
38e8adf9b4
2 changed files with 39 additions and 15 deletions
|
|
@ -22,6 +22,18 @@ TRAVEL_QUESTION = "What does Bob like?"
|
|||
LLM_TIP = "If you not sure, just answer I don't know"
|
||||
|
||||
|
||||
class Player(BaseModel):
|
||||
"""To demonstrate rag add objs"""
|
||||
|
||||
name: str = ""
|
||||
goal: str = "Win The 100-meter Sprint"
|
||||
tool: str = "Red Bull Energy Drink"
|
||||
|
||||
def rag_key(self) -> str:
|
||||
"""For search"""
|
||||
return self.goal
|
||||
|
||||
|
||||
class RAGExample:
|
||||
"""Show how to use RAG."""
|
||||
|
||||
|
|
@ -95,17 +107,6 @@ class RAGExample:
|
|||
|
||||
self._print_title("RAG Add Objs")
|
||||
|
||||
class Player(BaseModel):
|
||||
"""Player"""
|
||||
|
||||
name: str = ""
|
||||
goal: str = "Win The 100-meter Sprint"
|
||||
tool: str = "Red Bull Energy Drink"
|
||||
|
||||
def rag_key(self) -> str:
|
||||
"""For search"""
|
||||
return self.goal
|
||||
|
||||
player = Player(name="Mike")
|
||||
question = f"{player.rag_key()}{LLM_TIP}"
|
||||
|
||||
|
|
@ -118,7 +119,7 @@ class RAGExample:
|
|||
|
||||
print("[Object Detail]")
|
||||
player: Player = nodes[0].metadata["obj"]
|
||||
print(player)
|
||||
print(player.name)
|
||||
|
||||
async def rag_chromadb(self):
|
||||
"""This example show how to use chromadb. how to save and load index. will print something like:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue