kiss-ai-stack-core


Namekiss-ai-stack-core JSON
Version 0.1.0a14 PyPI version JSON
download
home_pageNone
SummaryKISS AI Stack's AI Agent Builder - Simplify AI Agent Development
upload_time2024-12-16 06:33:22
maintainerNone
docs_urlNone
authorKISS AI Stack, Lahiru Pathirage
requires_python>=3.12
licenseMIT
keywords ai agent machine-learning llm document-processing
VCS
bugtrack_url
requirements aiofiles asyncio PyYAML pydantic setuptools unstructured unstructured unstructured unstructured unstructured tiktoken tokenizers pandas
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div style="text-align: left; margin-bottom: 20px;">
  <img src="https://kiss-ai-stack.github.io/kissaistack.svg" alt="KISS AI Stack Banner" style="max-width: auto; height: 250px">
</div>

# KISS AI Stack - Core

**Effortless AI Agent Building**

Welcome to the core of the **KISS AI Stack**! This module helps you build an AI agent effortlessly using a simple YAML configuration file. Say goodbye to boilerplate code and embrace minimalism with the **KISS principle** (Keep It Simple, Stupid).

---

## Features

- **Centralized Agent Management**: Manage multiple session-based AI agents with lifecycle support.
- **Minimal Dependencies**: Built using simple, vanilla vendor libraries.
- **Tool Classification**: Configure tools for your agent to handle specific tasks easily.
- **Supports RAG and Prompt-Based Models**: Choose the model type that suits your needs.
- **Thread-Safe**: Reliable operation in multi-threaded environments.

---

## Installation

Install the core module using pip:

```bash
pip install kiss-ai-stack-core
```

---

## Example Configuration

Here’s an example YAML configuration to set up an AI agent with different tools:

```yaml
agent:
  decision_maker: # Required for tool classification
    name: decision_maker
    role: classify tools for given queries
    kind: prompt  # Choose from 'rag' or 'prompt'
    ai_client:
      provider: openai
      model: gpt-4
      api_key: <your-api-key>

  tools:
    - name: general_queries
      role: process other queries if no suitable tool is found.
      kind: prompt
      ai_client:
        provider: openai
        model: gpt-4
        api_key: <your-api-key>

    - name: document_tool
      role: process documents and provide answers based on them.
      kind: rag  # Retrieval-Augmented Generation
      embeddings: text-embedding-ada-002
      ai_client:
        provider: openai
        model: gpt-4
        api_key: <your-api-key>

  vector_db:
    provider: chroma
    kind: remote # Choose in-memory, storage or remote options.
    host: 0.0.0.0
    port: 8000
    secure: false
```

---

## Example Python Usage

Use the core module to build and interact with your AI agent:

```python
from kiss_ai_stack import AgentStack

async def main():
    try:
        # Initialize an agent in the stack
        await AgentStack.bootstrap_agent(agent_id="my_agent", temporary=True)

        # Process a query
        response = await AgentStack.generate_answer(agent_id="my_agent", query="What is KISS AI Stack?")
        print(response.answer)

    except Exception as ex:
        print(f"An error occurred: {ex}")

# Run the example
import asyncio
asyncio.run(main())
```

---

## How It Works

1. **Agent Initialization**: Use `AgentStack.bootstrap_agent` to initialize agents with their configuration and resources.
2. **Query Processing**: Process queries with `AgentStack.generate_answer`, leveraging tools and AI clients defined in the YAML configuration.
3. **Tool Management**: Define tools to handle specific tasks like document processing or query classification.
4. **Vector Database**: Use the `vector_db` section to define how document embeddings are stored and retrieved for RAG-based tasks. Currently, `Chroma` is supported.

---

## Documentation

### Key Methods

- `bootstrap_agent(agent_id: str, temporary: bool)`: Initialize a new agent session.
- `generate_answer(agent_id: str, query: Union[str, Dict, List])`: Process a query and return a response.

### Configuration Highlights

- **AI Client**: Configure the provider, model, and API key for supported services like OpenAI.
- **Tools**: Define tools such as general-purpose query handlers or document processors.
- **Vector Database**: Set up in-memory or persistent storage for RAG-based tasks.

---

## Contributing

We welcome contributions! Submit pull requests or open issues to improve this stack.

