mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-30 19:36:24 +02:00
feat: + summary
This commit is contained in:
parent
2324c1c6dc
commit
ef485e7400
2 changed files with 24 additions and 1 deletions
|
|
@ -5,10 +5,13 @@
|
|||
@File : metagpt_llm_api.py
|
||||
@Desc : MetaGPT LLM related APIs
|
||||
"""
|
||||
import json
|
||||
|
||||
import openai
|
||||
from pydantic import BaseModel
|
||||
|
||||
from metagpt.config import CONFIG
|
||||
from metagpt.memory.brain_memory import BrainMemory
|
||||
from metagpt.provider import OpenAIGPTAPI
|
||||
from metagpt.provider.openai_api import RateLimiter
|
||||
|
||||
|
|
@ -31,3 +34,21 @@ class MetaGPTLLMAPI(OpenAIGPTAPI):
|
|||
openai.api_type = CONFIG.METAGPT_API_TYPE
|
||||
openai.api_version = CONFIG.METAGPT_API_VERSION
|
||||
self.rpm = int(CONFIG.RPM) if CONFIG.RPM else 10
|
||||
|
||||
async def get_summary(self, memory: BrainMemory, max_words=200, keep_language: bool = False, **kwargs):
|
||||
summary = []
|
||||
|
||||
class QuweryAnswerPair(BaseModel):
|
||||
ask: str
|
||||
answer: str
|
||||
|
||||
rh = reversed(memory.history)
|
||||
ix = 0
|
||||
while ix < len(rh):
|
||||
t = rh[ix]
|
||||
print(t)
|
||||
# 如果 t是ask, continue
|
||||
pass
|
||||
|
||||
data = json.dumps(summary)
|
||||
return data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue