mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
fix(agent/profile_generator): Improve robustness by leveraging create_chat_completion's parse handling
This commit is contained in:
@@ -238,18 +238,14 @@ async def generate_agent_profile_for_task(
|
||||
prompt = agent_profile_generator.build_prompt(task)
|
||||
|
||||
# Call LLM with the string as user input
|
||||
output = (
|
||||
await llm_provider.create_chat_completion(
|
||||
prompt.messages,
|
||||
model_name=app_config.smart_llm,
|
||||
functions=prompt.functions,
|
||||
)
|
||||
).response
|
||||
output = await llm_provider.create_chat_completion(
|
||||
prompt.messages,
|
||||
model_name=app_config.smart_llm,
|
||||
functions=prompt.functions,
|
||||
completion_parser=agent_profile_generator.parse_response_content,
|
||||
)
|
||||
|
||||
# Debug LLM Output
|
||||
logger.debug(f"AI Config Generator Raw Output: {output}")
|
||||
logger.debug(f"AI Config Generator Raw Output: {output.response}")
|
||||
|
||||
# Parse the output
|
||||
ai_profile, ai_directives = agent_profile_generator.parse_response_content(output)
|
||||
|
||||
return ai_profile, ai_directives
|
||||
return output.parsed_result
|
||||
|
||||
Reference in New Issue
Block a user