Giter Site home page Giter Site logo

taskingai-python-client's Introduction

TaskingAI-client

The TaskingAI Python client for creating and managing AI-driven applications.

For more information, see the docs at TaskingAI Documentation

Installation

Install the latest released version using pip:

pip3 install taskingai

Quickstart

Here's how you can quickly start building and managing AI-driven applications using the TaskingAI client.

Assistants

Explore the ease of creating and customizing your own AI assistants with TaskingAI to enhance user interactions.

import taskingai
from taskingai.assistant import *
from taskingai.assistant.memory import AssistantNaiveMemory

# Initialize your API key if you haven't already set it in the environment
taskingai.init(api_key="YOUR_API_KEY")

# Create an assistant
assistant = create_assistant(
    model_id="YOUR_MODEL_ID",
    memory=AssistantNaiveMemory(),
    system_prompt_template=["You are a professional assistant."],
)
print(f"Assistant created: {assistant.id}")

# Get details about the assistant
assistant_details = get_assistant(assistant_id=assistant.id)
print(f"Assistant details: {assistant_details}")

# Update the assistant's description
update_assistant(
    assistant_id=assistant.id,
    description="An updated description for my assistant."
)
print(f"Assistant updated.")

# Delete the assistant when done
delete_assistant(assistant_id=assistant.id)
print("Assistant deleted successfully.")

Retrieval

Leverage TaskingAI's retrieval capabilities to store, manage, and extract information, making your applications smarter and more responsive.

import taskingai
from taskingai.retrieval import *

# Create a collection for storing and retrieving data
collection = create_collection(
    embedding_model_id="YOUR_MODEL_ID",
    capacity=1000
)
print(f"Collection created: {collection.id}")

# Add a record to the collection
record = create_record(
    collection_id=collection.id,
    content="Example text for machine learning.",
    text_splitter=TokenTextSplitter(chunk_size=200, chunk_overlap=20),
)
print(f"Record added to collection: {record.id}")

# Retrieve the record from the collection
retrieved_record = get_record(
    collection_id=collection.id,
    record_id=record.id
)
print(f"Record retrieved: {retrieved_record.text}")

# Delete the record
delete_record(
    collection_id=collection.id,
    record_id=record.id
)
print("Record deleted.")

# Delete the collection
delete_collection(collection_id=collection.id)
print("Collection deleted.")

Tools

Utilize TaskingAI's tools to create actions that enable your assistant to interact with external APIs and services, enriching the user experience.

import taskingai
from taskingai.tool import *

# Define a schema for the tool action
NUMBERS_API_SCHEMA = {
    # Schema definition goes here
}

# Create a tool action based on the defined schema
actions = bulk_create_actions(
    openapi_schema=NUMBERS_API_SCHEMA,
    authentication=ActionAuthentication(type=ActionAuthenticationType.NONE)
)
action = actions[0]
print(f"Action created: {action.id}")

# Run the action for a test purpose
result = run_action(
    action_id=action.id,
    parameters={"number": 42}
)
print(f"Action result: {result}")

# Delete the action when done
delete_action(action_id=action.id)
print("Action deleted.")

Contributing

We welcome contributions of all kinds. Please read our Contributing Guidelines for more information on how to get started.

taskingai-python-client's People

Contributors

jameszyao avatar simsonw avatar prompt-bot avatar taskingaijc avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.