---

## License

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


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "kiss-ai-stack-core",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.12",
    "maintainer_email": null,
    "keywords": "ai, agent, machine-learning, llm, document-processing",
    "author": "KISS AI Stack, Lahiru Pathirage",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/3f/14/f1655a9a361fb03ad9420544a06ef4071ab10e206b655bb82ebf3715a036/kiss_ai_stack_core-0.1.0a14.tar.gz",
    "platform": null,
    "description": "<div style=\"text-align: left; margin-bottom: 20px;\">\n  <img src=\"https://kiss-ai-stack.github.io/kissaistack.svg\" alt=\"KISS AI Stack Banner\" style=\"max-width: auto; height: 250px\">\n</div>\n\n# KISS AI Stack - Core\n\n**Effortless AI Agent Building**\n\nWelcome to the core of the **KISS AI Stack**! This module helps you build an AI agent effortlessly using a simple YAML configuration file. Say goodbye to boilerplate code and embrace minimalism with the **KISS principle** (Keep It Simple, Stupid).\n\n---\n\n## Features\n\n- **Centralized Agent Management**: Manage multiple session-based AI agents with lifecycle support.\n- **Minimal Dependencies**: Built using simple, vanilla vendor libraries.\n- **Tool Classification**: Configure tools for your agent to handle specific tasks easily.\n- **Supports RAG and Prompt-Based Models**: Choose the model type that suits your needs.\n- **Thread-Safe**: Reliable operation in multi-threaded environments.\n\n---\n\n## Installation\n\nInstall the core module using pip:\n\n```bash\npip install kiss-ai-stack-core\n```\n\n---\n\n## Example Configuration\n\nHere\u2019s an example YAML configuration to set up an AI agent with different tools:\n\n```yaml\nagent:\n  decision_maker: # Required for tool classification\n    name: decision_maker\n    role: classify tools for given queries\n    kind: prompt  # Choose from 'rag' or 'prompt'\n    ai_client:\n      provider: openai\n      model: gpt-4\n      api_key: <your-api-key>\n\n  tools:\n    - name: general_queries\n      role: process other queries if no suitable tool is found.\n      kind: prompt\n      ai_client:\n        provider: openai\n        model: gpt-4\n        api_key: <your-api-key>\n\n    - name: document_tool\n      role: process documents and provide answers based on them.\n      kind: rag  # Retrieval-Augmented Generation\n      embeddings: text-embedding-ada-002\n      ai_client:\n        provider: openai\n        model: gpt-4\n        api_key: <your-api-key>\n\n  vector_db:\n    provider: chroma\n    kind: remote # Choose in-memory, storage or remote options.\n    host: 0.0.0.0\n    port: 8000\n    secure: false\n```\n\n---\n\n## Example Python Usage\n\nUse the core module to build and interact with your AI agent:\n\n```python\nfrom kiss_ai_stack import AgentStack\n\nasync def main():\n    try:\n        # Initialize an agent in the stack\n        await AgentStack.bootstrap_agent(agent_id=\"my_agent\", temporary=True)\n\n        # Process a query\n        response = await AgentStack.generate_answer(agent_id=\"my_agent\", query=\"What is KISS AI Stack?\")\n        print(response.answer)\n\n    except Exception as ex:\n        print(f\"An error occurred: {ex}\")\n\n# Run the example\nimport asyncio\nasyncio.run(main())\n```\n\n---\n\n## How It Works\n\n1. **Agent Initialization**: Use `AgentStack.bootstrap_agent` to initialize agents with their configuration and resources.\n2. **Query Processing**: Process queries with `AgentStack.generate_answer`, leveraging tools and AI clients defined in the YAML configuration.\n3. **Tool Management**: Define tools to handle specific tasks like document processing or query classification.\n4. **Vector Database**: Use the `vector_db` section to define how document embeddings are stored and retrieved for RAG-based tasks. Currently, `Chroma` is supported.\n\n---\n\n## Documentation\n\n### Key Methods\n\n- `bootstrap_agent(agent_id: str, temporary: bool)`: Initialize a new agent session.\n- `generate_answer(agent_id: str, query: Union[str, Dict, List])`: Process a query and return a response.\n\n### Configuration Highlights\n\n- **AI Client**: Configure the provider, model, and API key for supported services like OpenAI.\n- **Tools**: Define tools such as general-purpose query handlers or document processors.\n- **Vector Database**: Set up in-memory or persistent storage for RAG-based tasks.\n\n---\n\n## Contributing\n\nWe welcome contributions! Submit pull requests or open issues to improve this stack.\n\n---\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "KISS AI Stack's AI Agent Builder - Simplify AI Agent Development",
    "version": "0.1.0a14",
    "project_urls": {
        "Documentation": "https://github.com/kiss-ai-stack/kiss-ai-stack-core/main/README.md",
        "Homepage": "https://github.com/kiss-ai-stack",
        "Repository": "https://github.com/kiss-ai-stack"
    },
    "split_keywords": [
        "ai",
        " agent",
        " machine-learning",
        " llm",
        " document-processing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5e9cdf754ba227034953cc00848204a4f4f44207c983378a8f6e8a4cd7f6f581",
                "md5": "dbe4938894fd263e3847c05a09b13d21",
                "sha256": "63c9bd6e76912554cd445a4e6616a9423ce2f3997f7495e950a6e934538ee451"
            },
            "downloads": -1,
            "filename": "kiss_ai_stack_core-0.1.0a14-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dbe4938894fd263e3847c05a09b13d21",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.12",
            "size": 32919,
            "upload_time": "2024-12-16T06:33:17",
            "upload_time_iso_8601": "2024-12-16T06:33:17.644219Z",
            "url": "https://files.pythonhosted.org/packages/5e/9c/df754ba227034953cc00848204a4f4f44207c983378a8f6e8a4cd7f6f581/kiss_ai_stack_core-0.1.0a14-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3f14f1655a9a361fb03ad9420544a06ef4071ab10e206b655bb82ebf3715a036",
                "md5": "f1b05143361049352a0114250124439e",
                "sha256": "b4c586bb6d239147cc14fcea96b32c85c734bab9494788fae6e81064c004ec12"
            },
            "downloads": -1,
            "filename": "kiss_ai_stack_core-0.1.0a14.tar.gz",
            "has_sig": false,
            "md5_digest": "f1b05143361049352a0114250124439e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.12",
            "size": 24428,
            "upload_time": "2024-12-16T06:33:22",
            "upload_time_iso_8601": "2024-12-16T06:33:22.768420Z",
            "url": "https://files.pythonhosted.org/packages/3f/14/f1655a9a361fb03ad9420544a06ef4071ab10e206b655bb82ebf3715a036/kiss_ai_stack_core-0.1.0a14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-16 06:33:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "kiss-ai-stack",
    "github_project": "kiss-ai-stack-core",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "aiofiles",
            "specs": [
                [
                    "~=",
                    "24.1.0"
                ]
            ]
        },
        {
            "name": "asyncio",
            "specs": [
                [
                    "~=",
                    "3.4.3"
                ]
            ]
        },
        {
            "name": "PyYAML",
            "specs": [
                [
                    "~=",
                    "6.0.2"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    "~=",
                    "2.10.3"
                ]
            ]
        },
        {
            "name": "setuptools",
            "specs": [
                [
                    "~=",
                    "75.6.0"
                ]
            ]
        },
        {
            "name": "unstructured",
            "specs": [
                [
                    "~=",
                    "0.16.8"
                ]
            ]
        },
        {
            "name": "unstructured",
            "specs": [
                [
                    "~=",
                    "0.16.8"
                ]
            ]
        },
        {
            "name": "unstructured",
            "specs": [
                [
                    "~=",
                    "0.16.8"
                ]
            ]
        },
        {
            "name": "unstructured",
            "specs": [
                [
                    "~=",
                    "0.16.8"
                ]
            ]
        },
        {
            "name": "unstructured",
            "specs": [
                [
                    "~=",
                    "0.16.8"
                ]
            ]
        },
        {
            "name": "tiktoken",
            "specs": [
                [
                    "~=",
                    "0.8.0"
                ]
            ]
        },
        {
            "name": "tokenizers",
            "specs": [
                [
                    "~=",
                    "0.20.3"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    "~=",
                    "2.2.3"
                ]
            ]
        }
    ],
    "lcname": "kiss-ai-stack-core"
}
        
Elapsed time: 0.42198s