-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/workflow-backend' into deploy/dev
# Conflicts: # api/commands.py
- Loading branch information
Showing
55 changed files
with
2,770 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,26 @@ | ||
# Dify Open Source License | ||
# Open Source License | ||
|
||
The Dify project is licensed under the Apache License 2.0, with the following additional conditions: | ||
Dify is licensed under the Apache License 2.0, with the following additional conditions: | ||
|
||
1. Dify is permitted to be used for commercialization, such as using Dify as a "backend-as-a-service" for your other applications, or delivering it to enterprises as an application development platform. However, when the following conditions are met, you must contact the producer to obtain a commercial license: | ||
1. Dify may be utilized commercially, including as a backend service for other applications or as an application development platform for enterprises. Should the conditions below be met, a commercial license must be obtained from the producer: | ||
|
||
a. Multi-tenant SaaS service: Unless explicitly authorized by Dify in writing, you may not use the Dify.AI source code to operate a multi-tenant SaaS service that is similar to the Dify.AI service edition. | ||
b. LOGO and copyright information: In the process of using Dify, you may not remove or modify the LOGO or copyright information in the Dify console. | ||
a. Multi-tenant SaaS service: Unless explicitly authorized by Dify in writing, you may not use the Dify source code to operate a multi-tenant environment. | ||
- Tenant Definition: Within the context of Dify, one tenant corresponds to one workspace. The workspace provides a separated area for each tenant's data and configurations. | ||
|
||
b. LOGO and copyright information: In the process of using Dify's frontend components, you may not remove or modify the LOGO or copyright information in the Dify console or applications. This restriction is inapplicable to uses of Dify that do not involve its frontend components. | ||
|
||
Please contact [email protected] by email to inquire about licensing matters. | ||
|
||
2. As a contributor, you should agree that your contributed code: | ||
2. As a contributor, you should agree that: | ||
|
||
a. The producer can adjust the open-source agreement to be more strict or relaxed. | ||
b. Can be used for commercial purposes, such as Dify's cloud business. | ||
a. The producer can adjust the open-source agreement to be more strict or relaxed as deemed necessary. | ||
b. Your contributed code may be used for commercial purposes, including but not limited to its cloud business operations. | ||
|
||
Apart from this, all other rights and restrictions follow the Apache License 2.0. If you need more detailed information, you can refer to the full version of Apache License 2.0. | ||
Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at http://www.apache.org/licenses/LICENSE-2.0. | ||
|
||
The interactive design of this product is protected by appearance patent. | ||
|
||
© 2023 LangGenius, Inc. | ||
© 2024 LangGenius, Inc. | ||
|
||
|
||
---------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,20 @@ | ||
- bing | ||
- duckduckgo | ||
- yahoo | ||
- wikipedia | ||
- arxiv | ||
- pubmed | ||
- dalle | ||
- azuredalle | ||
- stablediffusion | ||
- webscraper | ||
- youtube | ||
- wolframalpha | ||
- maths | ||
- github | ||
- chart | ||
- time | ||
- yahoo | ||
- stablediffusion | ||
- vectorizer | ||
- youtube | ||
- gaode | ||
- maths | ||
- wecom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from core.tools.errors import ToolProviderCredentialValidationError | ||
from core.tools.provider.builtin.pubmed.tools.pubmed_search import PubMedSearchTool | ||
from core.tools.provider.builtin_tool_provider import BuiltinToolProviderController | ||
|
||
|
||
class PubMedProvider(BuiltinToolProviderController): | ||
def _validate_credentials(self, credentials: dict) -> None: | ||
try: | ||
PubMedSearchTool().fork_tool_runtime( | ||
meta={ | ||
"credentials": credentials, | ||
} | ||
).invoke( | ||
user_id='', | ||
tool_parameters={ | ||
"query": "John Doe", | ||
}, | ||
) | ||
except Exception as e: | ||
raise ToolProviderCredentialValidationError(str(e)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
identity: | ||
author: Pink Banana | ||
name: pubmed | ||
label: | ||
en_US: PubMed | ||
zh_Hans: PubMed | ||
description: | ||
en_US: A search engine for biomedical literature. | ||
zh_Hans: 一款生物医学文献搜索引擎。 | ||
icon: icon.svg |
40 changes: 40 additions & 0 deletions
40
api/core/tools/provider/builtin/pubmed/tools/pubmed_search.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from typing import Any | ||
|
||
from langchain.tools import PubmedQueryRun | ||
from pydantic import BaseModel, Field | ||
|
||
from core.tools.entities.tool_entities import ToolInvokeMessage | ||
from core.tools.tool.builtin_tool import BuiltinTool | ||
|
||
|
||
class PubMedInput(BaseModel): | ||
query: str = Field(..., description="Search query.") | ||
|
||
|
||
class PubMedSearchTool(BuiltinTool): | ||
""" | ||
Tool for performing a search using PubMed search engine. | ||
""" | ||
|
||
def _invoke(self, user_id: str, tool_parameters: dict[str, Any]) -> ToolInvokeMessage | list[ToolInvokeMessage]: | ||
""" | ||
Invoke the PubMed search tool. | ||
Args: | ||
user_id (str): The ID of the user invoking the tool. | ||
tool_parameters (dict[str, Any]): The parameters for the tool invocation. | ||
Returns: | ||
ToolInvokeMessage | list[ToolInvokeMessage]: The result of the tool invocation. | ||
""" | ||
query = tool_parameters.get('query', '') | ||
|
||
if not query: | ||
return self.create_text_message('Please input query') | ||
|
||
tool = PubmedQueryRun(args_schema=PubMedInput) | ||
|
||
result = tool.run(query) | ||
|
||
return self.create_text_message(self.summary(user_id=user_id, content=result)) | ||
|
23 changes: 23 additions & 0 deletions
23
api/core/tools/provider/builtin/pubmed/tools/pubmed_search.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
identity: | ||
name: pubmed_search | ||
author: Pink Banana | ||
label: | ||
en_US: PubMed Search | ||
zh_Hans: PubMed 搜索 | ||
description: | ||
human: | ||
en_US: PubMed® comprises more than 35 million citations for biomedical literature from MEDLINE, life science journals, and online books. Citations may include links to full text content from PubMed Central and publisher web sites. | ||
zh_Hans: PubMed® 包含来自 MEDLINE、生命科学期刊和在线书籍的超过 3500 万篇生物医学文献引用。引用可能包括来自 PubMed Central 和出版商网站的全文内容链接。 | ||
llm: Perform searches on PubMed and get results. | ||
parameters: | ||
- name: query | ||
type: string | ||
required: true | ||
label: | ||
en_US: Query string | ||
zh_Hans: 查询语句 | ||
human_description: | ||
en_US: The search query. | ||
zh_Hans: 搜索查询语句。 | ||
llm_description: Key words for searching | ||
form: llm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.