Skip to content

Commit

Permalink
plugin(tool) add a config.json template and fix something
Browse files Browse the repository at this point in the history
  • Loading branch information
goldfishh committed Apr 2, 2023
1 parent 71d288f commit 7835379
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
17 changes: 10 additions & 7 deletions plugins/tool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## 使用说明
使用该插件后将默认使用4个工具, 无需额外配置长期生效:
### 1. python_repl
### 1. python
###### python解释器,使用它来解释执行python指令,可以配合你想要chatgpt生成的代码输出结果或执行事务

### 2. requests
Expand All @@ -22,7 +22,7 @@
## 使用本插件对话(prompt)技巧
### 1. 有指引的询问
#### 例如:
- 总结这个链接的内容 https://www.36kr.com/p/2186160784654466
- 总结这个链接的内容 https://github.com/goldfishh/chatgpt-tool-hub
- 使用Terminal执行curl cip.cc
- 使用python查询今天日期

Expand All @@ -33,7 +33,8 @@
## 其他工具
###### 除上述以外还有其他工具,比如搜索联网、数学运算、新闻需要获取api-key,
###### 由于这些工具使用方法暂时还在整理中,如果你不熟悉请不要尝试使用这些工具

#### [申请方法](https://github.com/goldfishh/chatgpt-tool-hub/blob/master/docs/apply_optional_tool.md)

### 5. wikipedia
###### 可以回答你想要知道确切的人事物

Expand All @@ -43,13 +44,15 @@
{
"tools": ["wikipedia"],
"kwargs": {
"top_k_results": 2
"top_k_results": 2,
"no_default": false,
"model_name": "gpt-3.5-turbo"
}
}
```
注:config.json文件非必须,未创建仍能使用本tool
- `tools`:本插件初始化时加载的工具, 目前可选集:["wikipedia", "wolfram-alpha", "google-search", "news-api"]
- `kwargs`:工具执行时的配置,一般在这里存放api-key,或搜索引擎等输出的条数
注:config.json文件非必须,未创建仍可使用本tool
- `tools`:本插件初始化时加载的工具, 目前可选集:["wikipedia", "wolfram-alpha", "bing-search", "google-search", "news"],其中后4个工具需要申请服务api
- `kwargs`:工具执行时的配置,一般在这里存放api-key,或环境配置,no_default用于配置是否默认使用4个工具,如果为false则仅使用tools列表工具


## 备注
Expand Down
8 changes: 8 additions & 0 deletions plugins/tool/config.json.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"tools": ["python", "requests", "terminal", "meteo-weather"],
"kwargs": {
"top_k_results": 2,
"no_default": false,
"model_name": "gpt-3.5-turbo"
}
}
2 changes: 1 addition & 1 deletion plugins/tool/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def on_handle_context(self, e_context: EventContext):
_reply = self.app.ask(query, user_session)
e_context.action = EventAction.BREAK_PASS
all_sessions.session_reply(_reply, e_context['context']['session_id'])
except ValueError as e:
except Exception as e:
logger.exception(e)
logger.error(str(e))

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ wechaty_puppet>=0.4.23
chardet>=5.1.0
SpeechRecognition
tiktoken>=0.3.2
chatgpt_tool_hub>=0.3.0
chatgpt_tool_hub>=0.3.4

0 comments on commit 7835379

Please sign in to comment.