Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
Refactor [LLM Apis] Google AI (#276)
Browse files Browse the repository at this point in the history
- [+] refactor(google.ts): use dynamic googleApiVersion in chatPath construction
- [+] fix(constant.ts): remove hardcoded version from Google.ChatPath constant
  • Loading branch information
H0llyW00dzZ authored Feb 13, 2024
1 parent 12c7423 commit 302a036
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/client/platforms/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,15 @@ export class GeminiProApi implements LLMApi {
const controller = new AbortController();
options.onController?.(controller);
try {
let chatPath = this.path(Google.ChatPath);
// Note: With this refactoring, it's now possible to use `v1`, `v1beta` in the settings.
// However, this is just temporary and might need to be changed in the future.
let chatPath = this.path(accessStore.googleApiVersion + Google.ChatPath);

// let baseUrl = accessStore.googleUrl;

if (!baseUrl) {
baseUrl = isApp
? DEFAULT_API_HOST + "/api/proxy/google/" + Google.ChatPath
? DEFAULT_API_HOST + "/api/proxy/google/" + accessStore.googleApiVersion + Google.ChatPath
: chatPath;
}

Expand Down
2 changes: 1 addition & 1 deletion app/constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const Azure = {

export const Google = {
ExampleEndpoint: "https://generativelanguage.googleapis.com/",
ChatPath: "v1beta/models/gemini-pro:generateContent",
ChatPath: "/models/gemini-pro:generateContent",

// /api/openai/v1/chat/completions
};
Expand Down

0 comments on commit 302a036

Please sign in to comment.