{"id":18984937,"url":"https://github.com/taskingai/taskingai-python-client","last_synced_at":"2025-04-19T20:26:23.538Z","repository":{"id":218674213,"uuid":"719431957","full_name":"TaskingAI/TaskingAI-Python-Client","owner":"TaskingAI","description":"TaskingAI Python Client","archived":false,"fork":false,"pushed_at":"2025-01-28T19:17:43.000Z","size":558,"stargazers_count":19,"open_issues_count":4,"forks_count":21,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-16T19:20:32.671Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TaskingAI.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-16T06:36:33.000Z","updated_at":"2024-11-01T14:47:53.000Z","dependencies_parsed_at":"2024-05-14T04:28:16.656Z","dependency_job_id":null,"html_url":"https://github.com/TaskingAI/TaskingAI-Python-Client","commit_stats":null,"previous_names":["taskingai/taskingai-python-client"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TaskingAI%2FTaskingAI-Python-Client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TaskingAI%2FTaskingAI-Python-Client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TaskingAI%2FTaskingAI-Python-Client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TaskingAI%2FTaskingAI-Python-Client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TaskingAI","download_url":"https://codeload.github.com/TaskingAI/TaskingAI-Python-Client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249793778,"owners_count":21326591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T16:23:47.935Z","updated_at":"2025-04-19T20:26:23.513Z","avatar_url":"https://github.com/TaskingAI.png","language":"Python","readme":"# 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","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskingai%2Ftaskingai-python-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaskingai%2Ftaskingai-python-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaskingai%2Ftaskingai-python-client/lists"}