Skip to content

Commit

Permalink
add support for google gemini API
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Stanga committed Nov 10, 2024
1 parent 97807d1 commit 57eeabc
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 99 deletions.
184 changes: 92 additions & 92 deletions dist/index.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@actions/core": "^1.11.1",
"@actions/github": "^6.0.0",
"@ai-sdk/anthropic": "^0.0.56",
"@ai-sdk/google": "^0.0.55",
"@ai-sdk/openai": "^0.0.72",
"@octokit/action": "^7.0.0",
"@octokit/plugin-retry": "^7.1.2",
Expand Down
15 changes: 15 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions src/ai.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { generateObject } from "ai";
import { createAnthropic } from "@ai-sdk/anthropic";
import { createOpenAI } from "@ai-sdk/openai";
import { createGoogleGenerativeAI } from "@ai-sdk/google";
import { z } from "zod";
import { info } from "@actions/core";
import config from "./config";
Expand All @@ -20,6 +21,15 @@ const LLM_MODELS = [
name: "gpt-4o-mini",
createAi: createOpenAI,
},
// Google
{
name: "gemini-1.5-flash",
createAi: createGoogleGenerativeAI,
},
{
name: "gemini-1.5-flash-latest",
createAi: createGoogleGenerativeAI,
},
];

export async function runPrompt({
Expand Down
14 changes: 7 additions & 7 deletions src/pull_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ export async function handlePullRequest() {
info(`generated pull request summary: ${summary.title}`);

// Update PR title and description
await octokit.rest.pulls.update({
...context.repo,
pull_number: pull_request.number,
title: summary.title,
body: summary.description,
});
info(`updated pull request title and description`);
// await octokit.rest.pulls.update({
// ...context.repo,
// pull_number: pull_request.number,
// title: summary.title,
// body: summary.description,
// });
// info(`updated pull request title and description`);

// Update overview comment with the walkthrough
await octokit.rest.issues.updateComment({
Expand Down

0 comments on commit 57eeabc

Please sign in to comment.