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

Introducing Platform Tools #1547

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

fkesheh
Copy link
Contributor

@fkesheh fkesheh commented Mar 9, 2024

In this PR I'm introducing a WebScrapper Tool, and also an extensible tool platform to add many other tools (i.e. from langchain) into the Chatbot-UI

For adding or removing platform tools, consult the platformToolsList.ts document. You simply need to add or remove the tools in the list.

To introduce a new tool, utilize the PlatformTool interface and incorporate it into the aforementioned list. For a practical illustration, examine the webscrapperTool.ts example.

image

@fkesheh fkesheh marked this pull request as ready for review March 9, 2024 05:06
@secondtruth
Copy link

secondtruth commented Mar 9, 2024

Great work! Thank you for sharing.

I noticed "Webscraping" is written with 2 P, but it should be just 1.

@fkesheh
Copy link
Contributor Author

fkesheh commented Mar 9, 2024

Right. I will fix that. There is also a bug around tools when a non open ai model is selected

@fkesheh
Copy link
Contributor Author

fkesheh commented Mar 9, 2024

Also relative links need to be fixed

@vood
Copy link

vood commented Mar 18, 2024

So, I tested this code, and found that the platform tools mess up with server side functions since the code is shared. I.e. with current architecture it is impossible to invoke any server-side only code within the tools, which is a must for scalable system.

i.e. i want to be able to call getServerProfile and have access to env variables which is not possible right now since getServerProfile throws × You're importing a component that needs next/headers. That only works in a Server Component which is not supported in the pages/ directory.

@fkesheh
Copy link
Contributor Author

fkesheh commented Mar 19, 2024

You can't acesss server side environment variables from the frontend. That is a security matter. This code has nothing to do with that.

@vood
Copy link

vood commented Mar 19, 2024

@fkesheh, let me rephrase the question, let's assume I need to build a DALL-E tool, which needs access to an environment variable to read credentials, how would I use your platform API to achieve this?

All tools before your change were executed on the server side in /api/tools and now with your change, users cannot add server side code to the platform tools. Seems like this breaks existing behavior?

@fkesheh
Copy link
Contributor Author

fkesheh commented Mar 19, 2024

The tools are still running of the server side. That wasn't changed. The error you postes is related of using getServerProfile in the pages directory. On pages you must use getProfileByUserId as in profiles.ts

@vood
Copy link

vood commented Mar 19, 2024

Try adding getServerProfile in your webScraper tool and see what happens. You can't execute any server side code inside the platform tool since you use platformToolDefinitions in the pages and platformToolDefinitions import all tools, and the tools may contain server side code, which breaks at compile time.

@fkesheh
Copy link
Contributor Author

fkesheh commented Mar 28, 2024

Got your point. Perhaps you might inject any server-side arguments into the parsedArgs to avoid that, but it feels like a work around. I don't have time now to investigate a better solution

@yesbhautik
Copy link
Contributor

can you send that tools values here, so we can create tool from dashboard

@vood
Copy link

vood commented Apr 17, 2024

you cannot create it from the dashboard. You need custom code.

@yesbhautik
Copy link
Contributor

you cannot create it from the dashboard. You need custom code.

Because of inactive community of Chatbot UI, we already have created separate repo with UI improvements & implementation of new features. It is no more possible to add beta code snippet's in our repo.

Can try to build tool that I can import from dashboard, or I can just add the context to Supabase, so All user will get that tool by default.

@vood
Copy link

vood commented Apr 17, 2024

Same, please follow our development here https://github.com/writingmate/chatlabs

@vood
Copy link

vood commented Apr 17, 2024

Again, it is not possible to create a tool that can be "imported from the dashboard". All platform tools require additional coding.

@yesbhautik
Copy link
Contributor

Same, please follow our development here https://github.com/writingmate/chatlabs

Hey, please check my DM on LinkedIn

@yesbhautik
Copy link
Contributor

Same, please follow our development here https://github.com/writingmate/chatlabs

hey, why i am not able to find below stuff in git repo
image

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 this pull request may close these issues.

None yet

4 participants