taskingai


Nametaskingai JSON
Version 0.2.4 PyPI version JSON
download
home_pagehttps://www.tasking.ai
SummaryTaskingAI
upload_time2024-05-13 12:19:38
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseNone
keywords taskingai llm ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TaskingAI-client

The official TaskingAI Python client.

For more information, see the docs at [TaskingAI Documentation](https://docs.tasking.ai/)

## Prerequisites

The TaskingAI client is compatible with Python 3.8 and above.

## Installation

Use `pip` to install the TaskingAI Python client.

```shell
# Install the latest version
pip install taskingai

# Install a specific version
pip install taskingai==0.2.2
```

## Usage

### Initialization

Before you can use the TaskingAI SDK, you must have your TaskingAI project set up and running. For community version, visit [TaskingAI Community](https://www.github.com/taskingai/taskingai) to get started. For cloud version, visit [TaskingAI Cloud](https://www.tasking.ai) to sign up first.

You need to initialize the TaskingAI Python client with an API key you obtain from the TaskingAI console. You can set the API key as an environment variable or pass it directly to the `init` function.

#### Using environment variables (Recommended)

Set it as an environment variable on your local system, and the SDK will automatically load the key without passing the `api_key` parameter in the `init` function.

```shell
export TASKINGAI_API_KEY=$YOUR_API_KEY
```

When you run your Python script, the SDK will automatically pick up the API key from the environment variable.

```python
import taskingai
# taskingai.init()
# No need to initialize the SDK with the API key
```

#### Passing the API key directly

You can also specify an API key to the SDK by passing it as a parameter to the init function:

```python
import taskingai
taskingai.init(api_key="YOUR_API_KEY")
```

If you use community version, you can set the base URL to the TaskingAI server by passing it to the `init` function:

```python
import taskingai
taskingai.init(api_key="YOUR_API_KEY", host="http://localhost:8080")
```

### Assistants

The Assistant system in TaskingAI represents a sophisticated framework designed to create and manage AI agents with customizable functionalities.

Here is an example of how to create, update, and delete an assistant:

```python
import taskingai

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

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

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

# Update the assistant's description
taskingai.assistant.update_assistant(
    assistant_id=asst.assistant_id,
    description="Updated description"
)
print(f"Assistant updated.")

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

### Retrieval

TaskingAI offers comprehensive tools for the retrieval system, ranging from straightforward to intricate setups. Here is an example of how to create, add, retrieve, and delete a record in a collection:

```python
import taskingai

# Create a collection for storing and retrieving data
coll = taskingai.retrieval.create_collection(
    embedding_model_id="YOUR_EMBEDDING_MODEL_ID",
    capacity=1000
)
print(f"Collection created: {coll.collection_id}")

# Add a record to the collection
record = taskingai.retrieval.create_record(
    collection_id=coll.collection_id,
    type="text",
    content="Machine learning is ...",
    text_splitter={"type": "token", "chunk_size": 200, "chunk_overlap": 20}
)
print(f"Record added to collection: {record.record_id}")

# Retrieve the record from the collection
retrieved_record = taskingai.retrieval.get_record(
    collection_id=coll.collection_id,
    record_id=record.record_id
)
print(f"Record retrieved: {retrieved_record.content}")

# Delete the record
taskingai.retrieval.delete_record(
    collection_id=coll.collection_id,
    record_id=record.record_id
)
print("Record deleted.")

# Delete the collection
taskingai.retrieval.delete_collection(collection_id=coll.collection_id)
print("Collection deleted.")
```

### Tools

The Tools module in TaskingAI is an essential suite designed to augment the capabilities of TaskingAI agents. Here is an example of how to create, run, and delete a tool action:

```python
import taskingai

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

# Create a tool action based on the defined schema
actions = taskingai.tool.bulk_create_actions(
    openapi_schema=OPENAPI_SCHEMA,
    authentication={"type": "none"},
)
action = actions[0]
print(f"Action created: {action.action_id}")

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

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

## Contributing

We welcome contributions of all kinds. Please read our [Contributing Guidelines](./CONTRIBUTING.md) for more information on how to get started.

            

Raw data

            {
    "_id": null,
    "home_page": "https://www.tasking.ai",
    "name": "taskingai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "TaskingAI, LLM, AI",
    "author": null,
    "author_email": "support@tasking.ai",
    "download_url": "https://files.pythonhosted.org/packages/8b/fe/f0b2e4297bcc4f98990cb617f0e21687b14c7565aec304224992a3449578/taskingai-0.2.4.tar.gz",
    "platform": null,
    "description": "# TaskingAI-client\n\nThe official TaskingAI Python client.\n\nFor more information, see the docs at [TaskingAI Documentation](https://docs.tasking.ai/)\n\n## Prerequisites\n\nThe TaskingAI client is compatible with Python 3.8 and above.\n\n## Installation\n\nUse `pip` to install the TaskingAI Python client.\n\n```shell\n# Install the latest version\npip install taskingai\n\n# Install a specific version\npip install taskingai==0.2.2\n```\n\n## Usage\n\n### Initialization\n\nBefore you can use the TaskingAI SDK, you must have your TaskingAI project set up and running. For community version, visit [TaskingAI Community](https://www.github.com/taskingai/taskingai) to get started. For cloud version, visit [TaskingAI Cloud](https://www.tasking.ai) to sign up first.\n\nYou need to initialize the TaskingAI Python client with an API key you obtain from the TaskingAI console. You can set the API key as an environment variable or pass it directly to the `init` function.\n\n#### Using environment variables (Recommended)\n\nSet it as an environment variable on your local system, and the SDK will automatically load the key without passing the `api_key` parameter in the `init` function.\n\n```shell\nexport TASKINGAI_API_KEY=$YOUR_API_KEY\n```\n\nWhen you run your Python script, the SDK will automatically pick up the API key from the environment variable.\n\n```python\nimport taskingai\n# taskingai.init()\n# No need to initialize the SDK with the API key\n```\n\n#### Passing the API key directly\n\nYou can also specify an API key to the SDK by passing it as a parameter to the init function:\n\n```python\nimport taskingai\ntaskingai.init(api_key=\"YOUR_API_KEY\")\n```\n\nIf you use community version, you can set the base URL to the TaskingAI server by passing it to the `init` function:\n\n```python\nimport taskingai\ntaskingai.init(api_key=\"YOUR_API_KEY\", host=\"http://localhost:8080\")\n```\n\n### Assistants\n\nThe Assistant system in TaskingAI represents a sophisticated framework designed to create and manage AI agents with customizable functionalities.\n\nHere is an example of how to create, update, and delete an assistant:\n\n```python\nimport taskingai\n\n# Initialize your API key if you haven't already set it in the environment\ntaskingai.init(api_key=\"YOUR_API_KEY\")\n\n# Create an assistant\nasst = taskingai.assistant.create_assistant(\n    model_id=\"YOUR_MODEL_ID\",\n    memory={\"type\": \"naive\"},\n    system_prompt_template=[\"You are a professional assistant.\"],\n)\nprint(f\"Assistant created: {asst.assistant_id}\")\n\n# Get details about the assistant\nassistant_details = taskingai.assistant.get_assistant(assistant_id=asst.assistant_id)\nprint(f\"Assistant details: {assistant_details}\")\n\n# Update the assistant's description\ntaskingai.assistant.update_assistant(\n    assistant_id=asst.assistant_id,\n    description=\"Updated description\"\n)\nprint(f\"Assistant updated.\")\n\n# Delete the assistant when done\ntaskingai.assistant.delete_assistant(assistant_id=asst.assistant_id)\nprint(\"Assistant deleted successfully.\")\n```\n\n### Retrieval\n\nTaskingAI offers comprehensive tools for the retrieval system, ranging from straightforward to intricate setups. Here is an example of how to create, add, retrieve, and delete a record in a collection:\n\n```python\nimport taskingai\n\n# Create a collection for storing and retrieving data\ncoll = taskingai.retrieval.create_collection(\n    embedding_model_id=\"YOUR_EMBEDDING_MODEL_ID\",\n    capacity=1000\n)\nprint(f\"Collection created: {coll.collection_id}\")\n\n# Add a record to the collection\nrecord = taskingai.retrieval.create_record(\n    collection_id=coll.collection_id,\n    type=\"text\",\n    content=\"Machine learning is ...\",\n    text_splitter={\"type\": \"token\", \"chunk_size\": 200, \"chunk_overlap\": 20}\n)\nprint(f\"Record added to collection: {record.record_id}\")\n\n# Retrieve the record from the collection\nretrieved_record = taskingai.retrieval.get_record(\n    collection_id=coll.collection_id,\n    record_id=record.record_id\n)\nprint(f\"Record retrieved: {retrieved_record.content}\")\n\n# Delete the record\ntaskingai.retrieval.delete_record(\n    collection_id=coll.collection_id,\n    record_id=record.record_id\n)\nprint(\"Record deleted.\")\n\n# Delete the collection\ntaskingai.retrieval.delete_collection(collection_id=coll.collection_id)\nprint(\"Collection deleted.\")\n```\n\n### Tools\n\nThe Tools module in TaskingAI is an essential suite designed to augment the capabilities of TaskingAI agents. Here is an example of how to create, run, and delete a tool action:\n\n```python\nimport taskingai\n\n# Define a schema for the tool action\nOPENAPI_SCHEMA = {\n    # Schema definition goes here\n}\n\n# Create a tool action based on the defined schema\nactions = taskingai.tool.bulk_create_actions(\n    openapi_schema=OPENAPI_SCHEMA,\n    authentication={\"type\": \"none\"},\n)\naction = actions[0]\nprint(f\"Action created: {action.action_id}\")\n\n# Run the action for a test purpose\nresult = taskingai.tool.run_action(\n    action_id=action.action_id,\n    parameters={\"number\": 42}\n)\nprint(f\"Action result: {result}\")\n\n# Delete the action when done\ntaskingai.tool.delete_action(action_id=action.action_id)\nprint(\"Action deleted.\")\n```\n\n## Contributing\n\nWe welcome contributions of all kinds. Please read our [Contributing Guidelines](./CONTRIBUTING.md) for more information on how to get started.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "TaskingAI",
    "version": "0.2.4",
    "project_urls": {
        "Homepage": "https://www.tasking.ai"
    },
    "split_keywords": [
        "taskingai",
        " llm",
        " ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "940d7d7c23a00c53c1f331dae20bf108992124807c0f25e5606d3beb31d615e3",
                "md5": "0c5aabde8a68f4a6ecc7eaefa479d121",
                "sha256": "d0b99e83e28b723f8468889da1154fb836f5e48dad5820b1466acbb2f9e0ce2b"
            },
            "downloads": -1,
            "filename": "taskingai-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0c5aabde8a68f4a6ecc7eaefa479d121",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 136007,
            "upload_time": "2024-05-13T12:19:36",
            "upload_time_iso_8601": "2024-05-13T12:19:36.543863Z",
            "url": "https://files.pythonhosted.org/packages/94/0d/7d7c23a00c53c1f331dae20bf108992124807c0f25e5606d3beb31d615e3/taskingai-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8bfef0b2e4297bcc4f98990cb617f0e21687b14c7565aec304224992a3449578",
                "md5": "e2b60c5850591d7488e873960704cc6b",
                "sha256": "be1507807479007b565023efc50cdf80e59dd1bcc2421747e7e23acdada93d04"
            },
            "downloads": -1,
            "filename": "taskingai-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "e2b60c5850591d7488e873960704cc6b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 45675,
            "upload_time": "2024-05-13T12:19:38",
            "upload_time_iso_8601": "2024-05-13T12:19:38.477851Z",
            "url": "https://files.pythonhosted.org/packages/8b/fe/f0b2e4297bcc4f98990cb617f0e21687b14c7565aec304224992a3449578/taskingai-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-13 12:19:38",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "taskingai"
}
        
Elapsed time: 0.23936s