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

Combine operands #1

Closed
haesleinhuepf opened this issue Aug 5, 2023 · 10 comments · Fixed by #8
Closed

Combine operands #1

haesleinhuepf opened this issue Aug 5, 2023 · 10 comments · Fixed by #8

Comments

@haesleinhuepf
Copy link
Owner

It would be cools if we had multi-input tools available. This would allow us to call operations such as "Apply the seeded watershed algorithm to the membrane image and use the nuclei segmentation as seeds."

Unfortunately, the StructuredTool is not compatible with the AgentType.CHAT_CONVERSATIONAL_REACT_DESCRIPTION.

Hints:

@kevinyamauchi
Copy link
Collaborator

kevinyamauchi commented Aug 8, 2023

Hey! I think I've figured out how to chain tools together with multiple inputs. See the gist below for a demo (ignore the rate limit errors - I haven't paid for the API yet 😆 ). In this demo, I load the image, multiply it by a scalar (i.e., two inputs), and view the result.

Basically, I think we can swap the agent type to AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION and we can use the StructuredTool class.

https://gist.github.com/kevinyamauchi/4eb286e9a1f342ad0e854b1dc9fdd445

edit: I haven't tested fully, but happy to do so and make a PR if you think this is a viable approach.

@kevinyamauchi
Copy link
Collaborator

kevinyamauchi commented Aug 8, 2023

The other piece is for chaining operations like you described above, I think we need to add more a structured data registry so that tools can easily load/save results (e.g., label images should be easily discernible from intensity images)

@haesleinhuepf
Copy link
Owner Author

Basically, I think we can swap the agent type to AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION and we can use the StructuredTool class.

I've tried that too! This turns Bob into a bot that has no memory :-(

@kevinyamauchi
Copy link
Collaborator

Ah dang. What are the use cases for having the memory? Recalling the last result?

@haesleinhuepf
Copy link
Owner Author

Check out this notebook. It's executed after changing to AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION It kinda still works, but some responses are suspiciously dumb:

image

And:

image

@haesleinhuepf
Copy link
Owner Author

This might be a potential solution, but it seems a deep rabbit hole: https://python.langchain.com/docs/use_cases/autonomous_agents/autogpt

@haesleinhuepf
Copy link
Owner Author

haesleinhuepf commented Aug 8, 2023

I've just tried what's described here and the AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION then works better with memory. code

It's still not convincing. It seems to give more wrong answers and I received some timeouts when running it. Will try again later.

image

@kevinyamauchi
Copy link
Collaborator

kevinyamauchi commented Aug 8, 2023

Hey! I have another attempt, now creating an LLMchain that adds the conversation history into the prompt. I did a super basic test and it seems like it could be working (loads two images and remembers which was first). What do you think?

https://gist.github.com/kevinyamauchi/491944468412d817038c2ebbb7d9cc91

@kevinyamauchi
Copy link
Collaborator

kevinyamauchi commented Aug 8, 2023

I added back in the multi-input compatibility, so I think this shows both using conversation history and multi-input tools. This seems like it could be a good approach. We made consider adding some additional agents to the chain to manage caching/IO of intermediate results.

I will make a PR to see how converting the current tools over to this agent would look.

https://gist.github.com/kevinyamauchi/9e4049b799bb705c575c8ae3070c7dae

@haesleinhuepf
Copy link
Owner Author

Oh that notebook looks super amazing @kevinyamauchi ! I can't wait for this PR ❤️

haesleinhuepf pushed a commit that referenced this issue Oct 7, 2023
make code hidden with option to show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants