xbrain专注于构建一款可解释的AI开发框架
Project description
✨特点
- 开箱即用:在命令行一键安装,打开命令行即可使用;
- 屏蔽了提示词,让用户专注于业务开发:用户无需编写提示词,就能开发大模型应用;
- 用自然语言开发function call:通过自然语言将本地的python代码接入到openai的function call;
- 渐进式开发:对用户代码无侵入性。
文档
几个有意思的例子
将任何加减操作映射成两数相加
通过xb定义一个加法函数:
I guess you want to do the following, or chat with me:
1. chat with my action
2. create a new action
3. deploy a chat server
4. integrate existing functions into xbrain
>>> 2
Please tell me, the action you want to do?
>>> 两数相加
Please wait a moment, I'm generating the code for you...
Creation successful!
file generated: C:\Users\yuruo\Desktop\test2\add_action.py
add_action.py文件的内容:
from xbrain import xbrain_tool
from pydantic import BaseModel, Field
class Add(BaseModel):
"""Add two numbers"""
a: int = Field(..., description="First number")
b: int = Field(..., description="Second number")
@xbrain_tool.Tool(model=Add)
def add(a: int, b: int) -> int:
"""
Add two numbers.
"""
return a + b
通过xbrain的chat mode可以实现两数相加:
I guess you want to do the following, or chat with me:
1. chat with my action
2. create a new action
3. deploy a chat server
4. integrate existing functions into xbrain
>>> 1
Welcome to chat mode!
💬 1+1
run action:
action name: Add
action path: C:\Users\yuruo\Desktop\test2\add_action.py
action arguments: {'a': 1, 'b': 1}
action result: 2
2
然而它也能实现两数相减:
💬 1-1
run action:
action name: Add
action path: C:\Users\yuruo\Desktop\test2\add_action.py
action arguments: {'a': 1, 'b': -1}
action result: 0
0
它还能实现三数相加减,虽然结果不对但我们看到了它的尝试,这也是我们优化的方向:
💬 1+1+3
run action:
action name: Add
action path: C:\Users\yuruo\Desktop\test2\add_action.py
action arguments: {'a': 1, 'b': 1}
action result: 2
run action:
action name: Add
action path: C:\Users\yuruo\Desktop\test2\add_action.py
action arguments: {'a': 1, 'b': 3}
action result: 4
2
4
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyxbrain-1.1.10.tar.gz
(13.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pyxbrain-1.1.10-py3-none-any.whl
(19.9 kB
view details)
File details
Details for the file pyxbrain-1.1.10.tar.gz.
File metadata
- Download URL: pyxbrain-1.1.10.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c70b6e464382136b2b77006dc0fbcc74869800b22fafa14f1a850f3125b8ddad
|
|
| MD5 |
f8a5700417dcba246df2b61c4a9f6d4f
|
|
| BLAKE2b-256 |
c45ba4e29f0515f32fad4c5cdba6a64ae84a8a2d4ef8c78af2b5e79d7dfb7f89
|
File details
Details for the file pyxbrain-1.1.10-py3-none-any.whl.
File metadata
- Download URL: pyxbrain-1.1.10-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f1823c5c310cacb38f7655f2f48379f85f26a8f38e6bed67846b204f73f3722
|
|
| MD5 |
3054c8f3459ad939fe5f04ffa081e278
|
|
| BLAKE2b-256 |
d2f61ff6eeff494d027a44e03ee55038aefcd330709cf4a176f967c0d59447e6
|