Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question!! Multiple agent use? agent within agent? #7597

Closed
sk9288go opened this issue Jul 12, 2023 · 6 comments
Closed

Question!! Multiple agent use? agent within agent? #7597

sk9288go opened this issue Jul 12, 2023 · 6 comments
Labels
🤖:improvement Medium size change to existing code to handle new use-cases 🤖:question A specific question about the codebase, product, project, or how to use a feature

Comments

@sk9288go
Copy link

Feature request

Hello Langchain community!

I'm currently in the process of developing a company's chatbot, and I've chosen to use both a CSV file and Pinecone DB for the project.

Here's a basic outline of the structure I've adopted so far:
캡처

I've managed to set the two tools, and its example usage has been providing accurate answers
캡처1
the first tool gets me the answers based on pandas’s result from the example usage, the answers are based on csv and it’s correct in all cases
캡처2

Also set the second tool and its example usage is answered correctly.
캡처3

until here things are very promising and i expected everything to work as it is.
so i have set the LLM and combined the two tools and used agent
캡처4

However, when I combined both tools using an agent, the answers started to deviate from the expected output. I'm not entirely sure whether the method I'm using to utilize the agent is optimal.
캡처5

To address this issue, I've experimented with the MultiretrievalQA chain using vector embedding. But the results are not consistently reliable, and moreover, I'd rather not generate new embeddings every time I modify the CSV.

Is there anyone in the community who can shed light on these issues I'm encountering? Any feedback on my current approach, suggestions on how to optimize it, or alternative strategies would be greatly appreciated!

Thank you.

Motivation

I'm making a company's gpt and i hope to link my csv with the chatbot so that whenever i change the csv the chatbot is automatically linked with it

Your contribution

um solving the problem would help others?

@dosubot dosubot bot added 🤖:improvement Medium size change to existing code to handle new use-cases 🤖:question A specific question about the codebase, product, project, or how to use a feature labels Jul 12, 2023
@dosubot
Copy link

dosubot bot commented Jul 12, 2023

Answer generated by a 🤖

Answer

I found related issues that might be helpful. I did my best to summarize the solutions, but I recommend looking at the related issues yourself.

Open Issues

Is there any way to combine chatbot and question answering over docs?

The suggested solution is:

  1. Have a chatbot form a chat history memory for whatever topic the user is interested in.
  2. When the time comes for utilizing the vector db to answer a precise question, extract the chat history memory and feed it into the qa retrieval in the form of a question + chat history context.

This solution is based on the comment with the most positive reactions. Another solution provided in the comments is to use the chat_vector_db approach as mentioned in the LangChain documentation.

Agent answer questions that is not related to my custom data

This issue was referenced by:


This response is meant to be useful, save you time, and share context. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

@wolfassi123
Copy link

Feature request

Hello Langchain community!

I'm currently in the process of developing a company's chatbot, and I've chosen to use both a CSV file and Pinecone DB for the project.

Here's a basic outline of the structure I've adopted so far: 캡처

I've managed to set the two tools, and its example usage has been providing accurate answers 캡처1 the first tool gets me the answers based on pandas’s result from the example usage, the answers are based on csv and it’s correct in all cases 캡처2

Also set the second tool and its example usage is answered correctly. 캡처3

until here things are very promising and i expected everything to work as it is. so i have set the LLM and combined the two tools and used agent 캡처4

However, when I combined both tools using an agent, the answers started to deviate from the expected output. I'm not entirely sure whether the method I'm using to utilize the agent is optimal. 캡처5

To address this issue, I've experimented with the MultiretrievalQA chain using vector embedding. But the results are not consistently reliable, and moreover, I'd rather not generate new embeddings every time I modify the CSV.

Is there anyone in the community who can shed light on these issues I'm encountering? Any feedback on my current approach, suggestions on how to optimize it, or alternative strategies would be greatly appreciated!

Thank you.

Motivation

I'm making a company's gpt and i hope to link my csv with the chatbot so that whenever i change the csv the chatbot is automatically linked with it

Your contribution

um solving the problem would help others?

I have been facing the exact same issue. Each tool by itself performs wonderful, just once added into an agent, it goes south. Are you still facing the issue?

@1vash
Copy link

1vash commented Sep 10, 2023

Hello @sk9288go, It seems like you have encountered a situation that appears quite similar to my own experience. I would like to bring your attention to my problem detailed in this DOC: How to properly initialize Function Agent as a Tool for other Agent #10375

In this issue, I discuss the usage of an Agent as a Tool for another Agent, and I suspect that attempting to implement this through the BaseTool Inheritance Interface might not be the correct approach, as it seems that the message isn't being effectively transmitted to the other agent. Regrettably, I haven't been able to find a satisfactory solution yet.

P.S query is a parsed argument from a message and not an input message by itself

Copy link

dosubot bot commented Dec 10, 2023

Hi, @sk9288go

I'm helping the LangChain team manage our backlog and am marking this issue as stale. The issue involves combining a CSV file and Pinecone DB to develop a chatbot, with the expected output deviating when using an agent. There have been related comments from dosubot, wolfassi123, and 1vash seeking community feedback and sharing experiences.

Could you please confirm if this issue is still relevant to the latest version of the LangChain repository? If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days. Thank you!

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Dec 10, 2023
@sk9288go
Copy link
Author

Close issue!

@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Dec 12, 2023
@joshuasundance-swca
Copy link
Contributor

joshuasundance-swca commented Dec 13, 2023

@sk9288go @1vash @wolfassi123

I'm not sure if this is the best way, but today, I got it working like this:

research_assistant_tool = Tool.from_function(
    func=lambda s: research_assistant_chain.invoke(
        {"question": s},
        config=get_config(callbacks),
    ),
    name="web-research-assistant",
    description="this assistant returns a comprehensive report based on web research. for quick facts, use duckduckgo instead.",
)

https://github.com/joshuasundance-swca/langchain-streamlit-demo/blob/main/langchain-streamlit-demo%2Fapp.py#L452-L459

The current implementation is still messy, but the main point is to use Tool.from_function with a lambda to match the expected input key and other requirements.

I hope this is helpful; feel free to ask for clarification or further assistance.

@dosubot dosubot bot added the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Mar 13, 2024
@dosubot dosubot bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 20, 2024
@dosubot dosubot bot removed the stale Issue has not had recent activity or appears to be solved. Stale issues will be automatically closed label Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:improvement Medium size change to existing code to handle new use-cases 🤖:question A specific question about the codebase, product, project, or how to use a feature
Projects
None yet
Development

No branches or pull requests

4 participants