一个轻量AI Agent框架,基于DeepSeek API
Project description
Oak DeepSeek
一个轻量的 AI Agent 框架,基于 DeepSeek API 构建。通过队列通信和多线程设计,快速构建支持工具调用、子 Agent 协作的智能体。
安装
当前尚未发布,需自行从源码构建
快速开始
下面是一个完整示例,展示如何创建两个 Agent(主 Agent 和子 Agent)并让它们协作计算数学表达式。
from queue import Queue
from threading import Thread
import os
from oak_deepseek.engine import AgentEngine
def add(a: int, b: int) -> str:
"""
这个函数用于两个整数相加,并返回str结果给你
:return: 加法结果
"""
return f"{a + b}"
def mul(a: int, b: int) -> str:
"""
这个函数用于两个整数相乘,并返回str结果给你
:return: 乘法结果
"""
return f"{a * b}"
engine: AgentEngine = AgentEngine()
engine.create_agent(
key=("sys","sys"),
description="一个能进行数学计算的agent",
prompt="你是一个数学计算助手,会使用工具确保自己计算的正确性。",
tools=[add],
sub_agents=[("sys","sub")]
)
engine.create_agent(
key=("sys","sub"),
description="能进行乘法计算",
prompt="你是一个数学计算助手,会使用工具确保自己计算的正确性",
tools=[mul]
)
history_queue = Queue()
task_queue = Queue()
task_queue.put("计算(679+678)*(2+78)")
def go():
engine.run(task_queue, key=("sys", "sys"), history_queue=history_queue, api_key=os.getenv("DEEPSEEK_API_KEY"))
def messages():
while True:
msg = history_queue.get(block=True)
if msg is None:
return
print(msg)
if __name__ == "__main__":
agent_thread = Thread(target=go)
agent_thread.start()
print_thread = Thread(target=messages)
print_thread.start()
agent_thread.join()
history_queue.put(None)
print_thread.join()
许可证
MIT license
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
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
File details
Details for the file oak_deepseek-0.0.56.tar.gz.
File metadata
- Download URL: oak_deepseek-0.0.56.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03d99fddb2d44c1a78c55bf7a23450959af57d27312017bc331007c226fa6ddb
|
|
| MD5 |
efb91dbe8e7b119548f07d2c378c3b49
|
|
| BLAKE2b-256 |
69c7721c98d41b98001efcf607f18034a01ba4b0e9e5b521be2212611c2aa715
|
Provenance
The following attestation bundles were made for oak_deepseek-0.0.56.tar.gz:
Publisher:
publish-to-pypi.yml on WyxGenius/oak-deepseek
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oak_deepseek-0.0.56.tar.gz -
Subject digest:
03d99fddb2d44c1a78c55bf7a23450959af57d27312017bc331007c226fa6ddb - Sigstore transparency entry: 1192086050
- Sigstore integration time:
-
Permalink:
WyxGenius/oak-deepseek@cf526ff1dc8a751147dcd3885e34835c4d7d257a -
Branch / Tag:
refs/tags/v0.0.56 - Owner: https://github.com/WyxGenius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@cf526ff1dc8a751147dcd3885e34835c4d7d257a -
Trigger Event:
push
-
Statement type:
File details
Details for the file oak_deepseek-0.0.56-py3-none-any.whl.
File metadata
- Download URL: oak_deepseek-0.0.56-py3-none-any.whl
- Upload date:
- Size: 14.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aebc65834d146aa4bf00cbc80357abaea10a04d0306bbef8172d3d447d169c36
|
|
| MD5 |
f12bfd732e7b6c3c47267c6911ba50a6
|
|
| BLAKE2b-256 |
e3544a0cdb87017d1d415388ba66af56579ce828492603cd20db95426008659e
|
Provenance
The following attestation bundles were made for oak_deepseek-0.0.56-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on WyxGenius/oak-deepseek
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
oak_deepseek-0.0.56-py3-none-any.whl -
Subject digest:
aebc65834d146aa4bf00cbc80357abaea10a04d0306bbef8172d3d447d169c36 - Sigstore transparency entry: 1192086051
- Sigstore integration time:
-
Permalink:
WyxGenius/oak-deepseek@cf526ff1dc8a751147dcd3885e34835c4d7d257a -
Branch / Tag:
refs/tags/v0.0.56 - Owner: https://github.com/WyxGenius
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@cf526ff1dc8a751147dcd3885e34835c4d7d257a -
Trigger Event:
push
-
Statement type: