Created
October 1, 2023 14:57
-
-
Save beabetterdevv/4f1e7816794ba6898fdba9132f2ed647 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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