Skip to content

Commit

Permalink
Change openai key location
Browse files Browse the repository at this point in the history
  • Loading branch information
MajidRafieGeeks committed Dec 20, 2024
1 parent b6ed443 commit afb84b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Olive.OpenAI.Voice/Olive.OpenAI.Voice/OpenAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ public class OpenAI
AudioClient _client = null;
public OpenAI()
{
var model = Olive.Config.Get("OpenAI:Voice:Model").Or("whisper-1");
var key = Olive.Config.Get("OpenAI:Voice:APIKey");
var model = Olive.Config.Get("OpenAI:Models:SpeechToTextModel").Or("whisper-1");
var key = Olive.Config.Get("OpenAI:Key");

if (key.IsEmpty())
{
throw new ArgumentException("The api key was not provided. Please set it in the AppSettings or webConfig in the OpenAI:Voice:APIKey entry");
throw new ArgumentException("The api key was not provided. Please set it in the AppSettings or webConfig in the OpenAI:Key entry");
}
_client = new AudioClient(model, key);
}
Expand Down
4 changes: 2 additions & 2 deletions Olive.OpenAI/Olive.OpenAI/OpenAI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public class OpenAI
public OpenAI(string? key = null)
{
// Get the keys from Config
var model = Olive.Config.Get("OpenAI:Model").Or("gpt-4o");
var apiKey = key.Or(Olive.Config.Get("OpenAI:APIKey"));
var model = Olive.Config.Get("OpenAI:Models:ChatModel").Or("gpt-4o");
var apiKey = key.Or(Olive.Config.Get("OpenAI:Key"));

if (key.IsEmpty())
{
Expand Down

0 comments on commit afb84b5

Please sign in to comment.