bedrock-anthropic


Namebedrock-anthropic JSON
Version 0.0.5 PyPI version JSON
download
home_page
SummaryClient library for the anthropic API with the AWS Bedrock endpoint.
upload_time2023-10-25 05:21:39
maintainer
docs_urlNone
author
requires_python>=3.7
licenseCopyright 2023 Mustafa Aljadery, Siddharth Sharma. 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 anthropic llm bedrock claude openai tiktoken aws bedrock
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Anthropic Bedrock Python SDK

`bedrock-anthropic` is a python library for interacting with Anthropic's models on AWS Bedrock. It makes it really easy to use Anthropic's models in your application.

Created by: [Mustafa Aljadery](https://www.maxaljadery.com/) & [Siddharth Sharma](https://stanford.edu/~sidshr/).

Complete [Docs](https://www.anthropic-bedrock.com/)

## Installation

Install `bedrock-anthropic` using pip:

```bash copy
pip install bedrock-anthropic
```

## Authentication

This is an example using access & secret keys. For more authentication examples, refer to the [docs](https://www.anthropic-bedrock.com/).

```python
import os
from bedrock_anthropic import AnthropicBedrock

anthropic = AnthropicBedrock(
    access_key=os.getenv("AWS_ACCESS_KEY"),
    secret_key=os.getenv("AWS_SECRET_KEY")
)
```

## Example

An example of using the `Completion` endpoint in this SDK.

```python copy
import os
from bedrock_anthropic import AnthropicBedrock

anthropic = AnthropicBedrock(
    access_key=os.getenv("AWS_ACCESS_KEY"),
    secret_key=os.getenv("AWS_SECRET_KEY")
)

completion = anthropic.Completion.create(
    model="anthropic.claude-v2",
    prompt="Why is the sky blue?",
    max_tokens_to_sample=300
)

print(completion["completion"])
```

## Response

```markdown
There are a few main reasons why the sky appears blue:

- Rayleigh scattering - Light from the sun is scattered by nitrogen and oxygen molecules in the atmosphere. Shorter wavelengths like blue and violet are scattered more easily than longer wavelengths, making the sky appear blue.

- The composition of the atmosphere - Nitrogen and oxygen account for most of the atmosphere. These gases are efficient at scattering blue light.

- The angle of the sun - The sky appears blue during the day but red/orange during sunrise and sunset because of the angle sunlight has to pass through the atmosphere. More blue light is scattered away from the line of sight when the sun is higher overhead.

- Water and dust - Additional scattering by water and dust particles in the atmosphere can also contribute to the blue color.

So in summary, the main factors are Rayleigh scattering by air molecules that preferentially scatters blue light, the gases that make up our atmosphere, and the angle/amount of atmosphere sunlight has to pass through. This gives the sky its familiar blue hue during the day.
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "bedrock-anthropic",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "Anthropic,LLM,Bedrock,Claude,OpenAI,tiktoken,AWS Bedrock",
    "author": "",
    "author_email": "Mustafa Aljadery <aljadery@usc.edu>, Siddharth Sharma <sidshr@stanford.edu>",
    "download_url": "https://files.pythonhosted.org/packages/d0/d1/315492513949cd8133b2fa403e19711a786d84e32ba6115853426690ed8c/bedrock_anthropic-0.0.5.tar.gz",
    "platform": null,
    "description": "# Anthropic Bedrock Python SDK\n\n`bedrock-anthropic` is a python library for interacting with Anthropic's models on AWS Bedrock. It makes it really easy to use Anthropic's models in your application.\n\nCreated by: [Mustafa Aljadery](https://www.maxaljadery.com/) & [Siddharth Sharma](https://stanford.edu/~sidshr/).\n\nComplete [Docs](https://www.anthropic-bedrock.com/)\n\n## Installation\n\nInstall `bedrock-anthropic` using pip:\n\n```bash copy\npip install bedrock-anthropic\n```\n\n## Authentication\n\nThis is an example using access & secret keys. For more authentication examples, refer to the [docs](https://www.anthropic-bedrock.com/).\n\n```python\nimport os\nfrom bedrock_anthropic import AnthropicBedrock\n\nanthropic = AnthropicBedrock(\n    access_key=os.getenv(\"AWS_ACCESS_KEY\"),\n    secret_key=os.getenv(\"AWS_SECRET_KEY\")\n)\n```\n\n## Example\n\nAn example of using the `Completion` endpoint in this SDK.\n\n```python copy\nimport os\nfrom bedrock_anthropic import AnthropicBedrock\n\nanthropic = AnthropicBedrock(\n    access_key=os.getenv(\"AWS_ACCESS_KEY\"),\n    secret_key=os.getenv(\"AWS_SECRET_KEY\")\n)\n\ncompletion = anthropic.Completion.create(\n    model=\"anthropic.claude-v2\",\n    prompt=\"Why is the sky blue?\",\n    max_tokens_to_sample=300\n)\n\nprint(completion[\"completion\"])\n```\n\n## Response\n\n```markdown\nThere are a few main reasons why the sky appears blue:\n\n- Rayleigh scattering - Light from the sun is scattered by nitrogen and oxygen molecules in the atmosphere. Shorter wavelengths like blue and violet are scattered more easily than longer wavelengths, making the sky appear blue.\n\n- The composition of the atmosphere - Nitrogen and oxygen account for most of the atmosphere. These gases are efficient at scattering blue light.\n\n- The angle of the sun - The sky appears blue during the day but red/orange during sunrise and sunset because of the angle sunlight has to pass through the atmosphere. More blue light is scattered away from the line of sight when the sun is higher overhead.\n\n- Water and dust - Additional scattering by water and dust particles in the atmosphere can also contribute to the blue color.\n\nSo in summary, the main factors are Rayleigh scattering by air molecules that preferentially scatters blue light, the gases that make up our atmosphere, and the angle/amount of atmosphere sunlight has to pass through. This gives the sky its familiar blue hue during the day.\n```\n",
    "bugtrack_url": null,
    "license": "Copyright 2023 Mustafa Aljadery, Siddharth Sharma.  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": "Client library for the anthropic API with the AWS Bedrock endpoint.",
    "version": "0.0.5",
    "project_urls": {
        "Homepage": "https://github.com/mustafaaljadery/anthropic-bedrock",
        "Repository": "https://github.com/mustafaaljadery/anthropic-bedrock"
    },
    "split_keywords": [
        "anthropic",
        "llm",
        "bedrock",
        "claude",
        "openai",
        "tiktoken",
        "aws bedrock"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f7acdd5af0810dc954308614ec495b9e2c6414a7a7cfe7c6f5844e378bf10904",
                "md5": "03cb536a54a51307810f7fc3d6b5e28e",
                "sha256": "ba7ad654cc43c9d87f2344ec16d2dcc95364e583e26b632e7ac719cf671c98ce"
            },
            "downloads": -1,
            "filename": "bedrock_anthropic-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "03cb536a54a51307810f7fc3d6b5e28e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7898,
            "upload_time": "2023-10-25T05:21:38",
            "upload_time_iso_8601": "2023-10-25T05:21:38.244388Z",
            "url": "https://files.pythonhosted.org/packages/f7/ac/dd5af0810dc954308614ec495b9e2c6414a7a7cfe7c6f5844e378bf10904/bedrock_anthropic-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d0d1315492513949cd8133b2fa403e19711a786d84e32ba6115853426690ed8c",
                "md5": "a7ec88c33a8fb110b59348b10d970f3d",
                "sha256": "3c629bc905a2721819450e00ccb6ace70a5929ffa598e6d8a08719dcdfceb363"
            },
            "downloads": -1,
            "filename": "bedrock_anthropic-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a7ec88c33a8fb110b59348b10d970f3d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7812,
            "upload_time": "2023-10-25T05:21:39",
            "upload_time_iso_8601": "2023-10-25T05:21:39.873100Z",
            "url": "https://files.pythonhosted.org/packages/d0/d1/315492513949cd8133b2fa403e19711a786d84e32ba6115853426690ed8c/bedrock_anthropic-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-25 05:21:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mustafaaljadery",
    "github_project": "anthropic-bedrock",
    "github_not_found": true,
    "lcname": "bedrock-anthropic"
}
        
Elapsed time: 0.12890s