Skip to main content

AutoGemini - 流式Gemini API处理系统

Project description

AutoGemini

流式 Gemini API 处理系统 —— 自动化 AI 工具调用与响应

项目简介

AutoGemini 是一个基于 Python 的流式 Gemini API 处理系统,支持自动化工具代码(ToolCode)检测、执行与多轮推理,适用于需要复杂链式思考(Chain of Thought, COT)和工具调用的 AI 应用场景。

  • 流式输出:支持 AI 响应的流式处理,实时检测并执行 ToolCode。
  • 自动循环推理:内置 COT 推理流程,自动多轮调用工具并合成最终答案。
  • 可扩展工具接口:通过 DefaultApi 可自定义扩展工具函数。
  • 语义 HTML 响应:最终输出为结构化 HTML,便于前端解析与展示。

主要功能

  • Gemini API 流式对话与工具调用
  • ToolCode 检测与安全执行
  • 多轮推理与自动循环
  • 结构化 HTML 响应生成
  • 易于集成与二次开发

安装方法

建议使用 uv 进行依赖管理:

uv pip install -e .

或使用 pip:

pip install -e .

快速开始

作为命令行工具运行

python -m autogemini

作为库集成

from autogemini import AutoStreamProcessor

processor = AutoStreamProcessor(api_key="YOUR_GEMINI_API_KEY")
# 详细用法见 src/autogemini/auto_stream_processor.py

目录结构

  • src/autogemini/ —— 主代码目录
  • tests/ —— 测试用例
  • pyproject.toml —— 项目配置

依赖

  • Python >= 3.10
  • aiohttp, httpx, requests, websockets

测试

推荐使用 uv 运行测试:

uv run python tests/run_interactive_test.py

或直接运行 pytest:

pytest

贡献

欢迎提交 issue 和 PR!如需自定义工具函数,请参考 src/autogemini/tool_code.py

License

本项目采用 MIT License,详见根目录 LICENSE 文件。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autogemini-0.1.3.post3.tar.gz (62.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autogemini-0.1.3.post3-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file autogemini-0.1.3.post3.tar.gz.

File metadata

  • Download URL: autogemini-0.1.3.post3.tar.gz
  • Upload date:
  • Size: 62.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for autogemini-0.1.3.post3.tar.gz
Algorithm Hash digest
SHA256 34bf97a1f6ad5878dcbda6947f583b2960c6ae43de0c28f23fa48feee942bf39
MD5 bca6b2284f974c0549e3a231f8dd578e
BLAKE2b-256 4a7fe43d3ea82d7a8217ca60abbdf389bbd7a61dc36ab184c8f0a51be63545ef

See more details on using hashes here.

File details

Details for the file autogemini-0.1.3.post3-py3-none-any.whl.

File metadata

File hashes

Hashes for autogemini-0.1.3.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 e8c5ad75a93efd4a49f40f1d7c49a829ffb1083b2ebc4cdee59a46b536e41ade
MD5 2b753961eec0faace2d84152a381c801
BLAKE2b-256 38deacb0d102553108727c8c4880f18654b469bb42e82da57c1f0f2a391c611e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page