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

Neo4j (JS) Integration #1128

Open
wants to merge 109 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
28ecb65
Updates example code for Next.js in docs (#857)
philnash Sep 17, 2024
8865e7d
fix(js): disabled explicit json mode when using tools (#888)
cabljac Sep 17, 2024
8611c7e
Add usage and safety score logs for output candidates (#919)
schnecle Sep 17, 2024
0e8d9b8
fix: correctly pass local auth context when doing runFlow (#920)
pavelgj Sep 17, 2024
2940fd5
Update the flow name extraction regex to support the scenario where t…
bryanatkinson Sep 18, 2024
09014eb
Truncate logs based on utf bytes instead of characters. There's no gu…
bryanatkinson Sep 19, 2024
75a16af
feat(js/plugins/vertexai): strict json mode (#890)
cabljac Sep 23, 2024
50cfbe8
fix(docs): replace obsolete package name (#943)
DenisVCode Sep 23, 2024
486dc9d
fix model name lookup in dotprompt plugin and add a test (#933)
dhiaayachi Sep 24, 2024
1f3ca67
chore: update express to 4.21.0 (#956)
tonybaroneee Sep 25, 2024
49c0352
docs(js): update token fetching in ollama docs (#918)
cabljac Sep 26, 2024
4510fff
feat(js): add llama-3.2 support to model garden plugin (#969)
huangjeff5 Sep 26, 2024
03943bc
chore: bump @genkit-ai/tools-common version to @genkit-ai/tools-commo…
gh-action-bump-version Sep 27, 2024
ef93f3f
chore: bump CLI version to genkit@0.5.14
gh-action-bump-version Sep 27, 2024
a15c96b
chore: bump @genkit-ai/core version to @genkit-ai/core@0.5.14
gh-action-bump-version Sep 27, 2024
8ac0750
chore: bump @genkit-ai/ai version to @genkit-ai/ai@0.5.14
gh-action-bump-version Sep 27, 2024
650f3ca
chore: bump @genkit-ai/flow version to @genkit-ai/flow@0.5.14
gh-action-bump-version Sep 27, 2024
696266d
chore: bump genkitx-chromadb version to genkitx-chromadb0.5.14
gh-action-bump-version Sep 27, 2024
69454e2
chore: bump @genkit-ai/dev-local-vectorstore version to @genkit-ai/de…
gh-action-bump-version Sep 27, 2024
e3276c4
chore: bump @genkit-ai/dotprompt version to @genkit-ai/dotprompt@0.5.14
gh-action-bump-version Sep 27, 2024
d60c0ee
chore: bump @genkit-ai/evaluator version to @genkit-ai/evaluator@0.5.14
gh-action-bump-version Sep 27, 2024
87153d8
chore: bump @genkit-ai/firebase version to @genkit-ai/firebase@0.5.14
gh-action-bump-version Sep 27, 2024
56ea3d4
chore: bump @genkit-ai/google-cloud version to @genkit-ai/google-clou…
gh-action-bump-version Sep 27, 2024
5578c15
chore: bump @genkit-ai/googleai version to @genkit-ai/googleai@0.5.14
gh-action-bump-version Sep 27, 2024
8bb2556
chore: bump genkitx-langchain version to genkitx-langchain@0.5.14
gh-action-bump-version Sep 27, 2024
eea8945
chore: bump genkitx-ollama version to genkitx-ollama@0.5.14
gh-action-bump-version Sep 27, 2024
e78ee12
chore: bump genkitx-pinecone version to genkitx-pinecone@0.5.14
gh-action-bump-version Sep 27, 2024
81e4b13
chore: bump @genkit-ai/vertexai version to @genkit-ai/vertexai@0.5.14
gh-action-bump-version Sep 27, 2024
9513f6d
chore: s/GenKit/Genkit/ 🤦
pavelgj Sep 28, 2024
42da470
Set min version for cloud-trace-exporter to 2.4.1 (#984)
MichaelDoyle Oct 1, 2024
1ce4f38
chore: update to pnpm v9.11 (#940) (#941)
tonybaroneee Oct 1, 2024
f90974c
chore: update to pnpm v9.12 (#1000)
tonybaroneee Oct 3, 2024
895249a
Update pull_request_template.md
pavelgj Oct 3, 2024
231591b
feat: added support for image editing and upscaling for imagen3 (#989)
pavelgj Oct 3, 2024
aeb91b0
fix(js): fix streaming json mode in gemini plugins (#1003)
cabljac Oct 3, 2024
efadaa7
chore: bump @genkit-ai/tools-common version to @genkit-ai/tools-commo…
gh-action-bump-version Oct 4, 2024
1cc153f
chore: bump CLI version to genkit@0.5.15
gh-action-bump-version Oct 4, 2024
1485430
chore: bump @genkit-ai/core version to @genkit-ai/core@0.5.15
gh-action-bump-version Oct 4, 2024
b1174f8
chore: bump @genkit-ai/ai version to @genkit-ai/ai@0.5.15
gh-action-bump-version Oct 4, 2024
aaa0749
chore: bump @genkit-ai/flow version to @genkit-ai/flow@0.5.15
gh-action-bump-version Oct 4, 2024
c9de812
chore: bump genkitx-chromadb version to genkitx-chromadb0.5.15
gh-action-bump-version Oct 4, 2024
84062e0
chore: bump @genkit-ai/dev-local-vectorstore version to @genkit-ai/de…
gh-action-bump-version Oct 4, 2024
37e62d7
chore: bump @genkit-ai/dotprompt version to @genkit-ai/dotprompt@0.5.15
gh-action-bump-version Oct 4, 2024
bd532dd
chore: bump @genkit-ai/evaluator version to @genkit-ai/evaluator@0.5.15
gh-action-bump-version Oct 4, 2024
fa4ff92
chore: bump @genkit-ai/firebase version to @genkit-ai/firebase@0.5.15
gh-action-bump-version Oct 4, 2024
746e11b
chore: bump @genkit-ai/google-cloud version to @genkit-ai/google-clou…
gh-action-bump-version Oct 4, 2024
75ba059
chore: bump @genkit-ai/googleai version to @genkit-ai/googleai@0.5.15
gh-action-bump-version Oct 4, 2024
ad306c4
chore: bump genkitx-langchain version to genkitx-langchain@0.5.15
gh-action-bump-version Oct 4, 2024
56a1fc3
chore: bump genkitx-ollama version to genkitx-ollama@0.5.15
gh-action-bump-version Oct 4, 2024
ec8b2da
chore: bump genkitx-pinecone version to genkitx-pinecone@0.5.15
gh-action-bump-version Oct 4, 2024
6d1b9cf
chore: bump @genkit-ai/vertexai version to @genkit-ai/vertexai@0.5.15
gh-action-bump-version Oct 4, 2024
b5ddaea
docs: update vertex-ai.md
pavelgj Oct 4, 2024
8f28a89
chore: update vertex-ai.md
pavelgj Oct 4, 2024
96ea3e8
Added support for Gemini 1.5 Flash 8B and updated available versions …
chrisraygill Oct 4, 2024
e43c1d2
chore: bump @genkit-ai/tools-common version to @genkit-ai/tools-commo…
gh-action-bump-version Oct 4, 2024
0a13ba4
chore: bump CLI version to genkit@0.5.16
gh-action-bump-version Oct 4, 2024
becaf0f
chore: bump @genkit-ai/core version to @genkit-ai/core@0.5.16
gh-action-bump-version Oct 4, 2024
0891884
chore: bump @genkit-ai/ai version to @genkit-ai/ai@0.5.16
gh-action-bump-version Oct 4, 2024
1275b39
chore: bump @genkit-ai/flow version to @genkit-ai/flow@0.5.16
gh-action-bump-version Oct 4, 2024
9163cd0
chore: bump genkitx-chromadb version to genkitx-chromadb0.5.16
gh-action-bump-version Oct 4, 2024
9a19ab9
chore: bump @genkit-ai/dev-local-vectorstore version to @genkit-ai/de…
gh-action-bump-version Oct 4, 2024
e355d13
chore: bump @genkit-ai/dotprompt version to @genkit-ai/dotprompt@0.5.16
gh-action-bump-version Oct 4, 2024
d1d549f
chore: bump @genkit-ai/evaluator version to @genkit-ai/evaluator@0.5.16
gh-action-bump-version Oct 4, 2024
eb23395
chore: bump @genkit-ai/firebase version to @genkit-ai/firebase@0.5.16
gh-action-bump-version Oct 4, 2024
68c5b93
chore: bump @genkit-ai/google-cloud version to @genkit-ai/google-clou…
gh-action-bump-version Oct 4, 2024
ac4019e
chore: bump @genkit-ai/googleai version to @genkit-ai/googleai@0.5.16
gh-action-bump-version Oct 4, 2024
9fbac04
chore: bump genkitx-langchain version to genkitx-langchain@0.5.16
gh-action-bump-version Oct 4, 2024
1830e2d
chore: bump genkitx-ollama version to genkitx-ollama@0.5.16
gh-action-bump-version Oct 4, 2024
99ea10a
chore: bump genkitx-pinecone version to genkitx-pinecone@0.5.16
gh-action-bump-version Oct 4, 2024
7176f8f
chore: bump @genkit-ai/vertexai version to @genkit-ai/vertexai@0.5.16
gh-action-bump-version Oct 4, 2024
080108b
Revamp get started docs (#1016)
chrisraygill Oct 7, 2024
0098ff7
Update imports in index.md (#1018)
kevinthecheung Oct 7, 2024
b582bdc
chore(deps): bump express from 4.19.2 to 4.20.0 in /js (#1007)
dependabot[bot] Oct 9, 2024
53b8b97
chore(deps): bump body-parser from 1.20.2 to 1.20.3 in /js (#1006)
dependabot[bot] Oct 9, 2024
061ab92
fix: added rimraf for building on Windows (#1036)
CorieW Oct 10, 2024
2d38003
feat(js/plugins/ollama): add ollama embeddings back in (after rollbac…
cabljac Oct 21, 2024
a4d01a1
chore(deps): bump body-parser from 1.20.2 to 1.20.3 in /genkit-tools …
dependabot[bot] Oct 21, 2024
cd21d4c
chore: pin package versions in `genkit init` in prep for next release…
pavelgj Oct 21, 2024
4d831e4
Update axios to ^1.7.7 in main (#1084)
tonybaroneee Oct 21, 2024
624a090
fix: made firebase-admin and firebase-functions peers deps more flexi…
pavelgj Oct 22, 2024
93fda18
chore: added release scripts (#1098)
pavelgj Oct 22, 2024
989f82f
Init neo4j
ezhilvendhan Oct 23, 2024
56096c0
Fix compilation, deps, type errors
ezhilvendhan Oct 23, 2024
da55a8e
Add Indexer, Retriever references, fix types
ezhilvendhan Oct 23, 2024
e317473
Fix Retrieval
ezhilvendhan Oct 23, 2024
9f0a337
Fix retrieval
ezhilvendhan Oct 24, 2024
6d2e218
Fix indexer
ezhilvendhan Oct 24, 2024
34b781c
chore: bump @genkit-ai/tools-common version to @genkit-ai/tools-commo…
gh-action-bump-version Oct 24, 2024
0e0718d
chore: bump CLI version to genkit@0.5.17
gh-action-bump-version Oct 24, 2024
348300b
chore: bump @genkit-ai/core version to @genkit-ai/core@0.5.17
gh-action-bump-version Oct 24, 2024
878e335
chore: bump @genkit-ai/ai version to @genkit-ai/ai@0.5.17
gh-action-bump-version Oct 24, 2024
664dcdb
chore: bump @genkit-ai/flow version to @genkit-ai/flow@0.5.17
gh-action-bump-version Oct 24, 2024
af8790c
chore: bump genkitx-chromadb version to genkitx-chromadb0.5.17
gh-action-bump-version Oct 24, 2024
ad30939
chore: bump @genkit-ai/dev-local-vectorstore version to @genkit-ai/de…
gh-action-bump-version Oct 24, 2024
3d367f7
chore: bump @genkit-ai/dotprompt version to @genkit-ai/dotprompt@0.5.17
gh-action-bump-version Oct 24, 2024
5ea220c
chore: bump @genkit-ai/evaluator version to @genkit-ai/evaluator@0.5.17
gh-action-bump-version Oct 24, 2024
08ad0d9
chore: bump @genkit-ai/firebase version to @genkit-ai/firebase@0.5.17
gh-action-bump-version Oct 24, 2024
531368e
chore: bump @genkit-ai/google-cloud version to @genkit-ai/google-clou…
gh-action-bump-version Oct 24, 2024
db430a7
chore: bump @genkit-ai/googleai version to @genkit-ai/googleai@0.5.17
gh-action-bump-version Oct 24, 2024
3704790
chore: bump genkitx-langchain version to genkitx-langchain@0.5.17
gh-action-bump-version Oct 24, 2024
98e6a67
chore: bump genkitx-ollama version to genkitx-ollama@0.5.17
gh-action-bump-version Oct 24, 2024
0a76b84
chore: bump genkitx-pinecone version to genkitx-pinecone@0.5.17
gh-action-bump-version Oct 24, 2024
b7a1569
chore: bump @genkit-ai/vertexai version to @genkit-ai/vertexai@0.5.17
gh-action-bump-version Oct 24, 2024
70bad1b
Merge branch 'firebase:main' into main
ezhilvendhan Oct 25, 2024
a88212d
Refactor to reuse Neo4j driver
ezhilvendhan Oct 26, 2024
445e8fc
Init docs, add keywords
ezhilvendhan Oct 26, 2024
07c2476
Fix Vector Store Constructor
ezhilvendhan Oct 28, 2024
a2d967c
Fix Indexing for empty vector config
ezhilvendhan Oct 28, 2024
e5c6420
Update package.json
ezhilvendhan Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ Description here...

Checklist (if applicable):
- [ ] Tested (manually, unit tested, etc.)
- [ ] Changelog updated
- [ ] Docs updated
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ js/testapps/firebase-functions-sample1/public/config.js
ui-debug.log
firebase-debug.log
**/*.env
.genkit
# RAG sample files
!js/testapps/rag/package.json
js/testapps/rag/*.json
Expand Down
207 changes: 46 additions & 161 deletions docs/get-started.md
Original file line number Diff line number Diff line change
@@ -1,189 +1,74 @@
# Get started

To get started with Firebase Genkit, install the Genkit CLI and run
`genkit init` in a Node.js project. The rest of this page shows you how.
This guide shows you how to get started with Genkit in a Node.js app.

## Requirements
## Prerequisites

Node.js 20 or later.
This guide assumes that you're familiar with building applications with Node.js.

Recommendation: The [`nvm`](https://github.com/nvm-sh/nvm) and
[`nvm-windows`](https://github.com/coreybutler/nvm-windows) tools are a
convenient way to install Node.
To complete this quickstart, make sure that your development environment meets the following requirements:

## Install Genkit {:#install}
* Node.js v20+
* npm

Install the Genkit CLI by running the following command:
## Install Genkit dependencies

```posix-terminal
npm i -g genkit
```

This command installs the Genkit CLI into your Node installation directory
so that it can be used outside of a Node project.
Install the following Genkit dependencies to use Genkit in your project:

## Create and explore a sample project {:#explore}
* `@genkit-ai/ai` and `@genkit-ai/core` provide Genkit core capabilities.
* `@genkit-ai/googleai` provide access to the Google AI Gemini models.
* `genkit` provides the Genkit CLI and tooling to help you test and debug your solution later.

1. Create a new Node project:
```posix-terminal
npm install @genkit-ai/ai @genkit-ai/core @genkit-ai/googleai

```posix-terminal
mkdir genkit-intro && cd genkit-intro
npm install -g genkit
```

npm init -y
```
## Configure your model API key

Look at package.json and make sure the `main` field is set to
`lib/index.js`.
For this guide, we’ll show you how to use the Gemini API which provides a generous free tier and does not require a credit card to get started. To use the Gemini API, you'll need an API key. If you don't already have one, create a key in Google AI Studio.

1. Initialize a Genkit project:
<a class="button" href="https://makersuite.google.com/app/apikey" target="_blank" rel="noopener noreferrer">Get an API key from Google AI Studio</a>

```posix-terminal
genkit init
```

1. Select your model:

- {Gemini (Google AI)}

The simplest way to get started is with Google AI Gemini API. Make sure
it's
[available in your region](https://ai.google.dev/available_regions).

[Generate an API key](https://aistudio.google.com/app/apikey) for the
Gemini API using Google AI Studio. Then, set the `GOOGLE_GENAI_API_KEY`
environment variable to your key:

```posix-terminal
export GOOGLE_GENAI_API_KEY=<your API key>
```
After you’ve created an API key, set the `GOOGLE_GENAI_API_KEY` environment variable to your key with the following command:

- {Gemini (Vertex AI)}

If the Google AI Gemini API is not available in your region, consider
using the Vertex AI API which also offers Gemini and other models. You
will need to have a billing-enabled Google Cloud project, enable AI
Platform API, and set some additional environment variables:

```posix-terminal
gcloud services enable aiplatform.googleapis.com

export GCLOUD_PROJECT=<your project ID>
```
export GOOGLE_GENAI_API_KEY=<your API key>
```

export GCLOUD_LOCATION=us-central1
```
Note: While this tutorial uses the Gemini API from AI Studio, Genkit supports a wide variety of model providers including [Gemini from Vertex AI](https://firebase.google.com/docs/genkit/plugins/vertex-ai#generative_ai_models), Anthropic’s Claude 3 models and Llama 3.1 through the [Vertex AI Model Garden](https://firebase.google.com/docs/genkit/plugins/vertex-ai#anthropic_claude_3_on_vertex_ai_model_garden), open source models through [Ollama](https://firebase.google.com/docs/genkit/plugins/ollama), and several other [community-supported providers](https://firebase.google.com/docs/genkit/models#models-supported) like OpenAI and Cohere.

See https://cloud.google.com/vertex-ai/generative-ai/pricing for Vertex AI pricing.

1. Choose default answers to the rest of the questions, which will
initialize your project folder with some sample code.
## Import the library

The `genkit init` command creates a sample source file, `index.ts`, which
defines a single flow, `menuSuggestionFlow`, that prompts an LLM to suggest
an item for a restaurant with a given theme.
Import the Genkit core libraries and the plugin for the Google AI Gemini APIs.

This file looks something like the following (the plugin configuration steps
might look different if you selected Vertex AI):
```javascript
import { generate } from '@genkit-ai/ai';
import { configureGenkit } from '@genkit-ai/core';
import { googleAI, gemini15Flash } from '@genkit-ai/googleai';
```

```ts
import * as z from 'zod';
## Make your first request

// Import the Genkit core libraries and plugins.
import { generate } from '@genkit-ai/ai';
import { configureGenkit } from '@genkit-ai/core';
import { defineFlow, startFlowsServer } from '@genkit-ai/flow';
import { googleAI } from '@genkit-ai/googleai';
Use the `generate` method to generate a text response.

// Import models from the Google AI plugin. The Google AI API provides access to
// several generative models. Here, we import Gemini 1.5 Flash.
import { gemini15Flash } from '@genkit-ai/googleai';
```javascript
configureGenkit({ plugins: [googleAI()] });

configureGenkit({
plugins: [
// Load the Google AI plugin. You can optionally specify your API key
// by passing in a config object; if you don't, the Google AI plugin uses
// the value from the GOOGLE_GENAI_API_KEY environment variable, which is
// the recommended practice.
googleAI(),
],
// Log debug output to tbe console.
logLevel: 'debug',
// Perform OpenTelemetry instrumentation and enable trace collection.
enableTracingAndMetrics: true,
});
const result = await generate({
model: gemini15Flash,
prompt: 'Tell me a heroic story about a software developer.',
});

// Define a simple flow that prompts an LLM to generate menu suggestions.
export const menuSuggestionFlow = defineFlow(
{
name: 'menuSuggestionFlow',
inputSchema: z.string(),
outputSchema: z.string(),
},
async (subject) => {
// Construct a request and send it to the model API.
const llmResponse = await generate({
prompt: `Suggest an item for the menu of a ${subject} themed restaurant`,
model: gemini15Flash,
config: {
temperature: 1,
},
});

// Handle the response from the model API. In this sample, we just convert
// it to a string, but more complicated flows might coerce the response into
// structured output or chain the response into another LLM call, etc.
return llmResponse.text();
}
);

// Start a flow server, which exposes your flows as HTTP endpoints. This call
// must come last, after all of your plug-in configuration and flow definitions.
// You can optionally specify a subset of flows to serve, and configure some
// HTTP server options, but by default, the flow server serves all defined flows.
startFlowsServer();
```

As you build out your app's AI features with Genkit, you will likely
create flows with multiple steps such as input preprocessing, more
sophisticated prompt construction, integrating external information
sources for retrieval-augmented generation (RAG), and more.

1. Now you can run and explore Genkit features and the sample project locally
on your machine. Download and start the Genkit Developer UI:

```posix-terminal
genkit start
```

<img src="resources/welcome_to_genkit_developer_ui.png" alt="Welcome to Genkit Developer UI" class="screenshot attempt-right">

The Genkit Developer UI is now running on your machine. When you run models
or flows in the next step, your machine will perform the orchestration tasks
needed to get the steps of your flow working together; calls to external
services such as the Gemini API will continue to be made against live
servers.

Also, because you are in a dev environment, Genkit will store traces and
flow state in local files.

1. The Genkit Developer UI downloads and opens automatically when you run the
`genkit start` command.

The Developer UI lets you see which flows you have defined and models you
configured, run them, and examine traces of previous runs. Try out some of
these features:

- On the **Run** tab, you will see a list of all of the flows that you have
defined and any models that have been configured by plugins.

Click **menuSuggestionFlow** and try running it with some input text (for example,
`"cat"`). If all goes well, you'll be rewarded with a menu suggestion for a cat
themed restaurant.

- On the **Inspect** tab, you'll see a history of flow executions. For each
flow, you can see the parameters that were passed to the flow and a
trace of each step as they ran.
console.log(result.text())
```

## Next steps

Check out how to build and deploy your Genkit app with [Firebase](firebase.md),
[Cloud Run](cloud-run.md), or any [Node.js platform](deploy-node.md).
Now that you’re set up to make model requests with Genkit, learn how to use more Genkit capabilities to build your AI-powered apps and workflows. To get started with additional Genkit capabilities, see the following guides:

* [Developer tools](docs/genkit/devtools): Learn how to set up and use Genkit’s CLI and developer UI to help you locally test and debug your app.
* [Generating content](/docs/genkit/models): Learn how to use Genkit’s unified generation API to generate text and structured data from any supported model.
* [Creating flows](docs/genkit/flows): Learn how to use special Genkit functions, called flows, that provide end-to-end observability for workflows and rich debugging from Genkit tooling.
* [Prompting models](/docs/genkit/prompts): Learn how Genkit lets you treat prompt templates as functions, encapsulating model configurations and input/output schema.
18 changes: 9 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ See the following code samples for a concrete idea of how to use these capabilit
- {Basic generation}

```javascript
import { generate } from `@genkit-ai/ai`;
import { generate } from '@genkit-ai/ai';
import { gemini15Flash, claude3Sonnet, llama31 } from '@genkit-ai/vertexai';
import { gpt4o } from 'genkitx-openai';

Expand All @@ -70,9 +70,9 @@ See the following code samples for a concrete idea of how to use these capabilit
- {Structured generation}

```javascript
import { generate } from `@genkit-ai/ai`;
import { gemini15Flash } from `@genkit-ai/googleai`;
import { z } from `zod`;
import { generate } from '@genkit-ai/ai';
import { gemini15Flash } from '@genkit-ai/googleai';
import { z } from 'zod';

const result = await generate({
model: gemini15Flash,
Expand All @@ -95,9 +95,9 @@ See the following code samples for a concrete idea of how to use these capabilit
- {Tool calling}

```javascript
import { generate, defineTool } from `@genkit-ai/ai`;
import { gemini15Flash } from `@genkit-ai/googleai`;
import { z } from `zod`;
import { generate, defineTool } from '@genkit-ai/ai';
import { gemini15Flash } from '@genkit-ai/googleai';
import { z } from 'zod';

// Define tool to get weather data for a given location
const lookupWeather = defineTool({
Expand Down Expand Up @@ -126,9 +126,9 @@ See the following code samples for a concrete idea of how to use these capabilit
- {Retrieval}

```javascript
import { generate, retrieve } from `@genkit-ai/ai`;
import { generate, retrieve } from '@genkit-ai/ai';
import { devLocalRetrieverRef } from '@genkit-ai/dev-local-vectorstore';
import { gemini15Flash } from `@genkit-ai/googleai`;
import { gemini15Flash } from '@genkit-ai/googleai';

// Sample assumes Genkit documentation has been chunked, stored, and indexed in
// local vectorstore in previous step.
Expand Down
2 changes: 1 addition & 1 deletion docs/monitoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ want to enable TTL for the trace documents:
https://firebase.google.com/docs/firestore/ttl

```ts
import { firebase } from '@genkit-ai/plugin-firebase';
import { firebase } from '@genkit-ai/firebase';

configureGenkit({
plugins: [firebase()],
Expand Down
10 changes: 6 additions & 4 deletions docs/nextjs.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,21 +127,23 @@ Node.js 20 or later.
import { useState } from 'react';

export default function Home() {
const [menuItem, setMenu] = useState<string>('');
const [menuItem, setMenuItem] = useState<string>('');

async function getMenuItem(formData: FormData) {
const theme = formData.get('theme')?.toString() ?? '';
const suggestion = await callMenuSuggestionFlow(theme);
setMenu(suggestion);
setMenuItem(suggestion);
}

return (
<main>
<form action={getMenuItem}>
<label>
<label htmlFor="theme">
Suggest a menu item for a restaurant with this theme:{' '}
</label>
<input type="text" name="theme" />
<input type="text" name="theme" id="theme" />
<br />
<br />
<button type="submit">Generate</button>
</form>
<br />
Expand Down
Loading