Skip to main content

VirtualOffice Agent SDK — 透明拦截转发 + 平台 API 封装

Project description

vokit — VirtualOffice Agent SDK

一行 import vokit 完成拦截激活 + API 就绪。

安装

# 稳定版
pip install vokit

# 指定版本
pip install vokit==0.1.3

# 升级
pip install --upgrade vokit

快速开始

1. 拦截 LLM 请求

在 Agent 的入口文件最顶部 import 一次即可:

import vokit
  • 只需 import 一次:patch 注册在进程级别的 HTTP 库入口,全局生效。
  • 放在最顶部:确保在所有 LLM SDK 被 import 之前 patch 已注册好。
  • 幂等安全:多次 import 不会重复注册。

2. 使用平台 API

import vokit

# 提交产出物
vokit.submit_output(
    output_type="file",
    content="base64编码的内容",
    filename="report.pdf",
    mime_type="application/pdf"
)

# 上报指标数据
vokit.report_metrics(metrics=[
    {"metricType": "token_usage", "metricValue": 1500, "snapshotDate": "2026-04-14"},
])

# 上报费用记录
vokit.report_billing(
    cost=150,
    request_id="unique-request-id",
    call_date="2026-04-14",
    api_type="chat",
)

运行模式

开发模式

不设置 VO_GATEWAY_URLVO_ACCESS_TOKEN 时自动进入:

  • LLM 请求直连 Provider,不被拦截
  • 平台 API 返回 Mock 数据
export OPENAI_API_KEY="your-key"
python your_agent.py

生产模式

设置环境变量后自动进入:

export VO_GATEWAY_URL=http://localhost:8888
export VO_ACCESS_TOKEN=<your-jwt-token>
export OPENAI_API_KEY="your-key"
python your_agent.py

环境变量

变量 说明
VO_GATEWAY_URL 内网网关地址,缺失则进入开发模式
VO_ACCESS_TOKEN 网关 Bearer Token,缺失则进入开发模式
VO_DEV_MODE 设为 1 强制进入开发模式

Python 版本

要求 Python 3.10+

License

MIT

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

vokit-0.1.5.tar.gz (24.2 kB view details)

Uploaded Source

Built Distribution

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

vokit-0.1.5-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file vokit-0.1.5.tar.gz.

File metadata

  • Download URL: vokit-0.1.5.tar.gz
  • Upload date:
  • Size: 24.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.1

File hashes

Hashes for vokit-0.1.5.tar.gz
Algorithm Hash digest
SHA256 ae000b4879ee390433e005bf3634e58e72a85c305429f9b5d2ee716d71dbaf9a
MD5 d179654f66df4986f6dd89e09f3c2eec
BLAKE2b-256 9bab51765a75b5ac99b078b39d8a1173b4e338093245ec6c73927f3d62b05f28

See more details on using hashes here.

File details

Details for the file vokit-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: vokit-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.1

File hashes

Hashes for vokit-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a62df4ad3fd0a65a499dc03547a944c45006409cf86d6c60cf31d8611d1a2377
MD5 0ec474f98a0c55cd30522dd559eece6d
BLAKE2b-256 f5518b2f731b161fe06e30d31896aef270871a5f29cc0d1f6cb56711767db38f

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