Skip to main content

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

cozeloop-0.1.29rc1.tar.gz (63.6 kB view details)

Uploaded Source

Built Distribution

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

cozeloop-0.1.29rc1-py3-none-any.whl (91.0 kB view details)

Uploaded Python 3

File details

Details for the file cozeloop-0.1.29rc1.tar.gz.

File metadata

  • Download URL: cozeloop-0.1.29rc1.tar.gz
  • Upload date:
  • Size: 63.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for cozeloop-0.1.29rc1.tar.gz
Algorithm Hash digest
SHA256 32beef143941d75f00249d9d6becbc049090f18bac69bf2c06d60fe51e70a63a
MD5 53c377a6efe57337544ceb45ca97ef99
BLAKE2b-256 43c21a6c4f89cc54e7ff132c0b47be59a848d68ae83d8c9d3972dd0709db666d

See more details on using hashes here.

File details

Details for the file cozeloop-0.1.29rc1-py3-none-any.whl.

File metadata

  • Download URL: cozeloop-0.1.29rc1-py3-none-any.whl
  • Upload date:
  • Size: 91.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for cozeloop-0.1.29rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 69ea0058595d24f6cc5f9953bb700c810695399b942e17c47b9b9ff8913f6d22
MD5 e711ec1a228107c092cbc30d11a87a61
BLAKE2b-256 c047328df44c221c5f51385ceaec6d5e2201b8491ea1461854def49cff7e5b11

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