Pythagora-io / gpt-pilot

The first real AI developer
Other
30.18k stars 3.01k forks source link

[Bug]: Azure Open AI Doesnt work inside config.json - Version 0.2.1 #971

Closed queryit-admin closed 4 months ago

queryit-admin commented 4 months ago

Version

Command-line (Python) version

Operating System

Windows 11

What happened?

I have deployed and tested Azure OpenAI Model after being ddeployed, i tried to enter the same cred inside config.json and it gives me "API check for openai failed with: Resource not found"

image

Code that works with deployed Azure OpenAI Model

import os
from openai import AzureOpenAI

# Assuming the API key is set as an environment variable
api_key = "***********"

client = AzureOpenAI(
    api_key=api_key,
    api_version="2024-02-01",
    azure_endpoint="https://openaiqueryit.openai.azure.com"
)

completion = client.chat.completions.create(
    model="QueryIt",  # Use the deployment name as the model identifier
    messages=[
        {
            "role": "user",
            "content": "Translate the following English text to French: 'Hello, world!'",
        },
    ]
)

print(completion)

This is how the terminal response looks like:

image

The folder pilot now has nothing in it, assuming the latest version(0.2.1) removed the need for the files within that folder (Fyi): image

senko commented 4 months ago

The base URL is likely incorrect, as we're not using Azure SDK but OpenAI SDK, so the URL / params might be a bit different. I'm not familiar with Azure but I imagine there's some info in their docs on how to use it with vanilla OpenAI SDK, that might help.

queryit-admin commented 4 months ago

The base URL is likely incorrect, as we're not using Azure SDK but OpenAI SDK, so the URL / params might be a bit different. I'm not familiar with Azure but I imagine there's some info in their docs on how to use it with vanilla OpenAI SDK, that might help.

Thank you this helps :)

nikzart3 commented 3 months ago

when will this get fixed? the update totally broke what i was doing