Skip to content

Instantly share code, notes, and snippets.

@beabetterdevv
Created October 1, 2023 14:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beabetterdevv/4f1e7816794ba6898fdba9132f2ed647 to your computer and use it in GitHub Desktop.
Save beabetterdevv/4f1e7816794ba6898fdba9132f2ed647 to your computer and use it in GitHub Desktop.
import boto3
import json
bedrock = boto3.client(
service_name='bedrock-runtime',
region_name='us-east-1'
)
input = {
"modelId": "cohere.command-text-v14",
"contentType": "application/json",
"accept": "*/*",
"body": "{\"prompt\":\"I am a college professor and I would like to create an outline for a lecture on AI. Create a lecture format. \",\"max_tokens\":400,\"temperature\":0.75,\"p\":0.01,\"k\":0,\"stop_sequences\":[],\"return_likelihoods\":\"NONE\"}"
}
response = bedrock.invoke_model(body=input["body"],
modelId=input["modelId"],
accept=input["accept"],
contentType=input["contentType"])
response_body = json.loads(response['body'].read())
print(response_body)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment