# 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.")
```
## 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/21/24/7bcdd679d6ce65dbdbeaa05afe262234187468c07a19c4585373d7dae7ff/taskingai-0.3.0.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## 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.3.0",
"project_urls": {
"Homepage": "https://www.tasking.ai"
},
"split_keywords": [
"taskingai",
" llm",
" ai"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "31f468f3b740a1b86475b99a59616f41cb3c06369752b24974f8b21be75ed635",
"md5": "4744474370f6724ff8d63c31a96433ee",
"sha256": "ad95e2e480b611e61546bc9d686f7800d67294a18c02205e374b047c9833da3a"
},
"downloads": -1,
"filename": "taskingai-0.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4744474370f6724ff8d63c31a96433ee",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 112783,
"upload_time": "2024-11-01T14:54:00",
"upload_time_iso_8601": "2024-11-01T14:54:00.422532Z",
"url": "https://files.pythonhosted.org/packages/31/f4/68f3b740a1b86475b99a59616f41cb3c06369752b24974f8b21be75ed635/taskingai-0.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "21247bcdd679d6ce65dbdbeaa05afe262234187468c07a19c4585373d7dae7ff",
"md5": "3b4d1408fc05ec7a8320013f864a9b64",
"sha256": "ad72a580e3fd7f056575b4d20fd31f37cfbe2392037390302b517eac5f76fe8b"
},
"downloads": -1,
"filename": "taskingai-0.3.0.tar.gz",
"has_sig": false,
"md5_digest": "3b4d1408fc05ec7a8320013f864a9b64",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 41124,
"upload_time": "2024-11-01T14:54:02",
"upload_time_iso_8601": "2024-11-01T14:54:02.233095Z",
"url": "https://files.pythonhosted.org/packages/21/24/7bcdd679d6ce65dbdbeaa05afe262234187468c07a19c4585373d7dae7ff/taskingai-0.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-01 14:54:02",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "taskingai"
}