togetherai-haystack


Nametogetherai-haystack JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryHaystack components to integrate with Together.AI inference models.
upload_time2024-05-28 22:32:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords embedding haystack nlp together.ai
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # togetherai-haystack

`together-haystack` provides [Haystack](https://github.com/deepset-ai/haystack) components to use [Together.ai](www.together.ai) models in Haystack pipelines.

> [!CAUTION]
> This project is unofficial, and the authors are not affiliated with either Haystack or Together.AI

At the moment, the integration is limited to embedder components that use Together Embeddings Inference APIs.

* `TogetherAITextEmbedder` to embed strings / text
* `TogetherAIDocumentEmbedder` to embed a collection of Haystack documents.

Refer to Haystack's documentation to see how these can be plugged-in in Haystack Pipelines to build whatever you need to.

Support for Generators (LLM) and other resources offered by together will be added soon™.

## Usage

1. Install from pypi using your python dependency manager, e.g. `pip install togetherai-haystack`
2. Import and use as any haystack component:
   ```pycon
   >>> from togetherai_haystack.components.embedders import TogetherAITextEmbedder
   
   # by default the API KEY is read from the TOGETHER_API_KEY environment variable
   >>> text_embedder = TogetherTextEmbedder(model="togethercomputer/m2-bert-80M-32k-retrieval")
   >>> text_embedder.run("Together.ai provides optimized inference endpoints")
   {'embedding': [-0.3592394, 0.1824189, ...]}
   
   ```

## Development
This project uses [pdm](https://pdm-project.org) as a package manager and [ruff](https://github.com/astral-sh/ruff) as a formatter and linter.

The test suite is currently quite bad, there are just two "integration" tests which require a real API key and will invoke the real Together endpoints.
These means that:
* You need an account and to set up an API key to run these tests
* These tests require an internet connection and won't work if the environment can't reach https://api.together.xyz/v1 or if Together itself is nonresponsive.
* These tests will use your Together.ai account credit.
  Though, given their low prices and the minuscule number of tokens used in the tests, each run should cost you ~$0.0000008, meaning you'd have to run them ~12500 times before 1cent is taken from your account.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "togetherai-haystack",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Leonardo Donelli <leo@wideknot.me>",
    "keywords": "embedding, haystack, nlp, together.ai",
    "author": null,
    "author_email": "Leonardo Donelli <leo@wideknot.me>",
    "download_url": "https://files.pythonhosted.org/packages/2f/e2/d6be3304b31b14272ed5a4841a64edc97f08c680cda085c94e1d4622750a/togetherai_haystack-0.1.1.tar.gz",
    "platform": null,
    "description": "# togetherai-haystack\n\n`together-haystack` provides [Haystack](https://github.com/deepset-ai/haystack) components to use [Together.ai](www.together.ai) models in Haystack pipelines.\n\n> [!CAUTION]\n> This project is unofficial, and the authors are not affiliated with either Haystack or Together.AI\n\nAt the moment, the integration is limited to embedder components that use Together Embeddings Inference APIs.\n\n* `TogetherAITextEmbedder` to embed strings / text\n* `TogetherAIDocumentEmbedder` to embed a collection of Haystack documents.\n\nRefer to Haystack's documentation to see how these can be plugged-in in Haystack Pipelines to build whatever you need to.\n\nSupport for Generators (LLM) and other resources offered by together will be added soon\u2122.\n\n## Usage\n\n1. Install from pypi using your python dependency manager, e.g. `pip install togetherai-haystack`\n2. Import and use as any haystack component:\n   ```pycon\n   >>> from togetherai_haystack.components.embedders import TogetherAITextEmbedder\n   \n   # by default the API KEY is read from the TOGETHER_API_KEY environment variable\n   >>> text_embedder = TogetherTextEmbedder(model=\"togethercomputer/m2-bert-80M-32k-retrieval\")\n   >>> text_embedder.run(\"Together.ai provides optimized inference endpoints\")\n   {'embedding': [-0.3592394, 0.1824189, ...]}\n   \n   ```\n\n## Development\nThis project uses [pdm](https://pdm-project.org) as a package manager and [ruff](https://github.com/astral-sh/ruff) as a formatter and linter.\n\nThe test suite is currently quite bad, there are just two \"integration\" tests which require a real API key and will invoke the real Together endpoints.\nThese means that:\n* You need an account and to set up an API key to run these tests\n* These tests require an internet connection and won't work if the environment can't reach https://api.together.xyz/v1 or if Together itself is nonresponsive.\n* These tests will use your Together.ai account credit.\n  Though, given their low prices and the minuscule number of tokens used in the tests, each run should cost you ~$0.0000008, meaning you'd have to run them ~12500 times before 1cent is taken from your account.",
    "bugtrack_url": null,
    "license": null,
    "summary": "Haystack components to integrate with Together.AI inference models.",
    "version": "0.1.1",
    "project_urls": {
        "Repository": "https://github.com/LeartS/togetherai_haystack.git"
    },
    "split_keywords": [
        "embedding",
        " haystack",
        " nlp",
        " together.ai"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ea80c8e61e2644e080f0875e8eccf3fd6b91d12cb055948f4e09176edf33bb8a",
                "md5": "466ec09bb486088c78f72612433011ca",
                "sha256": "27041930f6464657e702a739647fbb1ae38ad7542ee947601585a764e4cc6081"
            },
            "downloads": -1,
            "filename": "togetherai_haystack-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "466ec09bb486088c78f72612433011ca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 6292,
            "upload_time": "2024-05-28T22:32:52",
            "upload_time_iso_8601": "2024-05-28T22:32:52.771744Z",
            "url": "https://files.pythonhosted.org/packages/ea/80/c8e61e2644e080f0875e8eccf3fd6b91d12cb055948f4e09176edf33bb8a/togetherai_haystack-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2fe2d6be3304b31b14272ed5a4841a64edc97f08c680cda085c94e1d4622750a",
                "md5": "179a495008da52802959c2ebe4caf4cf",
                "sha256": "f469997561fbb0a29ecc3d6621d3e5ac1a3309944afc5fec260c0beef26ee0a1"
            },
            "downloads": -1,
            "filename": "togetherai_haystack-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "179a495008da52802959c2ebe4caf4cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 40945,
            "upload_time": "2024-05-28T22:32:54",
            "upload_time_iso_8601": "2024-05-28T22:32:54.303504Z",
            "url": "https://files.pythonhosted.org/packages/2f/e2/d6be3304b31b14272ed5a4841a64edc97f08c680cda085c94e1d4622750a/togetherai_haystack-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-28 22:32:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LeartS",
    "github_project": "togetherai_haystack",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "togetherai-haystack"
}
        
Elapsed time: 0.27702s