You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
output=agentx.invoke({"input": "What was the average price of the stock each month?"})
I can get the intermediate_step I want:
tool, result=steps[0]
result
date
close
2023-10-31 00:00:00
338.11
2023-11-30 00:00:00
368.348
2023-12-31 00:00:00
372.578
2024-01-31 00:00:00
389.45
2024-02-29 00:00:00
408.994
2024-03-31 00:00:00
416.79
2024-04-30 00:00:00
413.264
2024-05-31 00:00:00
417.538
2024-06-30 00:00:00
438.342
2024-07-31 00:00:00
445.339
2024-08-31 00:00:00
412.531
2024-09-30 00:00:00
424.233
2024-10-31 00:00:00
419.785
But I'm also getting the summarizer output:
The average price of the stock for each month is as follows:
- **October 2023**: 338.11
- **November 2023**: 368.35
- **December 2023**: Data not available
- **January 2024**: Data not available
- **February 2024**: Data not available
- **March 2024**: Data not available
- **April 2024**: Data not available
- **May 2024**: Data not available
- **June 2024**: Data not available
- **July 2024**: Data not available
- **August 2024**: Data not available
- **September 2024**: Data not available
- **October 2024**: 419.78
(Note: The average prices for months beyond November 2023 are not available in the provided data.)
Which I don't want to be executed. I've looked up the documentation, but haven't found any way to disable the last summarization step.
This is the complete agent:
RunnableMultiActionAgent(runnable=RunnableAssign(mapper={
agent_scratchpad: RunnableLambda(lambda x: message_formatter(x['intermediate_steps']))
})
| ChatPromptTemplate(input_variables=['agent_scratchpad', 'input'], input_types={'agent_scratchpad': list[typing.Annotated[typing.Union[typing.Annotated[langchain_core.messages.ai.AIMessage, Tag(tag='ai')], typing.Annotated[langchain_core.messages.human.HumanMessage, Tag(tag='human')], typing.Annotated[langchain_core.messages.chat.ChatMessage, Tag(tag='chat')], typing.Annotated[langchain_core.messages.system.SystemMessage, Tag(tag='system')], typing.Annotated[langchain_core.messages.function.FunctionMessage, Tag(tag='function')], typing.Annotated[langchain_core.messages.tool.ToolMessage, Tag(tag='tool')], typing.Annotated[langchain_core.messages.ai.AIMessageChunk, Tag(tag='AIMessageChunk')], typing.Annotated[langchain_core.messages.human.HumanMessageChunk, Tag(tag='HumanMessageChunk')], typing.Annotated[langchain_core.messages.chat.ChatMessageChunk, Tag(tag='ChatMessageChunk')], typing.Annotated[langchain_core.messages.system.SystemMessageChunk, Tag(tag='SystemMessageChunk')], typing.Annotated[langchain_core.messages.function.FunctionMessageChunk, Tag(tag='FunctionMessageChunk')], typing.Annotated[langchain_core.messages.tool.ToolMessageChunk, Tag(tag='ToolMessageChunk')]], FieldInfo(annotation=NoneType, required=True, discriminator=Discriminator(discriminator=<function _get_type at 0x1589a1080>, custom_error_type=None, custom_error_message=None, custom_error_context=None))]]}, partial_variables={}, messages=[SystemMessage(content='\nYou are working with a pandas dataframe in Python. The name of the dataframe is `df`.\nThis is the result of `print(df.head())`:\n| | date | open | high | low | close | Adj Close | volume | price_change | target |\n|---:|:--------------------|-------:|-------:|-------:|--------:|------------:|---------:|---------------:|---------:|\n| 1 | 2023-10-31 00:00:00 | 338.85 | 339 | 334.69 | 338.11 | 335.591 | 20265300 | 0.00237167 | 1 |\n| 2 | 2023-11-01 00:00:00 | 339.79 | 347.42 | 339.65 | 346.07 | 343.492 | 28158800 | 0.0235427 | 1 |\n| 3 | 2023-11-02 00:00:00 | 347.24 | 348.83 | 344.77 | 348.32 | 345.725 | 24348100 | 0.00650157 | 1 |\n| 4 | 2023-11-03 00:00:00 | 349.63 | 354.39 | 347.33 | 352.8 | 350.172 | 23624000 | 0.0128617 | 1 |\n| 5 | 2023-11-06 00:00:00 | 353.45 | 357.54 | 353.35 | 356.53 | 353.874 | 23828300 | 0.0105726 | 1 |', additional_kwargs={}, response_metadata={}), HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['input'], input_types={}, partial_variables={}, template='{input}'), additional_kwargs={}), MessagesPlaceholder(variable_name='agent_scratchpad')])
| RunnableBinding(bound=ChatOpenAI(client=<openai.resources.chat.completions.Completions object at 0x31cfa8a70>, async_client=<openai.resources.chat.completions.AsyncCompletions object at 0x31ce07b90>, root_client=<openai.OpenAI object at 0x31cd164b0>, root_async_client=<openai.AsyncOpenAI object at 0x31cfa8320>, model_name='gpt-4o-mini', temperature=0.0, model_kwargs={}, openai_api_key=SecretStr('**********')), kwargs={'tools': [{'type': 'function', 'function': {'name': 'python_repl_ast', 'description': 'A Python shell. Use this to execute python commands. Input should be a valid python command. When using this tool, sometimes output is abbreviated - make sure it does not look abbreviated before using it in your answer.', 'parameters': {'properties': {'query': {'description': 'code snippet to run', 'type': 'string'}}, 'required': ['query'], 'type': 'object'}}}]}, config={}, config_factories=[])
| ToolsAgentOutputParser(), input_keys_arg=['input'], return_keys_arg=['output'], stream_runnable=True)
The text was updated successfully, but these errors were encountered:
jsulopzs
changed the title
Avoid the last summarization step
Avoid the last summarization step from the agent
Oct 30, 2024
jsulopzs
changed the title
Avoid the last summarization step from the agent
Delete last summarization step from agent
Oct 30, 2024
I'm running the agent executor with the following configuration:
With this invocation:
I can get the intermediate_step I want:
But I'm also getting the summarizer output:
Which I don't want to be executed. I've looked up the documentation, but haven't found any way to disable the last summarization step.
This is the complete agent:
The text was updated successfully, but these errors were encountered: