Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yesudeep/refactor/fixed flight #1629

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
2845d32
docs(eval): fix evaluator plugin docs so code compiles (#1497)
odbol Jan 8, 2025
38baf30
breaking(go): Refactored into instance-based `Genkit` and `Registry`.…
apascal07 Jan 9, 2025
b1869b7
refactor(js/flows): made flow be actually actions, actions can strea,…
pavelgj Jan 10, 2025
817be17
fix(go): Fix TestActionTracing test case (#1595)
hugoaguirre Jan 13, 2025
1bf90ad
feature(go): update flow streaming protocol to SSE (#1316)
hugoaguirre Jan 13, 2025
9f34be4
fix(js): Including missing labels in chat spans
maxl0rd Jan 15, 2025
5d24e23
[Feat][Js] Make ai.generateStream no longer require a double await (#…
inlined Jan 15, 2025
10412f8
docs: Rolls back migration of these samples to the the Firebase repo.…
thedmail Jan 16, 2025
6b541a3
[chore]: Make TSConfig stricter and fix as many errors as possible (#…
inlined Jan 16, 2025
51ebf4e
fix(js/ai): skip response schema validation on tool calls (#1597)
pavelgj Jan 16, 2025
7d22c8b
Update README.md (#1616)
thedmail Jan 16, 2025
d918681
feat(js/ai): stream tools responses (#1614)
pavelgj Jan 16, 2025
55d0801
chore: bump @genkit-ai/tools-common version to @genkit-ai/tools-commo…
gh-action-bump-version Jan 16, 2025
9ff7bcb
chore: bump genkit-cli version to [email protected]
gh-action-bump-version Jan 16, 2025
f3f6b59
chore: bump @genkit-ai/telemetry-server version to @genkit-ai/telemet…
gh-action-bump-version Jan 16, 2025
9399c1b
chore: bump @genkit-ai/core version to @genkit-ai/[email protected]
gh-action-bump-version Jan 16, 2025
1be2da2
chore: bump @genkit-ai/ai version to @genkit-ai/[email protected]
gh-action-bump-version Jan 16, 2025
78f5e07
chore: bump genkit version to [email protected]
gh-action-bump-version Jan 16, 2025
05714e0
chore: bump genkitx-chromadb version to [email protected]
gh-action-bump-version Jan 16, 2025
8e953e4
chore: bump @genkit-ai/dev-local-vectorstore version to @genkit-ai/de…
gh-action-bump-version Jan 16, 2025
d65a865
chore: bump @genkit-ai/dotprompt version to @genkit-ai/[email protected].…
gh-action-bump-version Jan 16, 2025
84f418b
chore: bump @genkit-ai/evaluator version to @genkit-ai/[email protected].…
gh-action-bump-version Jan 16, 2025
55a190a
chore: bump @genkit-ai/firebase version to @genkit-ai/[email protected]
gh-action-bump-version Jan 16, 2025
64a3bd9
chore: bump @genkit-ai/google-cloud version to @genkit-ai/google-clou…
gh-action-bump-version Jan 16, 2025
e34ca51
chore: bump @genkit-ai/googleai version to @genkit-ai/[email protected]
gh-action-bump-version Jan 16, 2025
bde0d2a
chore: bump genkitx-langchain version to [email protected]
gh-action-bump-version Jan 16, 2025
89ceb91
chore: bump genkitx-ollama version to [email protected]
gh-action-bump-version Jan 16, 2025
073f702
chore: bump genkitx-pinecone version to [email protected]
gh-action-bump-version Jan 16, 2025
69a8dca
chore: bump @genkit-ai/vertexai version to @genkit-ai/[email protected]
gh-action-bump-version Jan 16, 2025
a82bc34
chore: bump @genkit-ai/checks version to @genkit-ai/[email protected]
gh-action-bump-version Jan 16, 2025
b853441
chore: bump genkitx-mcp version to [email protected]
gh-action-bump-version Jan 16, 2025
f0ade7e
chore: bump @genkit-ai/express version to @genkit-ai/[email protected]
gh-action-bump-version Jan 16, 2025
3c31306
docs(evals): Updated docs for evals (#1512)
ssbushi Jan 16, 2025
3825822
fix(js): Marking root spans that have failed (#1615)
maxl0rd Jan 17, 2025
a835c64
Update plugin-authoring-evaluator.md (#1619)
thedmail Jan 18, 2025
3a30f31
fix(js): fix end to end tests (#1605)
hugoaguirre Jan 18, 2025
b779219
Log sessionId attribute when present (#1620)
schnecle Jan 21, 2025
9119090
Make the telemetry instructions more clear. (#1627)
mghaznav Jan 21, 2025
f0e991b
Make observability docs more opinionated. (#1628)
mghaznav Jan 21, 2025
4c76127
chore(py): initialize prototype commit
pavelgj Nov 13, 2024
f4b9c3e
chore(py): fixed the simple sampe
pavelgj Jan 17, 2025
fa40fc6
chore(py): updated datamodel-codegen instructions and regenerated for…
pavelgj Jan 17, 2025
5d4e08f
refactor(py): move initial implementation from py into pytemp directo…
yesudeep Jan 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 21 additions & 19 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,24 @@ jobs:
name: Run e2e tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
- name: Set up node v20
uses: actions/setup-node@v4
with:
node-version: 21.x
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Run build script
run: pnpm build
- name: Run pack:all script
run: pnpm pack:all
- name: Run js tests
run: pnpm test:js
- name: Run e2e tests
run: pnpm test:e2e
- name: Validate working directory is clean
run: .github/workflows/scripts/ensure-clean-working-tree.sh
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
- name: Set up node v20
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Run build script
run: pnpm build
- name: Run pack:all script
run: pnpm pack:all
- name: Install local Genkit
run: pnpm link ./js/genkit
- name: Run js tests
run: pnpm test:js
- name: Run e2e tests
run: pnpm test:e2e
- name: Validate working directory is clean
run: .github/workflows/scripts/ensure-clean-working-tree.sh
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ Want to skip the local setup? Click below to try out Genkit using [Project IDX](

Take a look at some samples of Genkit in use:

- ["AI barista"](https://github.com/firebase/quickstart-nodejs/tree/master/genkit/js-coffee-shop) -- demonstrates simple LLM usage
- [A simple chatbot with a JavaScript frontend](https://github.com/firebase/quickstart-nodejs/tree/master/genkit/chatbot) -- add history to LLM sessions
- [Restaurant menu Q&A app](https://github.com/firebase/quickstart-nodejs/tree/master/genkit/js-menu) -- this sample shows progressively
- ["AI barista"](https://github.com/firebase/genkit/blob/main/samples/js-coffee-shop) -- demonstrates simple LLM usage
- [A simple chatbot with a JavaScript frontend](https://github.com/firebase/genkit/blob/main/samples/chatbot) -- add history to LLM sessions
- [Restaurant menu Q&A app](https://github.com/firebase/genkit/blob/main/samples/js-menu) -- this sample shows progressively
more sophisticated versions of a menu understanding app.
- [Streaming to an Angular frontend](https://github.com/firebase/quickstart-nodejs/tree/master/genkit/js-angular)
- [Streaming to an Angular frontend](https://github.com/firebase/genkit/blob/main/samples/js-angular)
- [js-schoolAgent](https://github.com/firebase/genkit/blob/main/samples/js-schoolAgent/): A simple school assistant system with a routing agent and specialized agents
- [Prompts](https://github.com/firebase/genkit/blob/main/samples/prompts/): Shows off several prompting techniques

## Connect with us

Expand Down
45 changes: 23 additions & 22 deletions docs/auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,12 @@ alongside the native flows. You have two options:
1. Use whatever server framework you like, and pass the auth context through via
the flow call as noted above.

1. Use the built-in `startFlowsServer()` and provide Express middleware in the
flow config:
1. Use `startFlowsServer()` available via `@genkit-ai/express` plugin and provide
Express auth middleware in the flow server config:

```ts
import { genkit, z } from 'genkit';
import { startFlowServer, withAuth } from '@genkit-ai/express';

const ai = genkit({ ... });;

Expand All @@ -263,32 +264,32 @@ alongside the native flows. You have two options:
name: 'selfSummaryFlow',
inputSchema: z.object({ uid: z.string() }),
outputSchema: z.string(),
middleware: [
(req, res, next) => {
const token = req.headers['authorization'];
const user = yourVerificationLibrary(token);

// Pass auth information to the flow
req.auth = user;
next();
}
],
authPolicy: (auth, input) => {
if (!auth) {
throw new Error('Authorization required.');
}
if (input.uid !== auth.uid) {
throw new Error('You may only summarize your own profile data.');
}
}
},
async (input) => {
// Flow logic here...
}
);

ai.startFlowServer({
flows: [selfSummaryFlow],
const authProvider = (req, res, next) => {
const token = req.headers['authorization'];
const user = yourVerificationLibrary(token);

// Pass auth information to the flow
req.auth = user;
next();
};

startFlowServer({
flows: [
withAuth(selfSummaryFlow, authProvider, ({ auth, action, input, request }) => {
if (!auth) {
throw new Error('Authorization required.');
}
if (input.uid !== auth.uid) {
throw new Error('You may only summarize your own profile data.');
}
})
],
}); // Registers the middleware
```

Expand Down
4 changes: 3 additions & 1 deletion docs/cloud-run.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,9 @@ endpoints.
When you make the call, specify the flows you want to serve:

```ts
ai.startFlowServer({
import { startFlowServer } from '@genkit-ai/express';

startFlowServer({
flows: [menuSuggestionFlow],
});
```
Expand Down
3 changes: 2 additions & 1 deletion docs/deploy-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ sample flow.
```typescript
import { genkit } from 'genkit';
import { googleAI, gemini15Flash } from '@genkit-ai/googleai';
import { startFlowServer } from '@genkit-ai/express';

const ai = genkit({
plugins: [googleAI()],
Expand All @@ -66,7 +67,7 @@ sample flow.
}
);

ai.startFlowServer({
startFlowServer({
flows: [menuSuggestionFlow],
});
```
Expand Down
Loading
Loading