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 gaotu-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


Download files

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

Source Distribution

gaotu_cozeloop-0.1.27.tar.gz (64.5 kB view details)

Uploaded Source

Built Distribution

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

gaotu_cozeloop-0.1.27-py3-none-any.whl (92.0 kB view details)

Uploaded Python 3

File details

Details for the file gaotu_cozeloop-0.1.27.tar.gz.

File metadata

  • Download URL: gaotu_cozeloop-0.1.27.tar.gz
  • Upload date:
  • Size: 64.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.12

File hashes

Hashes for gaotu_cozeloop-0.1.27.tar.gz
Algorithm Hash digest
SHA256 ea453b9ada1af26f9dacbd247fd377ed04eecd499500928bc4fd8cc2c8dc8317
MD5 f51934b06fad3f07c595f9ffd2d24c3d
BLAKE2b-256 49b502e7219e3b3b022d1375b430fbd0650698a0b4106b09e6b1da57b27faced

See more details on using hashes here.

File details

Details for the file gaotu_cozeloop-0.1.27-py3-none-any.whl.

File metadata

File hashes

Hashes for gaotu_cozeloop-0.1.27-py3-none-any.whl
Algorithm Hash digest
SHA256 1ecb5eb8662654a0621fd14c1e90eccad40eea70c3f2b4c8f6d24387474a6c7d
MD5 6b0a0a755c5b150b62da21539931d0f4
BLAKE2b-256 306ec93cbc741fbd0dba031a2b1bfd6cb4cb74a8cdbd6c77231ae21d3dc26117

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