generative-ai-for-beginners icon indicating copy to clipboard operation
generative-ai-for-beginners copied to clipboard

api_version is hard coded in *.py files and has different values among projects

Open bmerkle opened this issue 6 months ago • 1 comments

Describe the bug Possible improvements for the handling of api_version in *.py files

  1. the variable is often hard coded in *.py files (instead of using the .env file for specifying)
  2. the variable has different values among the projects
  3. even sometimes if had different values in the same project (e.g. 08-building-search-applications)

I could contribute a patch to improve the handling of api_version. Open questions:

  1. on patch per project or a large ?
  2. what should be the default for the value ?

To Reproduce Please see the example report C:\work\microsoft\generative-ai-for-beginners\06-text-generation-apps\python\aoai-app-recipe.py (1 hit) Line 12: api_version = "2023-10-01-preview" C:\work\microsoft\generative-ai-for-beginners\06-text-generation-apps\python\aoai-app.py (1 hit) Line 13: api_version = "2023-05-15" C:\work\microsoft\generative-ai-for-beginners\06-text-generation-apps\python\aoai-history-bot.py (1 hit) Line 12: api_version = "2023-10-01-preview" C:\work\microsoft\generative-ai-for-beginners\06-text-generation-apps\python\aoai-study-buddy.py (1 hit) Line 12: api_version = "2023-10-01-preview" C:\work\microsoft\generative-ai-for-beginners\08-building-search-applications\scripts\transcript_enrich_embeddings.py (1 hit) Line 30: openai.api_version = "2023-05-15" C:\work\microsoft\generative-ai-for-beginners\08-building-search-applications\scripts\transcript_enrich_speaker.py (1 hit) Line 41: openai.api_version = "2023-07-01-preview" C:\work\microsoft\generative-ai-for-beginners\08-building-search-applications\scripts\transcript_enrich_summaries.py (1 hit) Line 30: openai.api_version = "2023-07-01-preview" C:\work\microsoft\generative-ai-for-beginners\09-building-image-applications\python\aoai-app-variation.py (1 hit) Line 14: api_version = "2023-12-01-preview", C:\work\microsoft\generative-ai-for-beginners\09-building-image-applications\python\aoai-app.py (1 hit) Line 16: api_version = "2023-12-01-preview", C:\work\microsoft\generative-ai-for-beginners\09-building-image-applications\python\aoai-solution.py (1 hit) Line 16: api_version = "2023-12-01-preview",

Expected behavior

  1. handling should be unified to use the .env files for api_version and no hardcoded values in *.py files
  2. api_version should be the most recent if possible

bmerkle avatar Jul 29 '24 09:07 bmerkle