Skip to content

enhance: add support for azure deployment name mapping #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 29, 2024
Merged

enhance: add support for azure deployment name mapping #78

merged 4 commits into from
Feb 29, 2024

Conversation

keyallis
Copy link
Contributor

@keyallis keyallis commented Feb 26, 2024

#43

Add a configurable env variable to set the azure deployment name to be used in lieu of the model name. Migrate away from using the snapshotted fork of go-openai, and add a hack for passing temperature.

@danielhass
Copy link

@keyallis thank you for this PR!

I tried use your changes already locally however I ran into the situation that gptscript is waiting for the model response "for ever":

[...]
{
  "completionID": "1",
  "id": "1",
  "level": "debug",
  "logger": "pkg/monitor",
  "msg": "messages",
  "parentID": "",
  "request": {
    "model": "gpt-4-turbo-preview",
    "messages": [
      {
        "role": "system",
        "content": "\nYou are task oriented system.\nYou receive input from a user, process the input from the given instructions, and then output the result.\nYour objective is to provide consistent and correct results.\nYou do not need to explain the steps taken, only provide the result to the given instructions.\nYou are referred to as a tool.\n"
      },
      {
        "role": "system",
        "content": "Say hello world"
      }
    ],
    "temperature": 1e-8
  },
  "time": "2024-02-27T17:02:22+01:00",
  "toolID": "examples/helloworld.gpt:1"
}
         content  [1] content | Waiting for model response...

Have you ran into this to sometimes?

@keyallis
Copy link
Contributor Author

Hey @danielhass, thanks for taking a look. I'm curious what variables you're setting when testing this? These are the ones I have set:

OPENAI_API_KEY
OPENAI_URL
OPENAI_API_TYPE
OPENAI_AZURE_DEPLOYMENT

If you don't have all of these set then it might not be picking up the changes included

README.md Outdated

```shell
export OPENAI_API_KEY="your-api-key"
export OPENAI_URL="your-endpiont"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this different than OPENAI_BASE_URL?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we already have both, but this version does not match the help text

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just the env var I was using. I can swap it.

@danielhass
Copy link

Hey @danielhass, thanks for taking a look. I'm curious what variables you're setting when testing this? These are the ones I have set:

OPENAI_API_KEY
OPENAI_URL
OPENAI_API_TYPE
OPENAI_AZURE_DEPLOYMENT

If you don't have all of these set then it might not be picking up the changes included

@keyallis I used the following set of env vars:

export OPENAI_API_VERSION="2024-02-15-preview"
export OPENAI_AZURE_DEPLOYMENT="gpt-4"
export OPENAI_API_KEY="xxx"
export OPENAI_BASE_URL="https://xxx.openai.azure.com/"
export OPENAI_API_TYPE="AZURE"

@keyallis
Copy link
Contributor Author

@danielhass I believe your issue might be with the OPENAI_API_VERSION, you might try either using the default setting for that, or some other version values. Azure has some inconsistent functionality support between api versions from what I could gather.

@danielhass
Copy link

@keyallis 💯 - changing to OPENAI_API_VERSION="2023-05-15" resolved the issue!

Shall we add this to the docs for the Azure variant?

@keyallis
Copy link
Contributor Author

@danielhass I've omitted mention of the OPENAI_API_VERSION in the getting started flow to keep it more general. If a value is not set for that field then it defaults to the value 2023-05-15.

@danielhass
Copy link

danielhass commented Feb 29, 2024

@danielhass I've omitted mention of the OPENAI_API_VERSION in the getting started flow to keep it more general. If a value is not set for that field then it defaults to the value 2023-05-15.

@keyallis didn't know about the default. Makes total sense not to mention it in that case 👍

Thanks for bringing this to gptscript!

@keyallis keyallis merged commit c8eae2a into gptscript-ai:main Feb 29, 2024
@keyallis keyallis deleted the azure-deployment-name-support branch February 29, 2024 22:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants