-
Notifications
You must be signed in to change notification settings - Fork 7
Q: translate everything I send to you #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
2023-03-09T01:23:56.571Z WARN 1646 --- [ main] org.jline : Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information) |
Translate "Hello" to Spanish |
2023-03-09T01:25:18.924Z WARN 1640 --- [ main] org.jline : Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information) |
Can you list a table with the translations from "Hello" to ten different other languages? |
2023-03-09T01:26:22.036Z WARN 1692 --- [ main] org.jline : Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
|
Can you write some codes in Python, to send requests to the OpenAI ChatGPT API? |
2023-03-09T01:57:51.945Z WARN 1683 --- [ main] org.jline : Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information) import requests
import json
# Set the API endpoint and token
url = 'https://api.openai.com/v1/engines/davinci-codex/completions'
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY_HERE', # Replace with your API key
}
# Set the prompt and parameters for the API call
prompt = 'Hello, can you help me write a Python code to fetch data from an API?'
data = {
'prompt': prompt,
'max_tokens': 50, # Maximum number of tokens to generate
'stop': '\n', # Stop generating when a newline character is generated
}
# Send a POST request to the API endpoint with the prompt and parameters
response = requests.post(url, headers=headers, data=json.dumps(data))
# Get the response from the API as a JSON object and print it
response_json = json.loads(response.text)
print(response_json['choices'][0]['text']) Note that you need to replace |
No description provided.
The text was updated successfully, but these errors were encountered: