Skip to content

Using Field Descriptions for Enhanced Data Narratives with LLMs - By Using Python REPL Tool #26665

Answered by dosubot bot
mraguth asked this question in Q&A
Discussion options

You must be logged in to vote

To modify your script to accommodate both DataFrames and tune it for use with the PythonAstREPLTool in LangChain, you need to update your imports to use the langchain_experimental package as the PythonAstREPLTool has been moved there. Here is an example of how you can modify your script:

  1. Update the Template: Modify the template to include both DataFrames.
  2. Initialize the REPL Tool: Include both DataFrames in the locals dictionary.
  3. Adjust the Prompt and Agent: Ensure the prompt and agent are set up to handle multiple DataFrames.

Here is the updated script:

import pandas as pd
from langchain.agents import create_tool_calling_agent, AgentExecutor, OpenAIFunctionsAgent
from langchain_core.p…

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@mraguth
Comment options

@dosubot
Comment options

Answer selected by mraguth
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dosubot
Comment options

Comment options

You must be logged in to vote
1 reply
@dosubot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant