Skip to content

Commit 6863b72

Browse files
BREAKING CHANGE: major refactor done, bump genkit version to 0.9 (#81)
* refactor: major refactor done, bump genkit version to 0.9. Change Pluing API * feat: update README * fix: remove CandidateData * fix: licenses * fix: license * fix: index is not needed * fix: license * fix: licenses * fix: use message * fix: prettier * fix: license * fix: license * fix: bump azure version * feat: update readme * chore(deps-dev): bump typescript-eslint from 8.13.0 to 8.14.0 (#83) Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.13.0 to 8.14.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.14.0/packages/typescript-eslint) --- updated-dependencies: - dependency-name: typescript-eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Xavier Portilla Edo <[email protected]> * feat: final version * fix: fix json output * chore(deps-dev): bump typescript-eslint from 8.13.0 to 8.14.0 (#84) Bumps [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) from 8.13.0 to 8.14.0. - [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases) - [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md) - [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.14.0/packages/typescript-eslint) --- updated-dependencies: - dependency-name: typescript-eslint dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Xavier Portilla Edo <[email protected]> --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
1 parent 585b533 commit 6863b72

File tree

7 files changed

+368
-181
lines changed

7 files changed

+368
-181
lines changed

.github/workflows/depsreview.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ jobs:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12-
- uses: actions/dependency-review-action@v4
12+
- uses: actions/dependency-review-action@v4.3.3
1313
with:
14-
allow-licenses: BSD-2-Clause, BSD-3-Clause, MIT, Apache-2.0, MPL-2.0, ISC, LGPL-3.0, 0BSD
14+
allow-licenses: BSD-2-Clause, MIT, Apache-2.0, MPL-2.0, ISC, LGPL-3.0, 0BSD, BSD-3-Clause, BSD-3-Clause AND BSD-3-Clause-Clear

README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,43 @@ Install the plugin in your project with your favorite package manager:
3333
- `npm install genkitx-github`
3434
- `pnpm add genkitx-github`
3535

36+
### Versions
37+
38+
if you are using Genkit version `<v0.9.0` or lower, please use the plugin version `v1.9.0`. If you are using Genkit `>=v0.9.0`, please use the plugin version `v2.0.0`.
39+
3640
## Usage
3741

3842
### Configuration
3943

40-
To use the plugin, you need to configure it with your GitHub Token key. You can do this by calling the `configureGenkit` function:
44+
To use the plugin, you need to configure it with your GitHub Token key. You can do this by calling the `genkit` function:
4145

4246
```typescript
47+
import { genkit, z } from 'genkit';
4348
import {github, openAIGpt4o} from "genkitx-github";
4449

45-
configureGenkit({
50+
const ai = genkit({
4651
plugins: [
4752
github({
4853
githubToken: '<my-github-token>',
4954
}),
50-
],
51-
logLevel: "debug",
52-
enableTracingAndMetrics: true,
55+
model: openAIGpt4o,
56+
]
5357
});
5458
```
5559

5660
You can also intialize the plugin in this way if you have set the `GITHUB_TOKEN` environment variable:
5761

5862
```typescript
63+
import { genkit, z } from 'genkit';
5964
import {github, openAIGpt4o} from "genkitx-github";
6065

61-
configureGenkit({
66+
const ai = genkit({
6267
plugins: [
63-
github({}),
64-
],
65-
logLevel: "debug",
66-
enableTracingAndMetrics: true,
68+
github({
69+
githubToken: '<my-github-token>',
70+
}),
71+
model: openAIGpt4o,
72+
]
6773
});
6874
```
6975

@@ -72,35 +78,34 @@ configureGenkit({
7278
The simplest way to call the text generation model is by using the helper function `generate`:
7379

7480
```typescript
81+
import { genkit, z } from 'genkit';
7582
import {github, openAIGpt4o} from "genkitx-github";
7683

7784
// Basic usage of an LLM
78-
const response = await generate({
79-
model: openAIGpt4o, // model imported from genkitx-github
85+
const response = await ai.generate({
8086
prompt: 'Tell me a joke.',
8187
});
8288

83-
console.log(await response.text());
89+
console.log(await response.text);
8490
```
8591

8692
### Within a flow
8793

8894
```typescript
8995
// ...configure Genkit (as shown above)...
9096

91-
export const myFlow = defineFlow(
97+
export const myFlow = ai.defineFlow(
9298
{
9399
name: 'menuSuggestionFlow',
94100
inputSchema: z.string(),
95101
outputSchema: z.string(),
96102
},
97103
async (subject) => {
98-
const llmResponse = await generate({
104+
const llmResponse = await ai.generate({
99105
prompt: `Suggest an item for the menu of a ${subject} themed restaurant`,
100-
model: openAIGpt4o,
101106
});
102107

103-
return llmResponse.text();
108+
return llmResponse.text;
104109
}
105110
);
106111
```
@@ -111,7 +116,7 @@ export const myFlow = defineFlow(
111116
// ...configure Genkit (as shown above)...
112117

113118
const specialToolInputSchema = z.object({ meal: z.enum(["breakfast", "lunch", "dinner"]) });
114-
const specialTool = defineTool(
119+
const specialTool = ai.defineTool(
115120
{
116121
name: "specialTool",
117122
description: "Retrieves today's special for the given meal",
@@ -125,13 +130,12 @@ const specialTool = defineTool(
125130
}
126131
);
127132

128-
const result = generate({
129-
model: openAIGpt4o,
133+
const result = ai.generate({
130134
tools: [specialTool],
131135
prompt: "What's for breakfast?",
132136
});
133137

134-
console.log(result.then((res) => res.text()));
138+
console.log(result.then((res) => res.text));
135139
```
136140

137141
For more detailed examples and the explanation of other functionalities, refer to the [official Genkit documentation](https://firebase.google.com/docs/genkit/get-started).

0 commit comments

Comments
 (0)