Skip to main content

Klu.ai Python SDK

pypi python Build Status codecov

Description

The Klu Python SDK is a library that provides access to the Klu platform. With the SDK, quick build AI-enabled apps.

The SDK gives developers the ability to interact with their workspace, including:

  • klu.apps Managing apps (projects)
  • klu.actions Manage actions (prompt templates with model config)
  • klu.context Create and manage context libaries for retrieval (RAG) or search
  • klu.actions.stream Deploy actions for generations and chat
  • klu.session Manage session memory across inference and models
  • klu.feedback Capture user feedback and behavior
  • klu.experiment Run 1:1 prompt evals and A/B tests
  • klu.data Import JSONL data for use, or export for further analysis
  • klu.models Manage LLM providers and default models
  • klu.finetune Fine-tune models with on your data

More resources here:

Installation

To install, run:

pip install klu

Klu SDK requires Python version 3.7 or later.

Getting Started

To access Klu via the SDK, first obtain your API key from the Klu.ai app. Once you have your key, you can create a Klu object:

from klu import Klu

klu = Klu("YOUR_API_KEY")

Manage Models

Once you have a Klu object, you can access the different models available in the Klu API:

from klu import Klu

klu = Klu("YOUR_API_KEY")
models = await klu.models.get("model_guid")

Get Apps

Each of these objects provides methods for interacting with the corresponding model in the Klu API. For example, to list all apps in your workspace, you can use:

from klu import Klu

klu = Klu("YOUR_API_KEY")
apps = klu.apps.list()

Run Actions w/ Streaming

Run inference with a Klu Action and start streaming generation response.

from klu import Klu

klu = Klu("YOUR_API_KEY")

prompt_response = await klu.actions.prompt("action_guid", "prompt", streaming=True)
async for message in klu.actions.stream(prompt_response.streaming_url):
    print(message)

Get Data

In a similar manner, in order to get a list of data points for an action, you can do the following:

from klu import Klu

klu = Klu("YOUR_API_KEY")
data = klu.data.get_data("action_guid")

See the platform docs for more examples.

Documentation

For more detailed information on how to use the SDK, please refer to the Klu Platform documentation.

License

K-human Likeness Utility © 2023 Klu, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Release files for klu 0.1.80

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

Source distribution (sdist)

Source distribution for klu 0.1.80
File Size Uploaded
klu-0.1.80.tar.gz 38.0 kB Details

Built distribution (wheel)

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

Total release size: 98.3 kB

Release files / klu-0.1.80.tar.gz

Download URL klu-0.1.80.tar.gz
Size 38.0 kB
Tags Source
SHA-256 checksum
How to use checksums
438228bc1fbe68cc10bf5195106af279866dfca57a0ede65870e756d09a0989c
BLAKE2b-256 checksum
How to use checksums
3320fafd7b809c51533a740328b7fd56af9511ae128d8cf9f5b09fb409b77941
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / klu-0.1.80-py3-none-any.whl

Download URL klu-0.1.80-py3-none-any.whl
Size 60.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16f29edb647f08f738e0b5f931dd908840a795ed4552c4ad6e4d910d783e71ae
BLAKE2b-256 checksum
How to use checksums
0733cfb88d7e81961678f352b223149d3f3540e1e67fff6efbf891869ae1b85e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.1.80 This release

2 release files

0.1.70

2 release files

0.1.55

2 release files

0.1.54

2 release files

0.1.53

2 release files

0.1.52

2 release files

0.1.50

2 release files

0.1.49

2 release files

0.1.46

2 release files

0.1.45

2 release files

0.1.43

2 release files

0.1.42

2 release files

0.1.41

2 release files

0.1.40

2 release files

0.1.39

2 release files

0.1.38

2 release files

0.1.36

2 release files

0.1.35

2 release files

0.1.34

2 release files

0.1.28

2 release files

0.1.26

2 release files

0.1.20

2 release files

0.1.19

2 release files

0.1.17

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

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