anakin-ai


Nameanakin-ai JSON
Version 0.1.4 PyPI version JSON
download
home_pageNone
SummaryA Python client for interacting with the Anakin AI API
upload_time2024-08-01 02:09:16
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Unofficial Anakin AI Python Client

An unofficial Python client for interacting with the [Anakin AI](https://anakin.ai) API. This client allows you to easily integrate Anakin AI's powerful AI capabilities into your Python projects.

## Features

- Easy-to-use Python interface for Anakin AI API
- Support for both Quick Apps and Chatbot Apps
- Streaming and non-streaming response handling
- Flexible input handling for various app configurations

## Installation

Install the Anakin AI Python Client using pip:

```bash
pip install anakin-ai
```

If you encounter any issues with dependencies, you can manually install the required packages:

```bash
pip install anakin-ai requests
```

## Setup

Before using the client, you need to set up your Anakin AI API key:

1. Visit the Anakin AI website: https://anakin.ai and sign in to your account. You need to upgrade to a Pro account for using API feature.
2. Go to Account settings, and generate a new API Access Token.
   ![Generate an Anakin AI API Key](https://assets.anakin.ai/uploads/help/2024/05/07/8a26c2e93976c0f172842a3439a14810.png)
3. Set your local environment:
   ```bash
   # Set up a test environment:
   python -m venv anakin_test_env
   source anakin_test_env/bin/activate  # On Windows, use: anakin_test_env\Scripts\activate

   # Install Dependencies
   pip install -e .

   # Set up your API key:
   # Export your Anakin AI API key as an environment variable:
   export ANAKIN_AI_API_KEY="your_actual_api_key_here"
   # On Windows, use:
   set ANAKIN_AI_API_KEY=your_actual_api_key_here
   ```
4. Create a Quick App or Chatbot App in Anakin AI.

   ![](https://assets.anakin.ai/www/_next/static/media/feature-text-generation.1d76b8ca.webp)

   For example, if the URL is: https://app.anakin.ai/apps/28887, your APP_ID is 28887.

For detailed instructions on API setup, visit the [Anakin AI API Integration documentation](https://anakin.ai/docs/app-integration/api-integration).

## Usage

Here's how to use the Anakin AI Python Client for both Quick Apps and Chatbot Apps:

### Quick App

```python
from anakin_ai import AnakinAI
import os
import json

# Initialize the client with your API key
api_key = os.getenv("ANAKIN_AI_API_KEY")
client = AnakinAI(api_key)

# Run a Quick App
QUICK_APP_ID = "YOUR_APP_ID"  # Replace with your actual Quick App ID
inputs = {
    "Input": "Generate a marketing slogan for a cloud service that emphasizes reliability, performance, and efficiency."
}

# Streaming response
print("Testing Quick App with streaming:")
for chunk in client.run_quick_app(QUICK_APP_ID, inputs, stream=True):
    print(chunk, end='', flush=True)
print("\n\nStreaming completed.")

# Non-streaming response
print("\nTesting Quick App without streaming:")
result = client.run_quick_app(QUICK_APP_ID, inputs, stream=False)
print("Quick App Result:", json.dumps(result, indent=2))
```

### Chatbot App

```python
from anakin_ai import AnakinAI
import os
import json

# Initialize the client with your API key
api_key = os.getenv("ANAKIN_AI_API_KEY")
client = AnakinAI(api_key)

# Use a Chatbot App
CHATBOT_APP_ID = "YOUR_APP_ID"  # Replace with your actual Chatbot App ID

# Streaming response
print("Testing Chatbot with streaming:")
content = "What's your name? Are you the clever one?"
for chunk in client.chat_with_bot(CHATBOT_APP_ID, content, stream=True):
    print(chunk, end='', flush=True)
print("\n\nStreaming completed.")

# Non-streaming response
print("\nTesting Chatbot without streaming:")
content = "Tell me a joke about AI."
result = client.chat_with_bot(CHATBOT_APP_ID, content, stream=False)
print("Chatbot Result:", json.dumps(result, indent=2))

# Chatbot conversation example
print("\nTesting Chatbot conversation:")
messages = [
    "Hello, who are you?",
    "What can you do?",
    "Tell me a fun fact about AI."
]
for message in messages:
    print(f"\nUser: {message}")
    response = client.chat_with_bot(CHATBOT_APP_ID, message, stream=False)
    print("Chatbot:", response['content'])
```

Replace `"YOUR_APP_ID"` with your actual Anakin AI App IDs for Quick App and Chatbot App respectively.

## Differences between Quick App and Chatbot App calls

1. **Method names**: 
   - For Quick Apps, use `client.run_quick_app()`
   - For Chatbot Apps, use `client.chat_with_bot()`

2. **Input format**:
   - Quick Apps take a dictionary of inputs: `{"Input": "Your prompt here"}`
   - Chatbot Apps take a single string as content: `"Your message here"`

3. **URL endpoints**:
   - Quick Apps use: `/quickapps/{app_id}/runs`
   - Chatbot Apps use: `/chatbots/{app_id}/messages`

4. **Use case**:
   - Quick Apps are best for generating content based on specific inputs
   - Chatbot Apps are designed for interactive conversations

Both types of apps support streaming and non-streaming responses.

## Documentation

For more detailed information about the Anakin AI API and its capabilities, please refer to the [official Anakin AI documentation](https://anakin.ai/docs).

## Contributing

Contributions to the Anakin AI Python Client are welcome! Please feel free to submit a Pull Request.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Disclaimer

This is an unofficial client library and is not affiliated with, officially maintained, or endorsed by Anakin AI.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "anakin-ai",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Lynn Mikami <lgreenwood288@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/a0/8e/be2c18cfdae833aa0148e07b092e01e6108befbf4ba821f560d6159216b1/anakin_ai-0.1.4.tar.gz",
    "platform": null,
    "description": "# Unofficial Anakin AI Python Client\n\nAn unofficial Python client for interacting with the [Anakin AI](https://anakin.ai) API. This client allows you to easily integrate Anakin AI's powerful AI capabilities into your Python projects.\n\n## Features\n\n- Easy-to-use Python interface for Anakin AI API\n- Support for both Quick Apps and Chatbot Apps\n- Streaming and non-streaming response handling\n- Flexible input handling for various app configurations\n\n## Installation\n\nInstall the Anakin AI Python Client using pip:\n\n```bash\npip install anakin-ai\n```\n\nIf you encounter any issues with dependencies, you can manually install the required packages:\n\n```bash\npip install anakin-ai requests\n```\n\n## Setup\n\nBefore using the client, you need to set up your Anakin AI API key:\n\n1. Visit the Anakin AI website: https://anakin.ai and sign in to your account. You need to upgrade to a Pro account for using API feature.\n2. Go to Account settings, and generate a new API Access Token.\n   ![Generate an Anakin AI API Key](https://assets.anakin.ai/uploads/help/2024/05/07/8a26c2e93976c0f172842a3439a14810.png)\n3. Set your local environment:\n   ```bash\n   # Set up a test environment:\n   python -m venv anakin_test_env\n   source anakin_test_env/bin/activate  # On Windows, use: anakin_test_env\\Scripts\\activate\n\n   # Install Dependencies\n   pip install -e .\n\n   # Set up your API key:\n   # Export your Anakin AI API key as an environment variable:\n   export ANAKIN_AI_API_KEY=\"your_actual_api_key_here\"\n   # On Windows, use:\n   set ANAKIN_AI_API_KEY=your_actual_api_key_here\n   ```\n4. Create a Quick App or Chatbot App in Anakin AI.\n\n   ![](https://assets.anakin.ai/www/_next/static/media/feature-text-generation.1d76b8ca.webp)\n\n   For example, if the URL is: https://app.anakin.ai/apps/28887, your APP_ID is 28887.\n\nFor detailed instructions on API setup, visit the [Anakin AI API Integration documentation](https://anakin.ai/docs/app-integration/api-integration).\n\n## Usage\n\nHere's how to use the Anakin AI Python Client for both Quick Apps and Chatbot Apps:\n\n### Quick App\n\n```python\nfrom anakin_ai import AnakinAI\nimport os\nimport json\n\n# Initialize the client with your API key\napi_key = os.getenv(\"ANAKIN_AI_API_KEY\")\nclient = AnakinAI(api_key)\n\n# Run a Quick App\nQUICK_APP_ID = \"YOUR_APP_ID\"  # Replace with your actual Quick App ID\ninputs = {\n    \"Input\": \"Generate a marketing slogan for a cloud service that emphasizes reliability, performance, and efficiency.\"\n}\n\n# Streaming response\nprint(\"Testing Quick App with streaming:\")\nfor chunk in client.run_quick_app(QUICK_APP_ID, inputs, stream=True):\n    print(chunk, end='', flush=True)\nprint(\"\\n\\nStreaming completed.\")\n\n# Non-streaming response\nprint(\"\\nTesting Quick App without streaming:\")\nresult = client.run_quick_app(QUICK_APP_ID, inputs, stream=False)\nprint(\"Quick App Result:\", json.dumps(result, indent=2))\n```\n\n### Chatbot App\n\n```python\nfrom anakin_ai import AnakinAI\nimport os\nimport json\n\n# Initialize the client with your API key\napi_key = os.getenv(\"ANAKIN_AI_API_KEY\")\nclient = AnakinAI(api_key)\n\n# Use a Chatbot App\nCHATBOT_APP_ID = \"YOUR_APP_ID\"  # Replace with your actual Chatbot App ID\n\n# Streaming response\nprint(\"Testing Chatbot with streaming:\")\ncontent = \"What's your name? Are you the clever one?\"\nfor chunk in client.chat_with_bot(CHATBOT_APP_ID, content, stream=True):\n    print(chunk, end='', flush=True)\nprint(\"\\n\\nStreaming completed.\")\n\n# Non-streaming response\nprint(\"\\nTesting Chatbot without streaming:\")\ncontent = \"Tell me a joke about AI.\"\nresult = client.chat_with_bot(CHATBOT_APP_ID, content, stream=False)\nprint(\"Chatbot Result:\", json.dumps(result, indent=2))\n\n# Chatbot conversation example\nprint(\"\\nTesting Chatbot conversation:\")\nmessages = [\n    \"Hello, who are you?\",\n    \"What can you do?\",\n    \"Tell me a fun fact about AI.\"\n]\nfor message in messages:\n    print(f\"\\nUser: {message}\")\n    response = client.chat_with_bot(CHATBOT_APP_ID, message, stream=False)\n    print(\"Chatbot:\", response['content'])\n```\n\nReplace `\"YOUR_APP_ID\"` with your actual Anakin AI App IDs for Quick App and Chatbot App respectively.\n\n## Differences between Quick App and Chatbot App calls\n\n1. **Method names**: \n   - For Quick Apps, use `client.run_quick_app()`\n   - For Chatbot Apps, use `client.chat_with_bot()`\n\n2. **Input format**:\n   - Quick Apps take a dictionary of inputs: `{\"Input\": \"Your prompt here\"}`\n   - Chatbot Apps take a single string as content: `\"Your message here\"`\n\n3. **URL endpoints**:\n   - Quick Apps use: `/quickapps/{app_id}/runs`\n   - Chatbot Apps use: `/chatbots/{app_id}/messages`\n\n4. **Use case**:\n   - Quick Apps are best for generating content based on specific inputs\n   - Chatbot Apps are designed for interactive conversations\n\nBoth types of apps support streaming and non-streaming responses.\n\n## Documentation\n\nFor more detailed information about the Anakin AI API and its capabilities, please refer to the [official Anakin AI documentation](https://anakin.ai/docs).\n\n## Contributing\n\nContributions to the Anakin AI Python Client are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Disclaimer\n\nThis is an unofficial client library and is not affiliated with, officially maintained, or endorsed by Anakin AI.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python client for interacting with the Anakin AI API",
    "version": "0.1.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/lynn-mikami/anakin-ai-unofficial-api/issues",
        "Homepage": "https://anakin.ai"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "74c3947491090bdef3a7aaa0e66f56bc539bd04ef255c4f77a264ff604c4bdb4",
                "md5": "c685ac67f7ca7d8421048e3246e1ca3d",
                "sha256": "0a0e677e09b93805d96396d4f2eb6e2578fcc483f0daafe064dda5e338c7a489"
            },
            "downloads": -1,
            "filename": "anakin_ai-0.1.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c685ac67f7ca7d8421048e3246e1ca3d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5072,
            "upload_time": "2024-08-01T02:09:13",
            "upload_time_iso_8601": "2024-08-01T02:09:13.580770Z",
            "url": "https://files.pythonhosted.org/packages/74/c3/947491090bdef3a7aaa0e66f56bc539bd04ef255c4f77a264ff604c4bdb4/anakin_ai-0.1.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a08ebe2c18cfdae833aa0148e07b092e01e6108befbf4ba821f560d6159216b1",
                "md5": "02e09f9871afcf966e1716d8e304264c",
                "sha256": "e9eb3da451c1f7ee9e4116a3af1111c6ee43e47ac195c0503467b0d718cbb14b"
            },
            "downloads": -1,
            "filename": "anakin_ai-0.1.4.tar.gz",
            "has_sig": false,
            "md5_digest": "02e09f9871afcf966e1716d8e304264c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4888,
            "upload_time": "2024-08-01T02:09:16",
            "upload_time_iso_8601": "2024-08-01T02:09:16.108081Z",
            "url": "https://files.pythonhosted.org/packages/a0/8e/be2c18cfdae833aa0148e07b092e01e6108befbf4ba821f560d6159216b1/anakin_ai-0.1.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-01 02:09:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lynn-mikami",
    "github_project": "anakin-ai-unofficial-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "anakin-ai"
}
        
Elapsed time: 0.51851s