Klu raises $1.7M to empower AI Teams  

Guide: Getting started with Klu Python SDK

by Stephen M. Walker II, Co-Founder / CEO

Top tip

The Klu Python SDK provides a simple way to leverage powerful AI models like OpenAI GPT-4 in your Python applications - just install the SDK, import Klu, initialize with your API key, create an action, and run it with your input text.

Step 1: Install the Klu SDK

First, you need to install the Klu SDK. You can do this by running the following command in your terminal:

pip install klu

Step 2: Import Klu

Next, you need to import the Klu module in your Python script:

from klu import Klu

Step 3: Initialize Klu

Now, you need to initialize Klu with your API key. You can find your API key in your Klu workspace settings.

klu = Klu('YOUR_API_KEY')

Step 4: Create an Action

To create an action, you need to define a prompt template, model config, and additional Klu-specific configurations. Here's an example:

action = klu.Action.create(
    name='Content Analyzer',
    description='Analyzes any given piece of text content',
    prompt_template='Analyze the following content: {{content}}',
    model_config={
        'provider': 'OpenAI',
        'model': 'GPT-4'
    }
)

Step 5: Run the Action

Finally, you can run the action with your input:

result = action.run(input={'content': 'Your text here'})
print(result)

This will print the generated text to the console.

And that's it! You've created and run your first Klu action using the Python SDK. Remember to replace 'YOUR_API_KEY' and 'Your text here' with your actual API key and the text you want to analyze, respectively.

If you want to learn more about the Klu Python SDK, you can check out the developer docs.

More articles

Exploring Open Source LLMs: Comprehensive Guide to Testing, Running, and Selecting the Best LLM Models

Open source LLMs like Llama 2, Mistral 7B, and Falcon are bringing advanced AI capabilities into the public domain. This guide explores the best open-source LLMs and variants for capabilities like chat, reasoning, and coding while outlining options to test models online or run them locally and in production.

Read more

Analyzing Retool's State of AI 2023 Report

In this post, we dive into Retool's State of AI 2023 report, analyzing key findings from a survey of over 1,500 tech professionals. We explore current AI usage, tooling preferences, and future outlooks, providing insights into how generative AI tools are being leveraged today and the evolving expectations.

Read more

It's time to build

Collaborate with your team on reliable Generative AI features.
Want expert guidance? Book a 1:1 onboarding session from your dashboard.

Start for free