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.
Metadata
Release files for cozeloop 0.1.28
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cozeloop-0.1.28.tar.gz | 63.6 kB | Without provenance | Details for cozeloop-0.1.28.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cozeloop-0.1.28-py3-none-any.whl | Python 3 | none | any | Details for cozeloop-0.1.28-py3-none-any.whl |
Total release size: 154.5 kB
Release files / cozeloop-0.1.28.tar.gz
| Download URL | cozeloop-0.1.28.tar.gz |
|---|---|
| Size | 63.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
119fa314e71ce6ab6831ee0088c893484698fba7ae8a0008636bb49e65fced05
|
|
BLAKE2b-256 checksum How to use checksums |
9ecb17baac72e1100bece6aa43d4896e046b9f72b5f15bd87efb0cde2d28f989
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Release files / cozeloop-0.1.28-py3-none-any.whl
| Download URL | cozeloop-0.1.28-py3-none-any.whl |
|---|---|
| Size | 90.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aff0dd9a985a6dcd8ba51940c1d7f4eab00b1783f686938084669d6b2938b89a
|
|
BLAKE2b-256 checksum How to use checksums |
b473d96e740836d7abef30949caebd7b5a076b1e614ec72b280fd278c336d38b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.6
|
Security for cozeloop 0.1.28
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.