outlines-haystack


Nameoutlines-haystack JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryUse `outlines` generators with Haystack.
upload_time2024-12-17 00:36:46
maintainerNone
docs_urlNone
authorEdoardo Abati
requires_python<3.13,>=3.9
licenseMIT License Copyright (c) 2024-present Edoardo Abati 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 ai generative-ai haystack llm machine-learning nlp outlines structured-generation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # `outlines-haystack`

[![PyPI - Version](https://img.shields.io/pypi/v/outlines-haystack.svg)](https://pypi.org/project/outlines-haystack)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/outlines-haystack.svg)](https://pypi.org/project/outlines-haystack)
[![PyPI - License](https://img.shields.io/pypi/l/outlines-haystack)](https://pypi.org/project/outlines-haystack)


[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

[![GH Actions Tests](https://github.com/EdAbati/outlines-haystack/actions/workflows/test.yml/badge.svg)](https://github.com/EdAbati/outlines-haystack/actions/workflows/test.yml)
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/EdAbati/outlines-haystack/main.svg)](https://results.pre-commit.ci/latest/github/EdAbati/outlines-haystack/main)

-----

## Table of Contents

- [🛠️ Installation](#installation)
- [📃 Description](#description)
- [💻 Usage](#usage)

## 🛠️ Installation

```console
pip install outlines-haystack
```

## 📃 Description

> Outlines is a Python library that allows you to use Large Language Model in a simple and robust way (with structured generation).  It is built by [.txt](https://dottxt.co).
>
> -- <cite>[Outlines docs](https://dottxt-ai.github.io/outlines/latest/welcome/)</cite>

This library allow you to use [`outlines`](https://dottxt-ai.github.io/outlines/latest/) generators in your [Haystack](https://haystack.deepset.ai) pipelines!

This library currently supports the following generators:
- [x] [Text](https://dottxt-ai.github.io/outlines/latest/reference/text/): _simply_ generate text
- [ ] [JSON](https://dottxt-ai.github.io/outlines/latest/reference/generation/json/): ⚠️ coming soon
- [ ] [Choices](https://dottxt-ai.github.io/outlines/latest/reference/generation/choices/): ⚠️ coming soon
- [ ] [Regex](https://dottxt-ai.github.io/outlines/latest/reference/generation/regex/): ⚠️ coming soon
- [ ] [Format](https://dottxt-ai.github.io/outlines/latest/reference/generation/format/): ⚠️ coming soon
- [ ] [Grammar](https://dottxt-ai.github.io/outlines/latest/reference/generation/cfg/): ⚠️ coming soon

`outlines` supports a wide range of models and frameworks, we are currently supporting:
- [x] [OpenAI/Azure OpenAI](https://dottxt-ai.github.io/outlines/latest/reference/models/openai/)
- [x] [Transformers](https://dottxt-ai.github.io/outlines/latest/reference/models/transformers/)
- [x] [`mlx-lm`](https://dottxt-ai.github.io/outlines/latest/reference/models/mlxlm/)

## 💻 Usage

> [!TIP]
> See the [Example Notebooks](./notebooks) for complete examples.
>
> All below examples only use the `transformers` models.

### Text Generation

```python
>>> generator = TransformersTextGenerator(
...     model_name="microsoft/Phi-3-mini-4k-instruct",
...     device="cuda",
...     sampling_algorithm_kwargs={"temperature": 0.5},
... )
>>> generator.warm_up()
>>> generator.run(prompt="What is the capital of Italy?")
{'replies': ['\n\n# Answer\nThe capital of Italy is Rome.']}
```

## License

`outlines-haystack` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "outlines-haystack",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9",
    "maintainer_email": null,
    "keywords": "ai, generative-ai, haystack, llm, machine-learning, nlp, outlines, structured-generation",
    "author": "Edoardo Abati",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/de/a3/786f6b19001e2660cb56bfad648f0a5594886d39179b7275a2480b2b045a/outlines_haystack-0.0.2.tar.gz",
    "platform": null,
    "description": "# `outlines-haystack`\n\n[![PyPI - Version](https://img.shields.io/pypi/v/outlines-haystack.svg)](https://pypi.org/project/outlines-haystack)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/outlines-haystack.svg)](https://pypi.org/project/outlines-haystack)\n[![PyPI - License](https://img.shields.io/pypi/l/outlines-haystack)](https://pypi.org/project/outlines-haystack)\n\n\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n\n[![GH Actions Tests](https://github.com/EdAbati/outlines-haystack/actions/workflows/test.yml/badge.svg)](https://github.com/EdAbati/outlines-haystack/actions/workflows/test.yml)\n[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/EdAbati/outlines-haystack/main.svg)](https://results.pre-commit.ci/latest/github/EdAbati/outlines-haystack/main)\n\n-----\n\n## Table of Contents\n\n- [\ud83d\udee0\ufe0f Installation](#installation)\n- [\ud83d\udcc3 Description](#description)\n- [\ud83d\udcbb Usage](#usage)\n\n## \ud83d\udee0\ufe0f Installation\n\n```console\npip install outlines-haystack\n```\n\n## \ud83d\udcc3 Description\n\n> Outlines is a Python library that allows you to use Large Language Model in a simple and robust way (with structured generation).  It is built by [.txt](https://dottxt.co).\n>\n> -- <cite>[Outlines docs](https://dottxt-ai.github.io/outlines/latest/welcome/)</cite>\n\nThis library allow you to use [`outlines`](https://dottxt-ai.github.io/outlines/latest/) generators in your [Haystack](https://haystack.deepset.ai) pipelines!\n\nThis library currently supports the following generators:\n- [x] [Text](https://dottxt-ai.github.io/outlines/latest/reference/text/): _simply_ generate text\n- [ ] [JSON](https://dottxt-ai.github.io/outlines/latest/reference/generation/json/): \u26a0\ufe0f coming soon\n- [ ] [Choices](https://dottxt-ai.github.io/outlines/latest/reference/generation/choices/): \u26a0\ufe0f coming soon\n- [ ] [Regex](https://dottxt-ai.github.io/outlines/latest/reference/generation/regex/): \u26a0\ufe0f coming soon\n- [ ] [Format](https://dottxt-ai.github.io/outlines/latest/reference/generation/format/): \u26a0\ufe0f coming soon\n- [ ] [Grammar](https://dottxt-ai.github.io/outlines/latest/reference/generation/cfg/): \u26a0\ufe0f coming soon\n\n`outlines` supports a wide range of models and frameworks, we are currently supporting:\n- [x] [OpenAI/Azure OpenAI](https://dottxt-ai.github.io/outlines/latest/reference/models/openai/)\n- [x] [Transformers](https://dottxt-ai.github.io/outlines/latest/reference/models/transformers/)\n- [x] [`mlx-lm`](https://dottxt-ai.github.io/outlines/latest/reference/models/mlxlm/)\n\n## \ud83d\udcbb Usage\n\n> [!TIP]\n> See the [Example Notebooks](./notebooks) for complete examples.\n>\n> All below examples only use the `transformers` models.\n\n### Text Generation\n\n```python\n>>> generator = TransformersTextGenerator(\n...     model_name=\"microsoft/Phi-3-mini-4k-instruct\",\n...     device=\"cuda\",\n...     sampling_algorithm_kwargs={\"temperature\": 0.5},\n... )\n>>> generator.warm_up()\n>>> generator.run(prompt=\"What is the capital of Italy?\")\n{'replies': ['\\n\\n# Answer\\nThe capital of Italy is Rome.']}\n```\n\n## License\n\n`outlines-haystack` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024-present Edoardo Abati  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": "Use `outlines` generators with Haystack.",
    "version": "0.0.2",
    "project_urls": {
        "Documentation": "https://github.com/EdAbati/outlines-haystack#readme",
        "Issues": "https://github.com/EdAbati/outlines-haystack/issues",
        "Source": "https://github.com/EdAbati/outlines-haystack"
    },
    "split_keywords": [
        "ai",
        " generative-ai",
        " haystack",
        " llm",
        " machine-learning",
        " nlp",
        " outlines",
        " structured-generation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2436de3b6ae8d58312357e59deb70a63035d147ccd3e59bc4c9812e59f85d21f",
                "md5": "6676937cf2578e48fe5b25ee646bb411",
                "sha256": "7eb84acda57a5ebe3ef6f7bf63a4985c3f92b22973da04ecab77d872b9493486"
            },
            "downloads": -1,
            "filename": "outlines_haystack-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6676937cf2578e48fe5b25ee646bb411",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9",
            "size": 13385,
            "upload_time": "2024-12-17T00:36:45",
            "upload_time_iso_8601": "2024-12-17T00:36:45.237519Z",
            "url": "https://files.pythonhosted.org/packages/24/36/de3b6ae8d58312357e59deb70a63035d147ccd3e59bc4c9812e59f85d21f/outlines_haystack-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dea3786f6b19001e2660cb56bfad648f0a5594886d39179b7275a2480b2b045a",
                "md5": "9536ebdca2e43ccf380e45c561799919",
                "sha256": "5825b62fa9574f4b4a6de5420b879f41868065aa4ffda10988395f115f905486"
            },
            "downloads": -1,
            "filename": "outlines_haystack-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "9536ebdca2e43ccf380e45c561799919",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9",
            "size": 16124,
            "upload_time": "2024-12-17T00:36:46",
            "upload_time_iso_8601": "2024-12-17T00:36:46.545418Z",
            "url": "https://files.pythonhosted.org/packages/de/a3/786f6b19001e2660cb56bfad648f0a5594886d39179b7275a2480b2b045a/outlines_haystack-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-17 00:36:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "EdAbati",
    "github_project": "outlines-haystack#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "outlines-haystack"
}
        
Elapsed time: 0.46828s