coze loop sdk
Project description
CozeLoop Python SDK
English | 简体中文
Overview
The CozeLoop SDK is a Python client for interacting with CozeLoop platform. Key features:
- Report trace
- Get and format prompt
- Execute Prompt as a Service (PTaaS)
Requirements
- Python 3.8 or higher
Installation
pip install CozeLoop
Usage
Initialize
To get started, visit https://www.coze.cn/open/oauth/apps and create an OAuth app. Then you can get your owner appid, public key and private key.
Set your environment variables:
export COZELOOP_WORKSPACE_ID=your workspace id
export COZELOOP_JWT_OAUTH_CLIENT_ID=your client id
export COZELOOP_JWT_OAUTH_PRIVATE_KEY=your private key
export COZELOOP_JWT_OAUTH_PUBLIC_KEY_ID=your public key id
Report Trace
def main():
span = cozeloop.start_span("root", "custom")
span.set_input("Hello")
span.set_output("World")
span.finish()
cozeloop.close()
Get Prompt
def main():
prompt = cozeloop.get_prompt(prompt_key="your_prompt_key")
messages = cozeloop.prompt_format(
prompt,
{"var1": "your content"},
)
You can see more examples here.
Contribution
Please check Contributing for more details.
Security
If you discover a potential security issue in this project, or think you may have discovered a security issue, we ask that you notify Bytedance Security via our security center or vulnerability reporting email.
Please do not create a public GitHub issue.
License
This project is licensed under the 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 cozeloop-0.1.28.tar.gz.
File metadata
- Download URL: cozeloop-0.1.28.tar.gz
- Upload date:
- Size: 63.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
119fa314e71ce6ab6831ee0088c893484698fba7ae8a0008636bb49e65fced05
|
|
| MD5 |
ac35410bbc12f467ce2d2de1acf55b75
|
|
| BLAKE2b-256 |
9ecb17baac72e1100bece6aa43d4896e046b9f72b5f15bd87efb0cde2d28f989
|
File details
Details for the file cozeloop-0.1.28-py3-none-any.whl.
File metadata
- Download URL: cozeloop-0.1.28-py3-none-any.whl
- Upload date:
- Size: 90.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aff0dd9a985a6dcd8ba51940c1d7f4eab00b1783f686938084669d6b2938b89a
|
|
| MD5 |
58ee3ff2f5665028c163d81c10916c56
|
|
| BLAKE2b-256 |
b473d96e740836d7abef30949caebd7b5a076b1e614ec72b280fd278c336d38b
|