qanswer_sdk


Nameqanswer_sdk JSON
Version 3.1335.0 PyPI version JSON
download
home_pagehttps://github.com/GIT_USER_ID/GIT_REPO_ID
SummaryQAnswer: Api Documentation
upload_time2025-11-01 20:21:58
maintainerNone
docs_urlNone
authorOpenAPI Generator Community
requires_python<4.0,>=3.8
licenseNoLicense
keywords openapi openapi-generator qanswer: api documentation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # QAnswer Python SDK

[![PyPI version](https://badge.fury.io/py/qanswer-sdk.svg)](https://pypi.org/project/qanswer-sdk/)
[![Python Versions](https://img.shields.io/pypi/pyversions/qanswer-sdk.svg)](https://pypi.org/project/qanswer-sdk/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

Official **Python SDK** for the [QAnswer API](https://qanswer.eu), automatically generated from the OpenAPI specification.

This SDK allows Python applications to interact with QAnswer's services programmatically without needing to craft raw HTTP requests.

---

## 🚀 Features

- Full coverage of QAnswer API endpoints  
- Type-safe models via [Pydantic](https://docs.pydantic.dev)  
- Easy configuration of authentication and base URL  
- Auto-generated and versioned with each API release  

---

## 📦 Installation

You can install from [PyPI](https://pypi.org/project/qanswer-sdk/):

```bash
pip install qanswer-sdk
```


Or add it to your `requirements.txt`

```txt
qanswer-sdk==3.1184.0
```

---

## 🔑 Authentication

Most endpoints require authentication. You can configure authentication in several ways:

### API Key Authentication

```python
from qanswer_sdk import Configuration, ApiClient
from qanswer_sdk.api.chatbot_api import ChatbotApi

# Configure API key authorization
config = Configuration(
    host="https://app.qanswer.ai/backend",
    api_key={"QAnswer-Api-Key": "your-api-key-here"}
)

# Initialize client
with ApiClient(config) as client:
    api = ChatbotApi(client)
    # Use the API...
```

### Bearer Token Authentication

```python
from qanswer_sdk import Configuration, ApiClient
from qanswer_sdk.api.chatbot_api import ChatbotApi

# Configure Bearer token authorization
config = Configuration(
    host="https://app.qanswer.ai/backend",
    access_token="your-jwt-token-here"
)

# Initialize client
with ApiClient(config) as client:
    api = ChatbotApi(client)
    # Use the API...
```

---

## 📖 Usage Examples

### Chatbot API

```python
from qanswer_sdk import Configuration, ApiClient
from qanswer_sdk.api.chatbot_api import ChatbotApi
from qanswer_sdk.models.chatbot_chat_payload import ChatbotChatPayload

config = Configuration(
    host="https://app.qanswer.ai/backend",
    api_key={"QAnswer-Api-Key": "your-api-key"}
)

with ApiClient(config) as client:
    api = ChatbotApi(client)
    
    # Create chat payload
    payload = ChatbotChatPayload(
        question="What is artificial intelligence?",
        username="admin",
        conversation_id="df150332-97c2-4b6a-9d83-cd35e14cf89c",
        llm_choice="openai-large"
        # Add other required fields based on your model
    )
    
    # Send chat message
    response = api.free_text_chatbot_chat(payload)
    print(response.ai_response)  # Access response data
```

### Chat Completion API

```python
from qanswer_sdk.api.chat_completion_api import ChatCompletionApi

with ApiClient(config) as client:
    api = ChatCompletionApi(client)
    # Use chat completion endpoints...
```

### Handle Different Response Types

```python
# Get just the data
response_data = api.free_text_chatbot_chat(payload)

# Get full HTTP response info
full_response = api.free_text_chatbot_chat_with_http_info(payload)
print(full_response.status_code)
print(full_response.headers)
print(full_response.data)

# Get raw HTTP response for streaming
raw_response = api.free_text_chatbot_chat_without_preload_content(payload)
```

---

## ⚙️ Configuration Options

```python
from qanswer_sdk import Configuration

config = Configuration(
    host="https://app.qanswer.ai/backend",  # API base URL
    api_key={"QAnswer-Api-Key": "your-key"},  # API key auth
    access_token="jwt-token",  # Bearer token auth
    username="user",  # Basic auth username
    password="pass",  # Basic auth password
    verify_ssl=True,  # SSL verification
    ssl_ca_cert="/path/to/ca.pem",  # Custom CA certificate
    connection_pool_maxsize=10,  # Connection pool size
    retries=3,  # Number of retries
    debug=False,  # Enable debug logging
    proxy="http://proxy:8080"  # Proxy URL
)
```
---

## 🛠 Error Handling

```python
from qanswer_sdk.exceptions import (
    ApiException, 
    BadRequestException,
    UnauthorizedException,
    NotFoundException
)

try:
    response = api.free_text_chatbot_chat(payload)
except UnauthorizedException:
    print("Invalid authentication credentials")
except BadRequestException as e:
    print(f"Bad request: {e}")
except ApiException as e:
    print(f"API error: {e.status} - {e.reason}")
```
---

## 📝 Models and Type Safety

All request and response objects are Pydantic models with full type safety:

```python
from qanswer_sdk.models.chatbot_chat_payload import ChatbotChatPayload
from qanswer_sdk.models.chatbot_response import ChatbotResponse

# Create typed request payload
payload = ChatbotChatPayload(
    message="Hello",
    # IDE will provide autocomplete for available fields
)

# Response is fully typed
response: ChatbotResponse = api.free_text_chatbot_chat(payload)
# Access typed response fields with autocomplete
print(response.answer)
```

---

## 📌 Versioning

This SDK follows the version of the QAnswer API.
The current version is: `3.1335.0 (branch: main)`

---

## 🤝 Support

For issues related to:

- **SDK usage:** Open an issue in this repository
- **API functionality:** Contact QAnswer support
- **Authentication:** Check your API key and permissions

---

## 📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

---

## Made with ❤️ by The QA Company
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/GIT_USER_ID/GIT_REPO_ID",
    "name": "qanswer_sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "OpenAPI, OpenAPI-Generator, QAnswer: Api Documentation",
    "author": "OpenAPI Generator Community",
    "author_email": "team@openapitools.org",
    "download_url": "https://files.pythonhosted.org/packages/67/7b/5aac2403a900316010986be24c3e79979aa20896b523023e23e34ab870a5/qanswer_sdk-3.1335.0.tar.gz",
    "platform": null,
    "description": "# QAnswer Python SDK\n\n[![PyPI version](https://badge.fury.io/py/qanswer-sdk.svg)](https://pypi.org/project/qanswer-sdk/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/qanswer-sdk.svg)](https://pypi.org/project/qanswer-sdk/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\nOfficial **Python SDK** for the [QAnswer API](https://qanswer.eu), automatically generated from the OpenAPI specification.\n\nThis SDK allows Python applications to interact with QAnswer's services programmatically without needing to craft raw HTTP requests.\n\n---\n\n## \ud83d\ude80 Features\n\n- Full coverage of QAnswer API endpoints  \n- Type-safe models via [Pydantic](https://docs.pydantic.dev)  \n- Easy configuration of authentication and base URL  \n- Auto-generated and versioned with each API release  \n\n---\n\n## \ud83d\udce6 Installation\n\nYou can install from [PyPI](https://pypi.org/project/qanswer-sdk/):\n\n```bash\npip install qanswer-sdk\n```\n\n\nOr add it to your `requirements.txt`\n\n```txt\nqanswer-sdk==3.1184.0\n```\n\n---\n\n## \ud83d\udd11 Authentication\n\nMost endpoints require authentication. You can configure authentication in several ways:\n\n### API Key Authentication\n\n```python\nfrom qanswer_sdk import Configuration, ApiClient\nfrom qanswer_sdk.api.chatbot_api import ChatbotApi\n\n# Configure API key authorization\nconfig = Configuration(\n    host=\"https://app.qanswer.ai/backend\",\n    api_key={\"QAnswer-Api-Key\": \"your-api-key-here\"}\n)\n\n# Initialize client\nwith ApiClient(config) as client:\n    api = ChatbotApi(client)\n    # Use the API...\n```\n\n### Bearer Token Authentication\n\n```python\nfrom qanswer_sdk import Configuration, ApiClient\nfrom qanswer_sdk.api.chatbot_api import ChatbotApi\n\n# Configure Bearer token authorization\nconfig = Configuration(\n    host=\"https://app.qanswer.ai/backend\",\n    access_token=\"your-jwt-token-here\"\n)\n\n# Initialize client\nwith ApiClient(config) as client:\n    api = ChatbotApi(client)\n    # Use the API...\n```\n\n---\n\n## \ud83d\udcd6 Usage Examples\n\n### Chatbot API\n\n```python\nfrom qanswer_sdk import Configuration, ApiClient\nfrom qanswer_sdk.api.chatbot_api import ChatbotApi\nfrom qanswer_sdk.models.chatbot_chat_payload import ChatbotChatPayload\n\nconfig = Configuration(\n    host=\"https://app.qanswer.ai/backend\",\n    api_key={\"QAnswer-Api-Key\": \"your-api-key\"}\n)\n\nwith ApiClient(config) as client:\n    api = ChatbotApi(client)\n    \n    # Create chat payload\n    payload = ChatbotChatPayload(\n        question=\"What is artificial intelligence?\",\n        username=\"admin\",\n        conversation_id=\"df150332-97c2-4b6a-9d83-cd35e14cf89c\",\n        llm_choice=\"openai-large\"\n        # Add other required fields based on your model\n    )\n    \n    # Send chat message\n    response = api.free_text_chatbot_chat(payload)\n    print(response.ai_response)  # Access response data\n```\n\n### Chat Completion API\n\n```python\nfrom qanswer_sdk.api.chat_completion_api import ChatCompletionApi\n\nwith ApiClient(config) as client:\n    api = ChatCompletionApi(client)\n    # Use chat completion endpoints...\n```\n\n### Handle Different Response Types\n\n```python\n# Get just the data\nresponse_data = api.free_text_chatbot_chat(payload)\n\n# Get full HTTP response info\nfull_response = api.free_text_chatbot_chat_with_http_info(payload)\nprint(full_response.status_code)\nprint(full_response.headers)\nprint(full_response.data)\n\n# Get raw HTTP response for streaming\nraw_response = api.free_text_chatbot_chat_without_preload_content(payload)\n```\n\n---\n\n## \u2699\ufe0f Configuration Options\n\n```python\nfrom qanswer_sdk import Configuration\n\nconfig = Configuration(\n    host=\"https://app.qanswer.ai/backend\",  # API base URL\n    api_key={\"QAnswer-Api-Key\": \"your-key\"},  # API key auth\n    access_token=\"jwt-token\",  # Bearer token auth\n    username=\"user\",  # Basic auth username\n    password=\"pass\",  # Basic auth password\n    verify_ssl=True,  # SSL verification\n    ssl_ca_cert=\"/path/to/ca.pem\",  # Custom CA certificate\n    connection_pool_maxsize=10,  # Connection pool size\n    retries=3,  # Number of retries\n    debug=False,  # Enable debug logging\n    proxy=\"http://proxy:8080\"  # Proxy URL\n)\n```\n---\n\n## \ud83d\udee0 Error Handling\n\n```python\nfrom qanswer_sdk.exceptions import (\n    ApiException, \n    BadRequestException,\n    UnauthorizedException,\n    NotFoundException\n)\n\ntry:\n    response = api.free_text_chatbot_chat(payload)\nexcept UnauthorizedException:\n    print(\"Invalid authentication credentials\")\nexcept BadRequestException as e:\n    print(f\"Bad request: {e}\")\nexcept ApiException as e:\n    print(f\"API error: {e.status} - {e.reason}\")\n```\n---\n\n## \ud83d\udcdd Models and Type Safety\n\nAll request and response objects are Pydantic models with full type safety:\n\n```python\nfrom qanswer_sdk.models.chatbot_chat_payload import ChatbotChatPayload\nfrom qanswer_sdk.models.chatbot_response import ChatbotResponse\n\n# Create typed request payload\npayload = ChatbotChatPayload(\n    message=\"Hello\",\n    # IDE will provide autocomplete for available fields\n)\n\n# Response is fully typed\nresponse: ChatbotResponse = api.free_text_chatbot_chat(payload)\n# Access typed response fields with autocomplete\nprint(response.answer)\n```\n\n---\n\n## \ud83d\udccc Versioning\n\nThis SDK follows the version of the QAnswer API.\nThe current version is: `3.1335.0 (branch: main)`\n\n---\n\n## \ud83e\udd1d Support\n\nFor issues related to:\n\n- **SDK usage:** Open an issue in this repository\n- **API functionality:** Contact QAnswer support\n- **Authentication:** Check your API key and permissions\n\n---\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n---\n\n## Made with \u2764\ufe0f by The QA Company",
    "bugtrack_url": null,
    "license": "NoLicense",
    "summary": "QAnswer: Api Documentation",
    "version": "3.1335.0",
    "project_urls": {
        "Homepage": "https://github.com/GIT_USER_ID/GIT_REPO_ID",
        "Repository": "https://github.com/GIT_USER_ID/GIT_REPO_ID"
    },
    "split_keywords": [
        "openapi",
        " openapi-generator",
        " qanswer: api documentation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "72ed190ae7cf48650564bc144a216716f1b724c2ce417212e0fe7d1207323e0c",
                "md5": "909509d50d9f09dd55f50c293d6c2a10",
                "sha256": "48826a24a5dd5bd7a7eb883abed8c9cd59b744c62aa559c62219bafa8fd50a6c"
            },
            "downloads": -1,
            "filename": "qanswer_sdk-3.1335.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "909509d50d9f09dd55f50c293d6c2a10",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 691184,
            "upload_time": "2025-11-01T20:21:57",
            "upload_time_iso_8601": "2025-11-01T20:21:57.150424Z",
            "url": "https://files.pythonhosted.org/packages/72/ed/190ae7cf48650564bc144a216716f1b724c2ce417212e0fe7d1207323e0c/qanswer_sdk-3.1335.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "677b5aac2403a900316010986be24c3e79979aa20896b523023e23e34ab870a5",
                "md5": "1b41d265428ee959e1d1d493c1c83100",
                "sha256": "90c590d1f798e9875ca44c3ff006b712f3b37f4d33c497814102cf942e4ea4db"
            },
            "downloads": -1,
            "filename": "qanswer_sdk-3.1335.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1b41d265428ee959e1d1d493c1c83100",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 226023,
            "upload_time": "2025-11-01T20:21:58",
            "upload_time_iso_8601": "2025-11-01T20:21:58.839384Z",
            "url": "https://files.pythonhosted.org/packages/67/7b/5aac2403a900316010986be24c3e79979aa20896b523023e23e34ab870a5/qanswer_sdk-3.1335.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-01 20:21:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "GIT_USER_ID",
    "github_project": "GIT_REPO_ID",
    "github_not_found": true,
    "lcname": "qanswer_sdk"
}
        
Elapsed time: 2.29714s