You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We’ve created an improved version of OpenAI Codex, our AI system that translates natural language to code, and we are releasing it through our API in private beta starting today.
The example of code for catching key press and add text:
fromprompt_toolkitimportpromptfromprompt_toolkit.key_bindingimportKeyBindings# Define key bindings to replace text on space key presskb=KeyBindings()
@kb.add(' ')def_(event):
event.current_buffer.text=event.current_buffer.text+' space :)'event.current_buffer.cursor_position+=len(event.current_buffer.text) # move coursor to the end# Start a prompt session with key bindingstext=prompt('> ', key_bindings=kb)
print('You entered:', text)
Draft 1:
importopenaiopenai.api_key="YOUR_API_KEY_HERE"# https://platform.openai.com/account/api-keys# Example promptprompt="I love Python because"# Example completion using the GPT-3 modelresponse=openai.Completion.create(
engine="davinci", prompt=prompt, max_tokens=50
)
# Print the responseprint(response.choices[0].text)
The example of code for catching key press and add text:
Draft 1:
Draft 2:
For community
⬇️ Please click the 👍 reaction instead of leaving a
+1
or 👍 commentThe text was updated successfully, but these errors were encountered: