add logging
This commit is contained in:
@@ -8,7 +8,7 @@ class Config(BaseSettings):
|
||||
|
||||
OPENAI_API_KEY: str
|
||||
OPENAI_MODEL: str = "gpt-4o-2024-11-20"
|
||||
MESSAGE_HISTORY_DEPTH: int = 10
|
||||
MESSAGE_HISTORY_DEPTH: int = 20
|
||||
|
||||
|
||||
config = Config()
|
||||
|
||||
@@ -15,10 +15,13 @@ from ..utils import get_message_log, add_message_log, generate_gpt_tools_schemas
|
||||
from typing import TYPE_CHECKING
|
||||
import ujson as json
|
||||
from ..config import config
|
||||
from logging import getLogger
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..main import AgentPlugin
|
||||
|
||||
logger = getLogger(__name__)
|
||||
|
||||
router = Router()
|
||||
|
||||
|
||||
@@ -69,6 +72,9 @@ async def handle_openai_cycle(
|
||||
else:
|
||||
gpt_tools_metadata = plugin._gpt_tools_metadata
|
||||
|
||||
logger.debug(f"Messages: {messages}")
|
||||
logger.debug(f"GPT tools metadata: {gpt_tools_metadata}")
|
||||
|
||||
response = await client.chat.completions.create(
|
||||
model=config.OPENAI_MODEL,
|
||||
messages=messages,
|
||||
@@ -318,11 +324,9 @@ async def get_messages(
|
||||
)
|
||||
|
||||
messages = [
|
||||
{
|
||||
"role": "system",
|
||||
"content": system_prompt,
|
||||
}
|
||||
{"role": "system", "content": system_prompt},
|
||||
]
|
||||
|
||||
for message_log_item in message_log:
|
||||
messages.append(json.loads(message_log_item.content))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user