Files
gpt-pilot/core/agents/mixins.py
Senko Rasic 5b474ccc1f merge gpt-pilot 0.2 codebase
This is a complete rewrite of the GPT Pilot core, from the ground
up, making the agentic architecture front and center, and also
fixing some long-standing problems with the database architecture
that weren't feasible to solve without breaking compatibility.

As the database structure and config file syntax have changed,
we have automatic imports for projects and current configs,
see the README.md file for details.

This also relicenses the project to FSL-1.1-MIT license.
2024-05-22 21:42:25 +02:00

38 lines
1.2 KiB
Python

from typing import Optional
from core.agents.convo import AgentConvo
class IterationPromptMixin:
"""
Provides a method to find a solution to a problem based on user feedback.
Used by ProblemSolver and Troubleshooter agents.
"""
async def find_solution(
self,
user_feedback: str,
*,
user_feedback_qa: Optional[list[str]] = None,
next_solution_to_try: Optional[str] = None,
) -> str:
"""
Generate a new solution for the problem the user reported.
:param user_feedback: User feedback about the problem.
:param user_feedback_qa: Additional q/a about the problem provided by the user (optional).
:param next_solution_to_try: Hint from ProblemSolver on which solution to try (optional).
:return: The generated solution to the problem.
"""
llm = self.get_llm()
convo = AgentConvo(self).template(
"iteration",
current_task=self.current_state.current_task,
user_feedback=user_feedback,
user_feedback_qa=user_feedback_qa,
next_solution_to_try=next_solution_to_try,
)
llm_solution: str = await llm(convo)
return llm_solution