feat: + summary

This commit is contained in:
莘权 马 2023-09-07 14:23:36 +08:00
parent 451b351055
commit 098027d249
2 changed files with 1 additions and 14 deletions

View file

@ -48,12 +48,6 @@ BRAIN_MEMORY = "BRAIN_MEMORY"
SKILL_PATH = "SKILL_PATH"
SERPER_API_KEY = "SERPER_API_KEY"
# Key Definitions for MetaGPT LLM
METAGPT_API_MODEL = "METAGPT_API_MODEL"
METAGPT_API_KEY = "METAGPT_API_KEY"
METAGPT_API_BASE = "METAGPT_API_BASE"
METAGPT_API_TYPE = "METAGPT_API_TYPE"
METAGPT_API_VERSION = "METAGPT_API_VERSION"
# format
BASE64_FORMAT = "base64"

View file

@ -7,24 +7,17 @@
"""
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
class MetaGPTLLMAPI(OpenAIGPTAPI):
"""MetaGPT LLM api"""
def __init__(self):
self.llm = openai
self.model = CONFIG.METAGPT_API_MODEL
self.auto_max_tokens = False
self.rpm = int(CONFIG.RPM) if CONFIG.RPM else 10
RateLimiter.__init__(self, rpm=self.rpm)
super().__init__()
async def get_summary(self, memory: BrainMemory, max_words=200, keep_language: bool = False, **kwargs):
summary = []