Skip to content

Autogen for data analysis including numbers and text? #4726

Answered by ekzhu
analyticsinsights asked this question in Q&A
Discussion options

You must be logged in to vote

Unless you want to convert the returned dataframe in text message, I would use a separate variable to store the result or saving the dataframe on disk.

import asyncio
import pandas as pd
from langchain_experimental.tools.python.tool import PythonAstREPLTool
from autogen_ext.tools.langchain import LangChainToolAdapter
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.agents import AssistantAgent
from autogen_agentchat.ui import Console

async def main() -> None:
    df = pd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv")
    repl = PythonAstREPLTool(locals={"df": df})
    tool = LangChainToolAdapter(repl)
    m…

Replies: 2 comments 12 replies

Comment options

You must be logged in to vote
8 replies
@ekzhu
Comment options

@analyticsinsights
Comment options

@ekzhu
Comment options

@ekzhu
Comment options

@analyticsinsights
Comment options

Comment options

You must be logged in to vote
4 replies
@ekzhu
Comment options

@analyticsinsights
Comment options

@ekzhu
Comment options

Answer selected by analyticsinsights
@analyticsinsights
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
3 participants