Skip to content

Commit

Permalink
add perplexity, remove opus
Browse files Browse the repository at this point in the history
  • Loading branch information
chadlangston committed Aug 3, 2024
1 parent bf0045c commit b3d7b60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions ApiClientOpenAI.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ const ApiClient = require('./ApiClient');
const OpenAI = require('openai');

class ApiClientOpenAI extends ApiClient {
constructor(apiKey, messageLog) {
constructor(apiKey, messageLog, baseURL='https://api.openai.com/v1/') {
super(apiKey, messageLog);
this.openai = new OpenAI({ apiKey: this.apiKey });
this.baseURL = baseURL;
this.openai = new OpenAI({ baseURL: this.baseURL, apiKey: this.apiKey });
}

async sendMessage(model) {
Expand Down
6 changes: 3 additions & 3 deletions Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Main {
this.messageLog = new MessageLog();

// Initialize the API client
const api = readlineSync.question('gpt-4=1, gemini-pro=2, claude-sonnet=3, claude-opus=4, mistral=5 (default=1) ');
const api = readlineSync.question('openai=1, gemini=2, claude=3, perplexity=4, mistral=5 (default=1) ');
switch(api) {
case '1':
this.apiClient = new ApiClientOpenAi(process.env.OPENAI_API_KEY, this.messageLog);
Expand All @@ -29,8 +29,8 @@ class Main {
this.model = "claude-3-5-sonnet-20240620";
break;
case '4':
this.apiClient = new ApiClientAnthropic(process.env.ANTHROPIC_API_KEY, this.messageLog);
this.model = "claude-3-opus-20240229";
this.apiClient = new ApiClientOpenAi(process.env.PERPLEXITY_API_KEY, this.messageLog, "https://api.perplexity.ai");
this.model = "llama-3.1-sonar-large-128k-chat";
break;
case '5':
this.apiClient = new ApiClientMistral(process.env.MISTRAL_API_KEY, this.messageLog);
Expand Down

0 comments on commit b3d7b60

Please sign in to comment.