[go: nahoru, domu]

Skip to content

GangGreenTemperTatum/cohere-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)

About

cohere.ai NLP jamming, projects and testing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages