Skip to main content

OpenAI

Summary

  • OpenAI has released API for developers to access their models for various use cases.
  • We are using OpenAI API in projects like AI3 Hackathon, ORSANCO for text generation and summarization.
  • The official documentation can be found here: platform.openai.com/docs
  • Try using GPT playground which provides access to various models and parameters, in order to know what to use for the API call.
  • The playground can be found here: platform.openai.com/playground
    • Details on the playground usage are here: https://linuxhint.com/use-openai-playground-for-free/
    • Apparently, new account is given 18$ credit freely, for usage in 3 months. This has yet to be tested since new accounts need a unique phone number that has not been used for any other OpenAI account.
    • Check the credits in the account before, and if there are 0$ credits, it's not possible to use the playground.

ChatGPT UI

  • The UI website of chatGPT responses are customised to display using standard markdown styles. And API responses are not.
  • There is custom instructions option in the UI that appears on clicking the username. With this, we can get customised responses instead of robotic or standard answers.

API

  • We are using paid version of GPT, which calculates the cost based on the number of input tokens in our question and number of output tokens in it's response. So, careful using the API.
  • We have a API token that is not anywhere on cloud. Reach out to Jake or Sudhir for details.
  • Additionally, you can also find text files in local, like MSI AI3, where the token is stored.
  • It's always better to play around the parameters in the playground.
  • Additionally, some examples on multiple ways to call the API is documented here: general.gqc.com/pavan-openai
  • Additionally, we also have a sample template that can be used for ChatGPT API implementation here - github.com/gqc-utility-python.

Note

Few things we need to know to streamline our process are following:

  1. Understand the API workflow using offical documentation and code implemented in our projects' repositories.
  2. Sending multiple requests at once to the API can sometimes respond with service not available.
  3. It's always better to test the questions or quieries with the ChatGPT UI or playground before using API.
  4. Privacy and Security: Handle sensitive data carefully and comply with privacy regulations.
  5. Bias and Fairness: Be cautious about biases in the model and work to mitigate them for fairness.
  6. Output Filtering: Implement filters to prevent inappropriate responses.
  7. Accuracy and Reliability: Verify critical information, as AI-generated content may not always be accurate.
  8. Prompt Engineering: Design prompts thoughtfully to guide desired responses.
  9. Explainability: Remember, the AI's reasoning isn't directly interpretable.
  10. Overuse and Overreliance: Avoid excessive usage and maintain human control.
  11. Cost Management: Monitor API usage to manage costs effectively.
  12. Legal and Ethical Considerations: Adhere to ethical guidelines and legal requirements.
  13. Feedback Loop and Fine-tuning: Use a feedback loop and fine-tuning responsibly to improve the model's performance.
Fun fact

Some of the instructions in the Note section were suggested by ChatGPT itself!