2.9 KiB
2.9 KiB
Objective
These Python scripts allow to interact with the OpenAI API. You can manipulate the main abstractions of the OpenAI model:
- Conversations
- Responses
- Inputs
- Items
Requirements
- Python installed on the machine running this application.
- Credentials for accessing the OpenAI API - you will need to singup to the OpenAI portal. You will then be able to craete your credentials from within the portal.
How to run this application
- Copy the file
config-sample.pytoconfig.py. - Edit
config.pywith your credentials and defaults. - Each script has a number of mandatory parameters in strict order:
Script Parameter 1 Parameter 2 Parameter 3 Purpose cancel_model_response.pyresponse_idCancel a Response running in the background create_conversation.pyCreate a new Conversation create_model_response.pyconversation_idmodel_idinput_messageCreate a Response within a Conversation create_text_item.pyconversation_idinput_messageCreate a user input or instruction within a Conversation delete_conversation.pyconversation_idDelete a Conversation delete_item.pyconversation_iditem_idDelete an Item (input or Response) from a Conversation delete_model_response.pyresponse_idDelete a Response list_input_items.pyresponse_idList all input Items used to generate a Response list_items.pyconversation_idList all Items (inputs or Responses) in a Conversation retrieve_conversation.pyconversation_idRetrieve a Conversation retrieve_item.pyconversation_iditem_idRetrieve an Item from a Conversation retrieve_model_response.pyresponse_idRetrieve a model Response update_conversation.pyconversation_idmetadataUpdate a Conversation metadata - To execute these scripts run
python3 <script.py> <parameter_1> ....