Git Product home page Git Product logo

cohere-playground's Introduction

Authentication Tips:

  • Via the Python SDK, which contacts the Cohere API you can authenticate numerous ways:

    Note, ensure .env is added to .gitignore and not added to source control which can expose secrets and keys

  • Create an .env file in the virtual project with line export CO_KEY="YOUR_API_KEY_HERE" and import the os module
  • Reference the environment variable directly
    • Python code to look like this:
import os
import cohere

api_key = os.environ["CO_KEY"]
co = cohere.Client(api_key)

  • Create an .env file in the virtual project with line export CO_KEY="YOUR_API_KEY_HERE" and import the os module
  • Call the os.environ as a variable = co_client
    • Python code to look like this:
import os
import cohere

co_client = cohere.Client(f'{os.environ["CO_KEY"]}')
CHUNK_SIZE = 1024
OUTPUT_BASE_DIR = "./"

  • Create an .env file in the virtual project with line export CO_KEY="YOUR_API_KEY_HERE" and import the os module
  • Define a variable api_key on a new line and reference it using os.environ
  • Use a class definition to reference this within the code
    • Python code to look like this:
# Cohere API key:
api_key = os.environ["CO_KEY"]
# Set up Cohere client:
co = cohere.Client(api_key)

# Providing API Key Credentials
class CoHere:
    def __init__(self, api_key):
        api_key = config('API_KEY')
        self.co = cohere.Client(api_key)

cohere-playground's People

Contributors

ganggreentempertatum avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.