Question for React Agent

Aperta
#296 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
ai

Direzione di ricerca

Traccia il flusso del prompt e dell’esecuzione da lagent_example.py a react.py, iniziando da select_action_template, output_format_template e dalle definizioni di ActionFormat e FinishFormat mostrate nell’issue. Segui dove entrano la query dell’utente, le informazioni sugli strumenti e l’output dell’ambiente in ogni iterazione. Il lavoro è completato quando viene documentato se l’output precedente viene incorporato e viene identificata la specifica catena di implementazione mancante o fraintesa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

I have taken a look at inside lagent_example.py and react.py.

it seems like the react prompt does not incorporate the previous output as new input.
Is it a systematic mistake, or am I missing some implementation chain?
So, where does the agent inject the question (user query) or environmental output?

So the prompt is like below

class ActionCall(BaseModel):
    name: str = Field(description='调用的函数名称') # The name of the function being called
    parameters: Dict = Field(description='调用函数的参数') # The parameters for the function call

class ActionFormat(BaseModel):
    thought_process: str = Field(
        description='描述当前所处的状态和已知信息。这有助于明确目前所掌握的信息和接下来的搜索方向。' 
        #description='Describe the current state and known information. This helps clarify what is known and the next search direction.'
    )
    action: ActionCall = Field(description='当前步骤需要执行的操作,包括函数名称和参数。') # description='The action to be performed at this step, including the function name and parameters.'


class FinishFormat(BaseModel):
    thought_process: str = Field(
        description='描述当前所处的状态和已知信息。这有助于明确目前所掌握的信息和接下来的搜索方向。'
        #'Describe the current state and known information. This helps clarify what is known and the next search direction.'
    )
    conclusion: str = Field(description='总结当前的搜索结果,回答问题。') # 'Summarize the current search results and provide an answer.'

prompt_template = PromptTemplate(select_action_template)
output_format = JSONParser(output_format_template, function_format=ActionFormat, finish_format=FinishFormat)

select_action_template = """你是一个可以调用外部工具的助手,可以使用的工具包括:
{action_info}
{output_format}
开始!"""

"""
Translation
select_action_template = '''You are an assistant capable of calling external tools. The available tools include:
{action_info}
{output_format}
Begin!
"""

output_format_template = """如果使用工具请遵循以下格式回复:
{function_format}

如果你已经知道了答案,或者你不需要工具,请遵循以下格式回复
{finish_format}"""

''' Translation
output_format_template = """If you need to use a tool, please follow this response format:
{function_format}

If you already know the answer or do not need a tool, please follow this response format:
{finish_format}"""

Lingua principale
Python
Stelle
2.3k
Fork
249
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di InternLM/lagent

Tutte le issue di InternLM/lagent

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.