Skip to content
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

[Bug]: Azure_openai not running #218

Open
3 tasks done
jorgesinval opened this issue Jul 12, 2024 · 0 comments
Open
3 tasks done

[Bug]: Azure_openai not running #218

jorgesinval opened this issue Jul 12, 2024 · 0 comments
Labels
bug an unexpected problem or unintended behavior

Comments

@jorgesinval
Copy link

Confirm setup

  • I have installed the development version of {gptstudio} (pak::pak("MichelNivard/gptstudio")) and tested if the problem remains.
  • I have installed the {reprex} and {sessioninfo} packages to be able to run this issue's code snippet pak::pak(c("reprex", "sessioninfo")).

What happened?

I am looking to integrate the OpenAI GPT-4 model into my application. Here are the details I have:

  • Endpoint: https://xxxxxxxxxxxxxxx.openai.azure.com/
  • Location/Region: yyyyyyyyyyyyyyyyyyyyyyyy
  • Key: *******************
  • Deployment Name: gpt-4o
  • Model Name: gpt-4o
  • Model Version: 2024-02-01

I edited the .Renviron file accordingly:

AZURE_OPENAI_TASK="completions"
AZURE_OPENAI_ENDPOINT="https://xxxxxxxxxxxxxxx.openai.azure.com/"
AZURE_OPENAI_DEPLOYMENT_NAME="gpt-4o"
AZURE_OPENAI_KEY="*******************"
AZURE_OPENAI_API_VERSION="2024-02-01"
AZURE_OPENAI_USE_TOKEN=FALSE

I want to integrate it with gptstudio. Could someone guide me on authenticating and making API requests to this endpoint?

I tried:

library(gptstudio)
chat(service = "azure_openai", prompt = "hello", model = "gpt-4)

Relevant log output

#> $messages
#> $messages[[1]]
#> $messages[[1]]$role
#> [1] "system"
#> 
#> $messages[[1]]$content
#> As a chat bot assisting an R programmer working in the RStudio IDE it is important to tailor responses to their skill level and preferred coding style. They consider themselves to be a beginner R programmer. Provide answers with their skill level in mind.  
#> 
#> 
#> $messages[[2]]
#> $messages[[2]]$role
#> [1] "user"
#> 
#> $messages[[2]]$content
#> [1] "hello"
#> Error in `query_api_azure_openai()`:
#> ✖ Azure OpenAI API request failed. Error 400 - Bad Request
#> ℹ Visit the Azure OpenAi Error code guidance
#>   (<https://help.openai.com/en/articles/6891839-api-error-code-guidance>) for
#>   more details
#> ℹ You can also visit the API documentation
#>   (<https://platform.openai.com/docs/guides/error-codes/api-errors>)

Session info

gptstudio::gptstudio_sitrep()
#> 
#> ── Configuration for gptstudio ─────────────────────────────────────────────────
#> No user configuration file found at
#> '/Users/sinval/Library/Preferences/org.R-project.R/R/gptstudio/config.yml'.
#> Using default configuration. Change configuration settings in the chat app.
#> Lauch the chat app with addins or `gptstudio_chat()`.
#> 
#> ── Current Settings ──
#> 
#> - Model: gpt-4-turbo-preview
#> - Task: coding
#> - Language: en
#> - Service: openai
#> - Custom prompt:
#> - Stream: TRUE
#> - Code style: no preference
#> - Skill: beginner
#> 
#> ── Checking API connections ──
#> 
#> ── Checking OpenAI API connection
#> ✖ API key is not set or invalid for OpenAI service.
#> 
#> ── Checking HuggingFace API connection
#> ✖ API key is not set or invalid for HuggingFace service.
#> 
#> ── Checking Anthropic API connection
#> ✖ API key is not set or invalid for Anthropic service.
#> 
#> ── Checking Google AI Studio API connection
#> ✖ API key is not set or invalid for Google AI Studio service.
#> 
#> ── Checking Azure OpenAI API connection
#> ✖ Failed to connect to the Azure OpenAI API service.
#> 
#> ── Checking Perplexity API connection
#> ✖ API key is not set or invalid for Perplexity service.
#> 
#> ── Checking Cohere API connection
#> ✖ API key is not set or invalid for Cohere service.
#> 
#> ── Check Ollama for Local API connection
#> ✖ Couldn't connect to Ollama in <http://localhost:11434>. Is it running there?
#> 
#> ── Getting help ──
#> 
#> See the gptstudio homepage (<https://michelnivard.github.io/gptstudio/>) for
#> getting started guides and package documentation. File an issue or contribute
#> to the package at the GitHub repo
#> (<https://github.com/MichelNivard/gptstudio>).
#> ── End of gptstudio configuration ──────────────────────────────────────────────

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jorgesinval jorgesinval added the bug an unexpected problem or unintended behavior label Jul 12, 2024
@jorgesinval jorgesinval changed the title [Bug]: [Bug]: Azure_openai not running Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

1 participant