prompthub-py


Nameprompthub-py JSON
Version 3.0.1 PyPI version JSON
download
home_page
Summary
upload_time2023-05-30 09:19:47
maintainer
docs_urlNone
authordeepset.ai
requires_python>=3.8,<4.0
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Prompt Hub Python Client

[![PyPI - Version][pypi-badge]][pypi-project] [![Tests][tests-badge]][tests-workflow]

A simple client to fetch prompts from [Prompt Hub][prompt-hub] using its REST API.

## Usage

First step is obviously installation:

```
pip install prompthub-py
```

Then you can import `Prompt`, that class is all you're going to need.

```python
import prompthub

# To load from a JSON file
p = prompthub.from_json("./path/to/my/prompt.json")


# To load from a YAML file
p = prompthub.from_yaml("./path/to/my/prompt.yaml")


# To load from Prompt Hub
p = prompthub.fetch("deepset/question-answering")

# To get the prompt text (see Prompt class)
p.text
```

If you want to use a different Prompt Hub you must set the `PROMPTHUB_MAIN_ENDPOINT` environment variable to your main endpoint.

If the environment variable is not set the default `api.prompthub.deepset.ai` will be used.

## Testing

To run tests locally first install dev dependencies, we use [`poetry`][python-poetry] to manage our dependencies:

```
poetry install --with=dev
```

Run Prompt Hub locally with a set of fake prompts:

```
docker run -p80:80 --volume $PWD/test/fake_prompts:/prompts deepset/prompthub
```

And then run tests:

```
poetry run pytest test
```

[pypi-badge]: https://img.shields.io/pypi/v/prompthub-py.svg
[pypi-project]: https://pypi.org/project/prompthub-py
[prompt-hub]: https://prompthub.deepset.ai/
[python-poetry]: https://python-poetry.org/
[tests-badge]: https://github.com/deepset-ai/prompthub-py/actions/workflows/test.yml/badge.svg
[tests-workflow]: https://github.com/deepset-ai/prompthub-py/actions/workflows/test.yml

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "prompthub-py",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "deepset.ai",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/83/bc/d8b2d23da41526ca85b41d3ebaf70016286c7138998089c56347122e6073/prompthub_py-3.0.1.tar.gz",
    "platform": null,
    "description": "# Prompt Hub Python Client\n\n[![PyPI - Version][pypi-badge]][pypi-project] [![Tests][tests-badge]][tests-workflow]\n\nA simple client to fetch prompts from [Prompt Hub][prompt-hub] using its REST API.\n\n## Usage\n\nFirst step is obviously installation:\n\n```\npip install prompthub-py\n```\n\nThen you can import `Prompt`, that class is all you're going to need.\n\n```python\nimport prompthub\n\n# To load from a JSON file\np = prompthub.from_json(\"./path/to/my/prompt.json\")\n\n\n# To load from a YAML file\np = prompthub.from_yaml(\"./path/to/my/prompt.yaml\")\n\n\n# To load from Prompt Hub\np = prompthub.fetch(\"deepset/question-answering\")\n\n# To get the prompt text (see Prompt class)\np.text\n```\n\nIf you want to use a different Prompt Hub you must set the `PROMPTHUB_MAIN_ENDPOINT` environment variable to your main endpoint.\n\nIf the environment variable is not set the default `api.prompthub.deepset.ai` will be used.\n\n## Testing\n\nTo run tests locally first install dev dependencies, we use [`poetry`][python-poetry] to manage our dependencies:\n\n```\npoetry install --with=dev\n```\n\nRun Prompt Hub locally with a set of fake prompts:\n\n```\ndocker run -p80:80 --volume $PWD/test/fake_prompts:/prompts deepset/prompthub\n```\n\nAnd then run tests:\n\n```\npoetry run pytest test\n```\n\n[pypi-badge]: https://img.shields.io/pypi/v/prompthub-py.svg\n[pypi-project]: https://pypi.org/project/prompthub-py\n[prompt-hub]: https://prompthub.deepset.ai/\n[python-poetry]: https://python-poetry.org/\n[tests-badge]: https://github.com/deepset-ai/prompthub-py/actions/workflows/test.yml/badge.svg\n[tests-workflow]: https://github.com/deepset-ai/prompthub-py/actions/workflows/test.yml\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "",
    "version": "3.0.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cd0169ac4bc002ea4c2139f9b1536d4eb58489c129f88feea77ba18239b052b1",
                "md5": "06b68d27912c12fa58a0e91a0eec34ff",
                "sha256": "d280d97c55cc7febc8a9275d6146007255e1094fe765c6f96894b131df5a61da"
            },
            "downloads": -1,
            "filename": "prompthub_py-3.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "06b68d27912c12fa58a0e91a0eec34ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 6858,
            "upload_time": "2023-05-30T09:19:45",
            "upload_time_iso_8601": "2023-05-30T09:19:45.963462Z",
            "url": "https://files.pythonhosted.org/packages/cd/01/69ac4bc002ea4c2139f9b1536d4eb58489c129f88feea77ba18239b052b1/prompthub_py-3.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83bcd8b2d23da41526ca85b41d3ebaf70016286c7138998089c56347122e6073",
                "md5": "5d22f597512dc32f30ce90d44638e62d",
                "sha256": "c9212d9b1c36cf70dbad196018d5d9eb7a9d0a54522440cb322000b819ef7648"
            },
            "downloads": -1,
            "filename": "prompthub_py-3.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5d22f597512dc32f30ce90d44638e62d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 6106,
            "upload_time": "2023-05-30T09:19:47",
            "upload_time_iso_8601": "2023-05-30T09:19:47.834288Z",
            "url": "https://files.pythonhosted.org/packages/83/bc/d8b2d23da41526ca85b41d3ebaf70016286c7138998089c56347122e6073/prompthub_py-3.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-30 09:19:47",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "prompthub-py"
}
        
Elapsed time: 0.07580s