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

Environment specific tool specs when using Dify via its API SDK #11816

Open
4 of 5 tasks
why-el opened this issue Dec 18, 2024 · 5 comments
Open
4 of 5 tasks

Environment specific tool specs when using Dify via its API SDK #11816

why-el opened this issue Dec 18, 2024 · 5 comments
Assignees
Labels
💪 enhancement New feature or request 🔨 feat:tools Tools for agent, function call related stuff.
Milestone

Comments

@why-el
Copy link

why-el commented Dec 18, 2024

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

I am not sure if this is provided already. We want to use Dify and trigger various workflows via its API, for instance, a chat embedded in our nodejs application. The workflow uses custom tools which hit our internal APIs, but the custom tools are not "environment-aware", so that developers can use them locally to hit their own localhost servers (for instance, via reverse proxies), while our production hits the production servers.

It seems like the baked assumption for tools is that they are always supposed to hit production endpoints, which affects cycles of development greatly.

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
@dosubot dosubot bot added 💪 enhancement New feature or request 🔨 feat:tools Tools for agent, function call related stuff. labels Dec 18, 2024
@crazywoola
Copy link
Member

Do you want to have several instances eg staging, production and dev and they can access different environment separately?
I think you can do this in several ways.
Like postman and other tools we provide https://docs.dify.ai/guides/workflow/variables you can define a variable in inputs and use if/else to distinguish the environments, or you can simply deploy multiple instances among the teams.

@why-el
Copy link
Author

why-el commented Dec 19, 2024

Not exactly. This is about custom tools, for instance ones that hit our own internal APIs. Consider the following:

  • You wanna incorporate a custom tool that requests say user orders from your application.
  • You add its OpenAPI spec, and save the custom tool.

Now you can use it, but the custom tool, during development, needs to hit localhost, but in production, it needs to hit our deployed application. How do you do this in a developer ergonomic way? I don't think Dify supports it.

Furthermore, fiddling with OpenAPI specification is itself not super ergonomic. I wonder if we can create custom tools via the API?

@crazywoola crazywoola added this to the 1.0 milestone Dec 23, 2024
@crazywoola
Copy link
Member

Do you have any suggestions? I think there might be a way that you could add 3 tools, and each of them would account for the environment. Eg, dev-tool-spec, stg-tool-spec, prod-tool-spec.

@why-el
Copy link
Author

why-el commented Dec 23, 2024

You can do that yeah, but then how do you keep them in sync? do you update all? and do so manually?

I think it would be ideal if Dify allows dynamic tool creation via an exposed API, similar to this for instance: https://humanloop.com/docs/v5/api-reference/tools/upsert.

@crazywoola crazywoola self-assigned this Dec 25, 2024
@crazywoola
Copy link
Member

crazywoola commented Dec 25, 2024

I think you need a way that can get updated tools right?

https://humanloop.com/docs/v5/api-reference/tools/upsert

It can insert some specs I think, but it doesn't contain the implemtation.

We have a beta test plugin framework here. https://github.com/langgenius/dify-plugin-daemon However I can not talk much about it.

For example, it do have some kind of version controls

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💪 enhancement New feature or request 🔨 feat:tools Tools for agent, function call related stuff.
Projects
None yet
Development

No branches or pull requests

2 participants