Skip to main content

A Python library for the Cohere endpoints in AWS Sagemaker

Project description

Cohere Python SDK (AWS SageMaker)

This package provides functionality developed to simplify interfacing with the Cohere models via AWS SageMaker Marketplace in Python 3.

Installation

The package can be installed with pip:

pip install --upgrade cohere-sagemaker

Install from source:

python setup.py install

Quick Start

To use this library, you need to configure your AWS credentials. You can do this by running aws configure. Once that's set up, you can use the library like this:

from cohere_sagemaker import Client

client = Client(endpoint_name='my-cohere-endpoint')

# generate prediction for a prompt
response = client.generate(
    prompt="Tell me a story about",
    max_tokens=20)

print(response.generations[0].text)
# a time when you had to make a difficult decision. What did you do

Note: by default we assume region configured in AWS CLI (aws configure get region), to override use region_name parameter, e.g.

client = Client(endpoint_name='my-cohere-endpoint', region_name='us-east-1')

More detailed examples can be found in the Jupyter notebook.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cohere-sagemaker-0.2.0.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file cohere-sagemaker-0.2.0.tar.gz.

File metadata

  • Download URL: cohere-sagemaker-0.2.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for cohere-sagemaker-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2ca2618b6abced53c7a7b0203be3d13e5c408b3dc981a76f65dcc548a1539f82
MD5 595db68f853aad53431b5f04b453713f
BLAKE2b-256 cf7ef6cc5ef5193e17bdcca546efe21027c1a69ceca18a0117eecae9fc5c1eb9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page