Skip to content

A demo of Azure OpenAI in different programmling languages.

Notifications You must be signed in to change notification settings

jfbilodeau/MagnusLiber

Repository files navigation

Magnus Liber Imperatorum

A set of Azure OpenAI demos

Welcome to Magnus Liber Imperatorum, the Great Book of Roman Emperors.

Magnus Liber is an Azure OpenAI demo of the chat completion APIs written in different programming languages. The goal of the demos is to illustrate basic use of the OpenAI chat completion API, including request parameters, response and conversation management.

Getting started

To run Magnus Liber in any programming language, an Azure Subscription and an Azure OpenAI deployment will be necessary.

  1. If necessary, get a free Azure subscription.
  2. Create an Azure OpenAI service resource.
  3. Deploy either an OpenAI gpt-4 or gpt-3-turbo model. (Other models do not support chat completions and will not work)
  4. Open a terminal
  5. Run git clone https://github.com/jfbilodeau/MagnusLiber.git
  6. Run cd MagnusLiber
  7. Enter the directory of the demo you wish to run and review the instructions in README.md. All demos will require that the following environment variables be set:
    • OPENAI_URL
    • OPENAI_KEY
    • OPENAI_DEPLOYMENT

Design Goal

  • Consistent functionality across demos
  • Idiomatic code
  • Minimize local dependencies
  • Favour Azure OpenAI SDK when available
  • For simplicity, written as one function
  • For clarity, there is very little error handling

Programming Languages demos

Suggested prompts

The following prompts can be used to demonstrates different aspect of Azure OpenAI chat completion.

  • Demonstrate the use of the system message by using the following prompts:

    • Who are you?
    • What can you do?
  • Demonstrate conversation state by using the following prompts in sequence:

    • Who was the first emperor?
    • Who followed him?
  • Demonstrate optional counting as defined in the system message by using the following prompt:

    • Who were the five great emperors?
  • Demonstrate the max_token parameter by reducing it from 1500 to 150 and re-run the above prompt. The answer will exceen the value of max_token and will be truncated.

  • Demonstrate the ability of OpenAI to understand different languages:

    • What does your name mean?
    • Quis fuit primus Romanorum imperator? ('Who was the first Roman Emperor' in Latin)
  • To get a answer in Latin, try:

    • Quis es tu? (Who are you?)
  • Type exit or quit to terminal the demo. CTRL+C works as well.

About

A demo of Azure OpenAI in different programmling languages.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages