Different Python Code for Different OpenAI Models — Davinci VS chatGPT

Pavol Kutaj
Mar 15, 2023

The aim of this page📝 is to share 2 snippets of python code that can be easily reproduced to run prompts against 2 different OpenAI models

  • ChatGPT
  • Davinci (10x more expensive)

— See https://openai.com/pricing

  • NOTE: the API functions a bit differently, I thought it was just a matter of replacing the name of model but that's not the case

But first, the wrapper which passes a question from the PowerShell terminal

  • I have the following in $profile — the simple thing it does is to concatenate the question into a single string
  • Then, it passes it into the python scripts
  • It works like this, either with the -davinci flag or alone
  • Surely, you could just use an input() to get the prompt interactively





Pavol Kutaj

Today I Learnt | Infrastructure Support Engineer at snowplow.io with a passion for cloud infrastructure/terraform/python/docs. More at https://pavol.kutaj.com