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.26.tar.gz (64.2 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.26-py3-none-any.whl (91.6 kB view details)

Uploaded Python 3

File details

Details for the file cozeloop-0.1.26.tar.gz.

File metadata

  • Download URL: cozeloop-0.1.26.tar.gz
  • Upload date:
  • Size: 64.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for cozeloop-0.1.26.tar.gz
Algorithm Hash digest
SHA256 10c518fd83c8d99f78898b032034d403c14792eea5d30ce30175137367498cdd
MD5 972dbf01b679a880655eb5b487fc5f78
BLAKE2b-256 b30b3397a66df1144a01946255e2fa0d41f1afcab55299d7a4fa53aae30308aa

See more details on using hashes here.

File details

Details for the file cozeloop-0.1.26-py3-none-any.whl.

File metadata

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

File hashes

Hashes for cozeloop-0.1.26-py3-none-any.whl
Algorithm Hash digest
SHA256 c480b7221d2156e47a8d734f5d50fa436120f3a1015ad32159335eb552785068
MD5 f281a46fcd81860dcb57e20f81b90faa
BLAKE2b-256 bdc538ce89f0394f661cf0a96c85045a699d51ec91d668af32dca143dd62bc1f

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