Skip to main content

Design, deploy, and optimize LLM Apps with the Klu SDK

Project description

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.

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

klu-0.1.80.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

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

klu-0.1.80-py3-none-any.whl (60.4 kB view details)

Uploaded Python 3

File details

Details for the file klu-0.1.80.tar.gz.

File metadata

  • Download URL: klu-0.1.80.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for klu-0.1.80.tar.gz
Algorithm Hash digest
SHA256 438228bc1fbe68cc10bf5195106af279866dfca57a0ede65870e756d09a0989c
MD5 89371427742b29a5939fb09f9e21332f
BLAKE2b-256 3320fafd7b809c51533a740328b7fd56af9511ae128d8cf9f5b09fb409b77941

See more details on using hashes here.

File details

Details for the file klu-0.1.80-py3-none-any.whl.

File metadata

  • Download URL: klu-0.1.80-py3-none-any.whl
  • Upload date:
  • Size: 60.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for klu-0.1.80-py3-none-any.whl
Algorithm Hash digest
SHA256 16f29edb647f08f738e0b5f931dd908840a795ed4552c4ad6e4d910d783e71ae
MD5 5925ebcc650947d450e7838b986f9a20
BLAKE2b-256 0733cfb88d7e81961678f352b223149d3f3540e1e67fff6efbf891869ae1b85e

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