Skip to content

Commit

Permalink
fixup! Allow specifying arbitrary "gemini-*" model
Browse files Browse the repository at this point in the history
  • Loading branch information
johnd0e committed Aug 4, 2024
1 parent 7395ed6 commit c11d54b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/worker.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const API_VERSION = "v1beta";
// https://github.com/google/generative-ai-js/blob/0931d2ce051215db72785d76fe3ae4e0bc3b5475/packages/main/src/requests/request.ts#L67
const API_CLIENT = "genai-js/0.16.0"; // npm view @google/generative-ai version
async function handleRequest(req, apiKey) {
const model = req?.model.startsWith("gemini-") ? req.model : DEFAULT_MODEL;
const model = req.model?.startsWith("gemini-") ? req.model : DEFAULT_MODEL;
const TASK = req.stream ? "streamGenerateContent" : "generateContent";
let url = `${BASE_URL}/${API_VERSION}/models/${model}:${TASK}`;
if (req.stream) { url += "?alt=sse"; }
Expand Down

0 comments on commit c11d54b

Please sign in to comment.