Skip to main content

Sensenova Python Library

The Sensenova Python library provides convenient access to the Sensenova API from applications written in the Python language.

Installation

You don't need this source code unless you want to modify the package. If you just want to use the package, just run:

pip install --upgrade sensenova

Usage

Configure API KEY

Set environment variable:

export SENSENOVA_ACCESS_KEY_ID=
export SENSENOVA_SECRET_ACCESS_KEY=

Or set sensenova.access_key_id and sensenova.secret_access_key to its value:

import sensenova

sensenova.access_key_id = "..."
sensenova.secret_access_key = "..."

API

cli

sensenova api chat_completions.create -m xxx -g user "Say this is a test!" --stream

python

import sensenova

# create a chat completion
chat_completion = sensenova.ChatCompletion.create(
    model="xxx",
    messages=[{"role": "user", "content": "Say this is a test!"}]
)

# print the chat completion
print(chat_completion.data.choices[0].message)

python async

Async support is available in the API by prepending a to a network-bound method:

import sensenova
import asyncio


async def create_chat_completion():
    chat_completion_resp = await sensenova.ChatCompletion.acreate(
        model="xxx",
        messages=[{"role": "user", "content": "Say this is a test!"}]
    )
    print(chat_completion_resp.data.choices[0].message)


asyncio.run(create_chat_completion())

To make async requests more efficient, you can pass in your own aiohttp.ClientSession, but you must manually close the client session at the end of your program/event loop:

import sensenova
from aiohttp import ClientSession

sensenova.aiosession.set(ClientSession())
# At the end of your program, close the http session
await sensenova.aiosession.get().close()

Tools

Run the following command on data.json to get the cleaned_data.json file

sensenova tools fine_tunes.prepare_data -f data.json

Requirements

  • Python 3.7.1+

Metadata

Release files for sensenova 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sensenova 1.0.6
File Size Uploaded Provenance
sensenova-1.0.6.tar.gz 29.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sensenova 1.0.6
File Interpreter ABI Platform
sensenova-1.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 78.8 kB

Release files / sensenova-1.0.6.tar.gz

Download URL sensenova-1.0.6.tar.gz
Size 29.9 kB
Tags Source
SHA-256 checksum
How to use checksums
51c099511f2a56c56a9b0340ed240b85bc0da2e5f0ba9217302b33f3fc4c4495
BLAKE2b-256 checksum
How to use checksums
229accf90e817a90c988ebfdd70f3f82228d877109216e8c81de6dcc41b48ef9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.1

Release files / sensenova-1.0.6-py3-none-any.whl

Download URL sensenova-1.0.6-py3-none-any.whl
Size 49.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a219b759040acb9c85c6f70253a744ed1e6134a180f87252f1914515bf58558
BLAKE2b-256 checksum
How to use checksums
9fcaa6cdb22470a0a6c3fb3ba9880c18a805c913354e7a6a2a3f08d4a5b95026
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.7.1

Security for sensenova 1.0.6

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page