aisearchapi-client


Nameaisearchapi-client JSON
Version 1.0.8 PyPI version JSON
download
home_pageNone
SummaryPython client library for AI Search API - search and retrieve intelligent responses with context awareness
upload_time2025-08-30 20:15:31
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2025 aisearchapi 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 langchain langchain-integration langchain-extension langchain-tools aisearchapi ai search api semantic search web search api search api summarization api summary api contextual ai contextual search ai agents intelligent agents llm large language models chat models ai chatbot nlp research chain fact checking question answering automation python ai
VCS
bugtrack_url
requirements requests typing-extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # AI Search API Python Client

[![PyPI version](https://badge.fury.io/py/aisearchapi-client.svg)](https://badge.fury.io/py/aisearchapi-client)
[![Python Support](https://img.shields.io/pypi/pyversions/aisearchapi-client.svg)](https://pypi.org/project/aisearchapi-client/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A **Python client library for the [AI Search API](https://aisearchapi.io?utm_source=pypi)** that provides **semantic search, contextual awareness, and intelligent AI-powered results**.  
This package makes it easy for developers to integrate the [AI Search API](https://docs.aisearchapi.io/) into Python projects.

👉 To start, get your **free API key** from the [AI Search API dashboard](https://app.aisearchapi.io/dashboard).

---

## Features

- **🔍 AI-Powered Semantic Search**: Natural language search powered by embeddings  
- **🎯 Context Awareness**: Include history for smarter results  
- **⚡ Simple API Client**: Clean Python interface with error handling  
- **🛡️ Type Safety**: Strong type hints  
- **🔄 Flexible Output**: Get text or markdown results  
- **💰 Usage Tracking**: Monitor your [API credit balance](https://app.aisearchapi.io/dashboard) anytime

---

## Installation

Install from [PyPI](https://pypi.org/project/aisearchapi-client/):

```bash
pip install aisearchapi-client
```

Or install from source:

```bash
git clone https://github.com/aisearchapi/aisearchapi-python.git
cd aisearchapi-python
pip install -e .
```

---

## Quick Start

### Get Your API Key

1. Sign up at [aisearchapi.io](https://aisearchapi.io?utm_source=pypi).  
2. Log in to the [dashboard](https://app.aisearchapi.io/login).  
3. Copy your API key.  

Use this key when creating a client:

```python
from aisearchapi_client import AISearchAPIClient

client = AISearchAPIClient(api_key="your-api-key-here")
```

### Basic Usage Example

```python
from aisearchapi_client import AISearchAPIClient

client = AISearchAPIClient(api_key="your-api-key-here")

result = client.search(
    prompt="What is machine learning and how does it work?",
    response_type="markdown"
)

print("Answer:", result.answer)
print("Sources:", result.sources)
print(f"Total time: {result.total_time}ms")

balance = client.balance()
print(f"Available credits: {balance.available_credits}")
client.close()
```

---

## Advanced Usage

### Contextual Search

```python
from aisearchapi_client import AISearchAPIClient, ChatMessage

with AISearchAPIClient(api_key="your-api-key-here") as client:
    result = client.search(
        prompt="What are the main advantages and disadvantages?",
        context=[
            ChatMessage(role="user", content="I am researching solar energy for my home"),
            ChatMessage(role="user", content="I live in a sunny climate with high electricity costs")
        ],
        response_type="text"
    )
    print("Contextual Answer:", result.answer)
```

### Custom Configuration

```python
client = AISearchAPIClient(
    api_key="your-api-key-here",
    base_url="https://api.aisearchapi.io",
    timeout=60
)
```

---

## API Reference

Full API reference is available in the [official documentation](https://docs.aisearchapi.io/).

---

## Error Handling

```python
from aisearchapi_client import AISearchAPIClient, AISearchAPIError

try:
    with AISearchAPIClient(api_key="your-api-key") as client:
        result = client.search(prompt="Your query")
        print(result.answer)
except AISearchAPIError as e:
    print(f"API Error [{e.status_code}]: {e.description}")
```

---

## Environment Variables

```bash
export AI_SEARCH_API_KEY="your-api-key-here"
```

Then use in Python:

```python
import os
from aisearchapi_client import AISearchAPIClient

api_key = os.getenv("AI_SEARCH_API_KEY")
client = AISearchAPIClient(api_key=api_key)
```

---

## Development

```bash
git clone https://github.com/aisearchapi/aisearchapi-python.git
cd aisearchapi-python
python -m venv venv
source venv/bin/activate
pip install -e ".[dev,test]"
pytest
```

---

## License

MIT License - see the [LICENSE](https://github.com/aisearchapi/aisearchapi-python/blob/main/LICENSE) file.

---

## Support

- **Get API Key**: [AI Search API Dashboard](https://app.aisearchapi.io/dashboard)  
- **Documentation**: [docs.aisearchapi.io](https://docs.aisearchapi.io/)  
- **Homepage**: [aisearchapi.io](https://aisearchapi.io?utm_source=pypi)  
- **Issues**: [GitHub Issues](https://github.com/aisearchapi/aisearchapi-python/issues)  

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "aisearchapi-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "AI Search API <admin@aisearchapi.io>",
    "keywords": "langchain, langchain-integration, langchain-extension, langchain-tools, aisearchapi, ai search api, semantic search, web search api, search api, summarization api, summary api, contextual ai, contextual search, ai agents, intelligent agents, llm, large language models, chat models, ai chatbot, nlp, research chain, fact checking, question answering, automation, python ai",
    "author": null,
    "author_email": "AI Search API <admin@aisearchapi.io>",
    "download_url": "https://files.pythonhosted.org/packages/b2/15/86415f89df2b66391be0361ad6e03a2c15b21ef7d45c1771c439f1b56d72/aisearchapi_client-1.0.8.tar.gz",
    "platform": null,
    "description": "# AI Search API Python Client\r\n\r\n[![PyPI version](https://badge.fury.io/py/aisearchapi-client.svg)](https://badge.fury.io/py/aisearchapi-client)\r\n[![Python Support](https://img.shields.io/pypi/pyversions/aisearchapi-client.svg)](https://pypi.org/project/aisearchapi-client/)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\nA **Python client library for the [AI Search API](https://aisearchapi.io?utm_source=pypi)** that provides **semantic search, contextual awareness, and intelligent AI-powered results**.  \r\nThis package makes it easy for developers to integrate the [AI Search API](https://docs.aisearchapi.io/) into Python projects.\r\n\r\n\ud83d\udc49 To start, get your **free API key** from the [AI Search API dashboard](https://app.aisearchapi.io/dashboard).\r\n\r\n---\r\n\r\n## Features\r\n\r\n- **\ud83d\udd0d AI-Powered Semantic Search**: Natural language search powered by embeddings  \r\n- **\ud83c\udfaf Context Awareness**: Include history for smarter results  \r\n- **\u26a1 Simple API Client**: Clean Python interface with error handling  \r\n- **\ud83d\udee1\ufe0f Type Safety**: Strong type hints  \r\n- **\ud83d\udd04 Flexible Output**: Get text or markdown results  \r\n- **\ud83d\udcb0 Usage Tracking**: Monitor your [API credit balance](https://app.aisearchapi.io/dashboard) anytime\r\n\r\n---\r\n\r\n## Installation\r\n\r\nInstall from [PyPI](https://pypi.org/project/aisearchapi-client/):\r\n\r\n```bash\r\npip install aisearchapi-client\r\n```\r\n\r\nOr install from source:\r\n\r\n```bash\r\ngit clone https://github.com/aisearchapi/aisearchapi-python.git\r\ncd aisearchapi-python\r\npip install -e .\r\n```\r\n\r\n---\r\n\r\n## Quick Start\r\n\r\n### Get Your API Key\r\n\r\n1. Sign up at [aisearchapi.io](https://aisearchapi.io?utm_source=pypi).  \r\n2. Log in to the [dashboard](https://app.aisearchapi.io/login).  \r\n3. Copy your API key.  \r\n\r\nUse this key when creating a client:\r\n\r\n```python\r\nfrom aisearchapi_client import AISearchAPIClient\r\n\r\nclient = AISearchAPIClient(api_key=\"your-api-key-here\")\r\n```\r\n\r\n### Basic Usage Example\r\n\r\n```python\r\nfrom aisearchapi_client import AISearchAPIClient\r\n\r\nclient = AISearchAPIClient(api_key=\"your-api-key-here\")\r\n\r\nresult = client.search(\r\n    prompt=\"What is machine learning and how does it work?\",\r\n    response_type=\"markdown\"\r\n)\r\n\r\nprint(\"Answer:\", result.answer)\r\nprint(\"Sources:\", result.sources)\r\nprint(f\"Total time: {result.total_time}ms\")\r\n\r\nbalance = client.balance()\r\nprint(f\"Available credits: {balance.available_credits}\")\r\nclient.close()\r\n```\r\n\r\n---\r\n\r\n## Advanced Usage\r\n\r\n### Contextual Search\r\n\r\n```python\r\nfrom aisearchapi_client import AISearchAPIClient, ChatMessage\r\n\r\nwith AISearchAPIClient(api_key=\"your-api-key-here\") as client:\r\n    result = client.search(\r\n        prompt=\"What are the main advantages and disadvantages?\",\r\n        context=[\r\n            ChatMessage(role=\"user\", content=\"I am researching solar energy for my home\"),\r\n            ChatMessage(role=\"user\", content=\"I live in a sunny climate with high electricity costs\")\r\n        ],\r\n        response_type=\"text\"\r\n    )\r\n    print(\"Contextual Answer:\", result.answer)\r\n```\r\n\r\n### Custom Configuration\r\n\r\n```python\r\nclient = AISearchAPIClient(\r\n    api_key=\"your-api-key-here\",\r\n    base_url=\"https://api.aisearchapi.io\",\r\n    timeout=60\r\n)\r\n```\r\n\r\n---\r\n\r\n## API Reference\r\n\r\nFull API reference is available in the [official documentation](https://docs.aisearchapi.io/).\r\n\r\n---\r\n\r\n## Error Handling\r\n\r\n```python\r\nfrom aisearchapi_client import AISearchAPIClient, AISearchAPIError\r\n\r\ntry:\r\n    with AISearchAPIClient(api_key=\"your-api-key\") as client:\r\n        result = client.search(prompt=\"Your query\")\r\n        print(result.answer)\r\nexcept AISearchAPIError as e:\r\n    print(f\"API Error [{e.status_code}]: {e.description}\")\r\n```\r\n\r\n---\r\n\r\n## Environment Variables\r\n\r\n```bash\r\nexport AI_SEARCH_API_KEY=\"your-api-key-here\"\r\n```\r\n\r\nThen use in Python:\r\n\r\n```python\r\nimport os\r\nfrom aisearchapi_client import AISearchAPIClient\r\n\r\napi_key = os.getenv(\"AI_SEARCH_API_KEY\")\r\nclient = AISearchAPIClient(api_key=api_key)\r\n```\r\n\r\n---\r\n\r\n## Development\r\n\r\n```bash\r\ngit clone https://github.com/aisearchapi/aisearchapi-python.git\r\ncd aisearchapi-python\r\npython -m venv venv\r\nsource venv/bin/activate\r\npip install -e \".[dev,test]\"\r\npytest\r\n```\r\n\r\n---\r\n\r\n## License\r\n\r\nMIT License - see the [LICENSE](https://github.com/aisearchapi/aisearchapi-python/blob/main/LICENSE) file.\r\n\r\n---\r\n\r\n## Support\r\n\r\n- **Get API Key**: [AI Search API Dashboard](https://app.aisearchapi.io/dashboard)  \r\n- **Documentation**: [docs.aisearchapi.io](https://docs.aisearchapi.io/)  \r\n- **Homepage**: [aisearchapi.io](https://aisearchapi.io?utm_source=pypi)  \r\n- **Issues**: [GitHub Issues](https://github.com/aisearchapi/aisearchapi-python/issues)  \r\n",
    "bugtrack_url": null,
    "license": "MIT License\r\n        \r\n        Copyright (c) 2025 aisearchapi\r\n        \r\n        Permission is hereby granted, free of charge, to any person obtaining a copy\r\n        of this software and associated documentation files (the \"Software\"), to deal\r\n        in the Software without restriction, including without limitation the rights\r\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n        copies of the Software, and to permit persons to whom the Software is\r\n        furnished to do so, subject to the following conditions:\r\n        \r\n        The above copyright notice and this permission notice shall be included in all\r\n        copies or substantial portions of the Software.\r\n        \r\n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n        SOFTWARE.",
    "summary": "Python client library for AI Search API - search and retrieve intelligent responses with context awareness",
    "version": "1.0.8",
    "project_urls": {
        "Changelog": "https://github.com/aisearchapi/aisearchapi-python/blob/main/CHANGELOG.md",
        "Documentation": "https://aisearchapi.readthedocs.io/",
        "Homepage": "https://github.com/aisearchapi/aisearchapi-python",
        "Issues": "https://github.com/aisearchapi/aisearchapi-python/issues",
        "Repository": "https://github.com/aisearchapi/aisearchapi-python"
    },
    "split_keywords": [
        "langchain",
        " langchain-integration",
        " langchain-extension",
        " langchain-tools",
        " aisearchapi",
        " ai search api",
        " semantic search",
        " web search api",
        " search api",
        " summarization api",
        " summary api",
        " contextual ai",
        " contextual search",
        " ai agents",
        " intelligent agents",
        " llm",
        " large language models",
        " chat models",
        " ai chatbot",
        " nlp",
        " research chain",
        " fact checking",
        " question answering",
        " automation",
        " python ai"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "76e3155766871afda8f4dc1c95d961dc631ddd5033b1fa9cbaaa776d0085ef3c",
                "md5": "253f592897f9343cada3072b0caaf39d",
                "sha256": "3bc0586a8fb9c3d8266a3960993bec9a7124959ec2b97242e22c5e2c8fda7b5d"
            },
            "downloads": -1,
            "filename": "aisearchapi_client-1.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "253f592897f9343cada3072b0caaf39d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9465,
            "upload_time": "2025-08-30T20:15:30",
            "upload_time_iso_8601": "2025-08-30T20:15:30.696288Z",
            "url": "https://files.pythonhosted.org/packages/76/e3/155766871afda8f4dc1c95d961dc631ddd5033b1fa9cbaaa776d0085ef3c/aisearchapi_client-1.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b21586415f89df2b66391be0361ad6e03a2c15b21ef7d45c1771c439f1b56d72",
                "md5": "5dd8eb52b03a18b4130ea57dfb7aff07",
                "sha256": "1e5a65bbdb717edb0bb1e790fa13f8ea56b8a8767eb0df54c1e667aa72d8a23a"
            },
            "downloads": -1,
            "filename": "aisearchapi_client-1.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "5dd8eb52b03a18b4130ea57dfb7aff07",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11668,
            "upload_time": "2025-08-30T20:15:31",
            "upload_time_iso_8601": "2025-08-30T20:15:31.720004Z",
            "url": "https://files.pythonhosted.org/packages/b2/15/86415f89df2b66391be0361ad6e03a2c15b21ef7d45c1771c439f1b56d72/aisearchapi_client-1.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-30 20:15:31",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aisearchapi",
    "github_project": "aisearchapi-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "requests",
            "specs": [
                [
                    ">=",
                    "2.25.0"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    ">=",
                    "4.0.0"
                ]
            ]
        }
    ],
    "lcname": "aisearchapi-client"
}
        
Elapsed time: 2.83624s