aisen


Nameaisen JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryPython SDK for aisen.vn API
upload_time2025-08-19 05:34:26
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 LLaSea Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords aisen ai api sdk vietnam
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # aisen Python SDK

A Python client library for the [aisen.vn](https://aisen.vn) API - Vietnam's AI platform.

## Installation

```bash
pip install aisen
```

## Quick Start

```python
from aisen import AisenClient

# Initialize the client with your API key
client = AisenClient(api_key="your-api-key-here")

# Chat completion
response = client.chat([
    {"role": "user", "content": "Xin chào! Bạn có thể giúp tôi không?"}
])
print(response)

# Text generation
response = client.generate_text("Viết một bài thơ về Việt Nam")
print(response)

# Get available models
models = client.get_models()
print(models)

# Check API status
status = client.get_status()
print(status)
```

## Authentication

You'll need an API key from [aisen.vn](https://aisen.vn). Sign up for an account and generate your API key from the dashboard.

## API Reference

### AisenClient

The main client class for interacting with the aisen.vn API.

#### `__init__(api_key, base_url="https://api.aisen.vn")`

Initialize the client with your API key.

- `api_key` (str): Your API key from aisen.vn
- `base_url` (str, optional): Base URL for the API

#### `chat(messages, model="gpt-3.5-turbo", **kwargs)`

Send a chat completion request.

- `messages` (List[Dict]): List of message objects with 'role' and 'content'
- `model` (str): Model to use for completion
- `**kwargs`: Additional parameters

Returns a dictionary containing the chat completion response.

#### `generate_text(prompt, model="text-davinci-003", **kwargs)`

Generate text completion.

- `prompt` (str): Text prompt for generation
- `model` (str): Model to use for generation
- `**kwargs`: Additional parameters

Returns a dictionary containing the generated text.

#### `get_models()`

Get list of available models.

#### `get_status()`

Get API status and health check information.

## Error Handling

The SDK includes custom exceptions:

- `AisenError`: Base exception for all SDK errors
- `APIError`: Raised for API-related errors
- `AuthenticationError`: Raised for authentication failures

```python
from aisen import AisenClient, AuthenticationError, APIError

try:
    client = AisenClient(api_key="invalid-key")
    response = client.chat([{"role": "user", "content": "Hello"}])
except AuthenticationError:
    print("Invalid API key")
except APIError as e:
    print(f"API error: {e}")
```

## Vietnamese Language Support

The aisen.vn platform is optimized for Vietnamese language processing:

```python
# Vietnamese chat
response = client.chat([
    {"role": "system", "content": "Bạn là một trợ lý AI thông minh và hữu ích."},
    {"role": "user", "content": "Giải thích về trí tuệ nhân tạo bằng tiếng Việt."}
])

# Vietnamese text generation
poem = client.generate_text(
    "Viết một bài thơ về mùa thu Hà Nội",
    model="vietnamese-poet-v1"
)
```

## Development

See [instructions.md](instructions.md) for development setup and contribution guidelines.

## License

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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aisen",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "aisen, ai, api, sdk, vietnam",
    "author": null,
    "author_email": "LLaSea <llasea@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/56/2c/f7b8f9251948ddfa7e918f51b31fc8dcd856fb27f673a5159d04fb105249/aisen-0.1.0.tar.gz",
    "platform": null,
    "description": "# aisen Python SDK\n\nA Python client library for the [aisen.vn](https://aisen.vn) API - Vietnam's AI platform.\n\n## Installation\n\n```bash\npip install aisen\n```\n\n## Quick Start\n\n```python\nfrom aisen import AisenClient\n\n# Initialize the client with your API key\nclient = AisenClient(api_key=\"your-api-key-here\")\n\n# Chat completion\nresponse = client.chat([\n    {\"role\": \"user\", \"content\": \"Xin ch\u00e0o! B\u1ea1n c\u00f3 th\u1ec3 gi\u00fap t\u00f4i kh\u00f4ng?\"}\n])\nprint(response)\n\n# Text generation\nresponse = client.generate_text(\"Vi\u1ebft m\u1ed9t b\u00e0i th\u01a1 v\u1ec1 Vi\u1ec7t Nam\")\nprint(response)\n\n# Get available models\nmodels = client.get_models()\nprint(models)\n\n# Check API status\nstatus = client.get_status()\nprint(status)\n```\n\n## Authentication\n\nYou'll need an API key from [aisen.vn](https://aisen.vn). Sign up for an account and generate your API key from the dashboard.\n\n## API Reference\n\n### AisenClient\n\nThe main client class for interacting with the aisen.vn API.\n\n#### `__init__(api_key, base_url=\"https://api.aisen.vn\")`\n\nInitialize the client with your API key.\n\n- `api_key` (str): Your API key from aisen.vn\n- `base_url` (str, optional): Base URL for the API\n\n#### `chat(messages, model=\"gpt-3.5-turbo\", **kwargs)`\n\nSend a chat completion request.\n\n- `messages` (List[Dict]): List of message objects with 'role' and 'content'\n- `model` (str): Model to use for completion\n- `**kwargs`: Additional parameters\n\nReturns a dictionary containing the chat completion response.\n\n#### `generate_text(prompt, model=\"text-davinci-003\", **kwargs)`\n\nGenerate text completion.\n\n- `prompt` (str): Text prompt for generation\n- `model` (str): Model to use for generation\n- `**kwargs`: Additional parameters\n\nReturns a dictionary containing the generated text.\n\n#### `get_models()`\n\nGet list of available models.\n\n#### `get_status()`\n\nGet API status and health check information.\n\n## Error Handling\n\nThe SDK includes custom exceptions:\n\n- `AisenError`: Base exception for all SDK errors\n- `APIError`: Raised for API-related errors\n- `AuthenticationError`: Raised for authentication failures\n\n```python\nfrom aisen import AisenClient, AuthenticationError, APIError\n\ntry:\n    client = AisenClient(api_key=\"invalid-key\")\n    response = client.chat([{\"role\": \"user\", \"content\": \"Hello\"}])\nexcept AuthenticationError:\n    print(\"Invalid API key\")\nexcept APIError as e:\n    print(f\"API error: {e}\")\n```\n\n## Vietnamese Language Support\n\nThe aisen.vn platform is optimized for Vietnamese language processing:\n\n```python\n# Vietnamese chat\nresponse = client.chat([\n    {\"role\": \"system\", \"content\": \"B\u1ea1n l\u00e0 m\u1ed9t tr\u1ee3 l\u00fd AI th\u00f4ng minh v\u00e0 h\u1eefu \u00edch.\"},\n    {\"role\": \"user\", \"content\": \"Gi\u1ea3i th\u00edch v\u1ec1 tr\u00ed tu\u1ec7 nh\u00e2n t\u1ea1o b\u1eb1ng ti\u1ebfng Vi\u1ec7t.\"}\n])\n\n# Vietnamese text generation\npoem = client.generate_text(\n    \"Vi\u1ebft m\u1ed9t b\u00e0i th\u01a1 v\u1ec1 m\u00f9a thu H\u00e0 N\u1ed9i\",\n    model=\"vietnamese-poet-v1\"\n)\n```\n\n## Development\n\nSee [instructions.md](instructions.md) for development setup and contribution guidelines.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 LLaSea  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Python SDK for aisen.vn API",
    "version": "0.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/aisen-vn/aisen-python-sdk/issues",
        "Documentation": "https://docs.aisen.vn",
        "Homepage": "https://aisen.vn",
        "Repository": "https://github.com/aisen-vn/aisen-python-sdk"
    },
    "split_keywords": [
        "aisen",
        " ai",
        " api",
        " sdk",
        " vietnam"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "40076040b2abcb4449017994c29850e26c576d53504194860d2f76af47bd1786",
                "md5": "f80e40af9d2b7103317a8f653c293f01",
                "sha256": "8b584cfcad5c935ab449ac55ee59e7d11d26cdc47f0dccb14ace907fc53a1e8a"
            },
            "downloads": -1,
            "filename": "aisen-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f80e40af9d2b7103317a8f653c293f01",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 5945,
            "upload_time": "2025-08-19T05:34:24",
            "upload_time_iso_8601": "2025-08-19T05:34:24.855553Z",
            "url": "https://files.pythonhosted.org/packages/40/07/6040b2abcb4449017994c29850e26c576d53504194860d2f76af47bd1786/aisen-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "562cf7b8f9251948ddfa7e918f51b31fc8dcd856fb27f673a5159d04fb105249",
                "md5": "4fc45cd57033f816de5da7a14b1ec2ec",
                "sha256": "e6d60e2d923fcd46b4e875948fb7297a62f2fd985c71758f4881dc0e92b7a549"
            },
            "downloads": -1,
            "filename": "aisen-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4fc45cd57033f816de5da7a14b1ec2ec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 7324,
            "upload_time": "2025-08-19T05:34:26",
            "upload_time_iso_8601": "2025-08-19T05:34:26.592778Z",
            "url": "https://files.pythonhosted.org/packages/56/2c/f7b8f9251948ddfa7e918f51b31fc8dcd856fb27f673a5159d04fb105249/aisen-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-19 05:34:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aisen-vn",
    "github_project": "aisen-python-sdk",
    "github_not_found": true,
    "lcname": "aisen"
}
        
Elapsed time: 1.37476s