├── .github ├── CODEOWNERS ├── pull_request_template.md ├── ISSUE_TEMPLATE │ ├── dev-ui-feature.md │ ├── docs.md │ ├── feature_request.md │ ├── go-runtime-bug-report.md │ ├── js-runtime-bug-report.md │ └── py-runtime-bug-report.md └── workflows │ └── scripts │ └── ensure-clean-working-tree.sh ├── py ├── samples │ ├── .gitignore │ ├── menu │ │ ├── data │ │ │ └── menu.jpeg │ │ ├── src │ │ │ ├── case_04 │ │ │ │ ├── example.menuQuestion.json │ │ │ │ ├── __init__.py │ │ │ │ └── flows.py │ │ │ ├── case_02 │ │ │ │ ├── example.json │ │ │ │ └── __init__.py │ │ │ ├── case_05 │ │ │ │ ├── example.visualMenuQuestion.json │ │ │ │ └── __init__.py │ │ │ ├── case_03 │ │ │ │ ├── example.json │ │ │ │ └── __init__.py │ │ │ └── case_01 │ │ │ │ ├── example.json │ │ │ │ └── __init__.py │ │ └── README.md │ ├── google-genai-image │ │ ├── image.jpg │ │ └── README.md │ ├── google-genai-context-caching │ │ └── README.md │ ├── compat-oai-hello │ │ └── README.md │ ├── model-garden │ │ └── README.md │ ├── dev-local-vectorstore-hello │ │ └── README.md │ ├── anthropic-hello │ │ ├── README.md │ │ └── pyproject.toml │ ├── tool-interrupts │ │ └── README.md │ ├── flask-hello │ │ └── README.md │ ├── google-genai-code-execution │ │ └── README.md │ ├── google-genai-hello │ │ └── README.md │ ├── google-genai-vertexai-hello │ │ └── README.md │ ├── firestore-retreiver │ │ └── README.md │ ├── short-n-long │ │ └── src │ │ │ └── short_n_long │ │ │ └── __init__.py │ └── ollama-hello │ │ └── README.md ├── .python-version ├── engdoc │ ├── contributing │ │ ├── git_workflow.md │ │ ├── installation.md │ │ └── troubleshooting.md │ ├── user_guide │ │ ├── introduction.md │ │ ├── developer_tools.md │ │ ├── go │ │ │ └── index.md │ │ ├── typescript │ │ │ └── index.md │ │ └── python │ │ │ └── getting_started.md │ ├── extending │ │ └── tooling │ │ │ └── index.md │ └── assets │ │ ├── logo.png │ │ └── favicon.png ├── packages │ └── genkit │ │ └── src │ │ └── genkit │ │ ├── py.typed │ │ ├── plugins │ │ └── .gitignore │ │ ├── lang │ │ └── __init__.py │ │ └── web │ │ └── __init__.py ├── plugins │ ├── flask │ │ ├── src │ │ │ └── genkit │ │ │ │ └── py.typed │ │ └── README.md │ ├── ollama │ │ └── src │ │ │ └── genkit │ │ │ └── py.typed │ ├── anthropic │ │ ├── src │ │ │ └── genkit │ │ │ │ └── py.typed │ │ ├── README.md │ │ └── tests │ │ │ └── __init__.py │ ├── compat-oai │ │ ├── src │ │ │ └── genkit │ │ │ │ └── py.typed │ │ └── README.md │ ├── evaluators │ │ ├── src │ │ │ ├── genkit │ │ │ │ └── py.typed │ │ │ └── metrics │ │ │ │ └── __init__.py │ │ └── README.md │ ├── firebase │ │ ├── src │ │ │ └── genkit │ │ │ │ └── py.typed │ │ └── README.md │ ├── google-cloud │ │ ├── src │ │ │ └── genkit │ │ │ │ ├── py.typed │ │ │ │ └── plugins │ │ │ │ └── google_cloud │ │ │ │ └── telemetry │ │ │ │ └── __init__.py │ │ └── README.md │ ├── google-genai │ │ ├── src │ │ │ └── genkit │ │ │ │ ├── py.typed │ │ │ │ └── plugins │ │ │ │ └── google_genai │ │ │ │ └── models │ │ │ │ ├── __init__.py │ │ │ │ └── context_caching │ │ │ │ └── __init__.py │ │ └── README.md │ ├── vertex-ai │ │ ├── src │ │ │ ├── genkit │ │ │ │ └── py.typed │ │ │ └── __init__.py │ │ └── README.md │ └── dev-local-vectorstore │ │ ├── tests │ │ └── .gitkeep │ │ ├── README.md │ │ └── src │ │ └── genkit │ │ └── plugins │ │ └── dev_local_vectorstore │ │ └── __init__.py ├── docs │ ├── assets │ │ ├── logo.png │ │ └── favicon.png │ ├── index.md │ └── types.md ├── tests │ └── smoke │ │ └── README.md ├── tox.ini ├── .gitignore ├── README.md └── bin │ ├── cleanup │ └── watch_python_tests ├── js ├── testapps │ ├── esm │ │ ├── .gitignore │ │ ├── docs │ │ │ └── flume-java.pdf │ │ ├── prompts │ │ │ └── myPrompt.prompt │ │ └── tsconfig.json │ ├── rag │ │ ├── .gitignore │ │ ├── docs │ │ │ └── flume-java.pdf │ │ ├── prompts │ │ │ └── myPrompt.prompt │ │ ├── tsconfig.json │ │ └── src │ │ │ └── index.ts │ ├── context-caching │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ └── package.json │ ├── context-caching2 │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ └── package.json │ ├── mcp │ │ ├── README.md │ │ ├── test-workspace │ │ │ └── hello-world.txt │ │ └── tsconfig.json │ ├── durable-streaming │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ └── package.json │ ├── menu │ │ ├── src │ │ │ ├── 04 │ │ │ │ └── example.menuQuestion.json │ │ │ ├── 02 │ │ │ │ └── example.json │ │ │ ├── 05 │ │ │ │ └── example.visualMenuQuestion.json │ │ │ └── 01 │ │ │ │ └── example.json │ │ ├── data │ │ │ └── menu.jpeg │ │ └── tsconfig.json │ ├── compat-oai │ │ ├── photo.jpg │ │ ├── tsconfig.json │ │ └── README.md │ ├── basic-gemini │ │ ├── my_room.png │ │ ├── photo.jpg │ │ ├── palm_tree.png │ │ └── tsconfig.json │ ├── evals │ │ ├── docs │ │ │ ├── cat-wiki.pdf │ │ │ └── cat-handbook.pdf │ │ ├── prompts │ │ │ └── hello.prompt │ │ ├── data │ │ │ ├── cat_adoption_questions.jsonl │ │ │ └── cat_adoption_questions_with_reference.json │ │ ├── tsconfig.json │ │ └── src │ │ │ └── index.ts │ ├── flow-simple-ai │ │ ├── photo.jpg │ │ ├── prompts │ │ │ ├── TellJoke.prompt │ │ │ └── dotpromptContext.prompt │ │ └── tsconfig.json │ ├── vertexai-reranker │ │ ├── .env.example │ │ ├── tsconfig.json │ │ └── src │ │ │ └── config.ts │ ├── multimodal │ │ ├── docs │ │ │ └── BirthdayPets.pdf │ │ ├── tsconfig.json │ │ └── src │ │ │ └── index.ts │ ├── docs-menu-rag │ │ ├── docs │ │ │ └── GenkitGrubPub.pdf │ │ ├── tsconfig.json │ │ └── README.md │ ├── express │ │ ├── prompts │ │ │ └── TellJoke.prompt │ │ └── tsconfig.json │ ├── anthropic │ │ ├── src │ │ │ └── stable │ │ │ │ └── attention-first-page.pdf │ │ └── tsconfig.json │ ├── firebase-functions-sample1 │ │ ├── functions │ │ │ ├── prompts │ │ │ │ └── TellJoke.prompt │ │ │ └── tsconfig.json │ │ ├── package.json │ │ └── firebase.json │ ├── prompt-file │ │ ├── prompts │ │ │ ├── _style.prompt │ │ │ ├── story.prompt │ │ │ ├── recipe.prompt │ │ │ └── recipe.robot.prompt │ │ ├── tsconfig.json │ │ └── package.json │ ├── dev-ui-gallery │ │ ├── prompts │ │ │ ├── hello.first-last-name.prompt │ │ │ ├── hello.json-output.prompt │ │ │ ├── hello.system.prompt │ │ │ ├── media │ │ │ │ └── imagen3.prompt │ │ │ ├── code.prompt │ │ │ ├── tools │ │ │ │ └── weather.prompt │ │ │ ├── hello.prompt │ │ │ └── markdown.prompt │ │ ├── tsconfig.json │ │ └── src │ │ │ └── index.ts │ ├── ollama │ │ ├── tsconfig.json │ │ └── package.json │ ├── model-armor │ │ ├── tsconfig.json │ │ └── package.json │ ├── docs-menu-basic │ │ ├── tsconfig.json │ │ ├── README.md │ │ └── package.json │ ├── vertexai-modelgarden │ │ ├── tsconfig.json │ │ └── package.json │ ├── vertexai-vector-search-custom │ │ ├── tsconfig.json │ │ └── .env.example │ ├── vertexai-vector-search-bigquery │ │ ├── tsconfig.json │ │ └── .env.example │ ├── vertexai-vector-search-firestore │ │ ├── tsconfig.json │ │ └── .env.example │ ├── flow-sample1 │ │ ├── tsconfig.json │ │ └── package.json │ ├── format-tester │ │ ├── tsconfig.json │ │ └── package.json │ ├── model-tester │ │ └── tsconfig.json │ ├── custom-evaluators │ │ ├── tsconfig.json │ │ └── package.json │ ├── multiagents-demo │ │ ├── tsconfig.json │ │ └── src │ │ │ ├── data │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ ├── config │ │ │ └── genkit.ts │ │ │ └── flows │ │ │ └── index.ts │ └── next │ │ ├── src │ │ └── app │ │ │ ├── page.module.css │ │ │ └── api │ │ │ └── joke │ │ │ └── route.ts │ │ └── tsconfig.json ├── plugins │ ├── cloud-sql-pg │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── anthropic │ │ ├── .gitignore │ │ ├── tsconfig.json │ │ ├── .npmignore │ │ ├── NOTICE │ │ ├── src │ │ │ └── runner │ │ │ │ └── index.ts │ │ └── tsup.config.ts │ ├── evaluators │ │ ├── .gitignore │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ └── README.md │ ├── checks │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── chroma │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ ├── README.md │ │ └── tsup.config.ts │ ├── express │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── mcp │ │ ├── .npmignore │ │ ├── tsconfig.json │ │ ├── examples │ │ │ ├── server │ │ │ │ ├── package.json │ │ │ │ └── prompts │ │ │ │ │ └── port_code.prompt │ │ │ └── client │ │ │ │ └── package.json │ │ ├── src │ │ │ └── util │ │ │ │ └── index.ts │ │ └── tsup.config.ts │ ├── next │ │ ├── typedoc.json │ │ ├── .npmignore │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── ollama │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── googleai │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ ├── README.md │ │ └── tsup.config.ts │ ├── langchain │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── README.md │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── pinecone │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── vertexai │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ ├── src │ │ │ ├── common │ │ │ │ └── constants.ts │ │ │ └── rerankers │ │ │ │ └── index.ts │ │ ├── README.md │ │ └── tsup.config.ts │ ├── compat-oai │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ ├── .npmignore │ │ └── tsup.config.ts │ ├── google-cloud │ │ ├── typedoc.json │ │ ├── .npmignore │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── dev-local-vectorstore │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── firebase │ │ ├── .npmignore │ │ ├── typedoc.json │ │ ├── tests │ │ │ └── emulator │ │ │ │ └── firebase.json │ │ ├── tsconfig.json │ │ ├── src │ │ │ ├── beta.ts │ │ │ └── helpers.ts │ │ └── tsup.config.ts │ └── google-genai │ │ ├── tsconfig.json │ │ └── tsup.config.ts ├── ai │ ├── .npmignore │ ├── tsconfig.json │ ├── README.md │ ├── typedoc.json │ ├── src │ │ └── testing │ │ │ └── index.ts │ └── tsup.config.ts ├── core │ ├── .npmignore │ ├── tsconfig.json │ ├── typedoc.json │ ├── README.md │ └── tsup.config.ts ├── tsconfig.dev.json ├── genkit │ ├── .npmignore │ ├── .guides │ │ └── style.md │ ├── tests │ │ └── prompts │ │ │ ├── test.prompt │ │ │ ├── chat_preamble.prompt │ │ │ ├── sub │ │ │ └── test.prompt │ │ │ ├── toolPrompt.prompt │ │ │ ├── test.variant.prompt │ │ │ ├── badSchemaRef.prompt │ │ │ ├── output.prompt │ │ │ ├── schemaRef.prompt │ │ │ └── kitchensink.prompt │ ├── tsconfig.json │ ├── typedoc.json │ ├── src │ │ ├── logging.ts │ │ ├── testing.ts │ │ ├── extract.ts │ │ ├── formats.ts │ │ ├── registry.ts │ │ ├── context.ts │ │ └── tool.ts │ └── tsup.config.ts ├── doc-snippets │ ├── src │ │ └── dotprompt │ │ │ └── prompts │ │ │ ├── ex02.prompt │ │ │ ├── ex05.prompt │ │ │ ├── ex08.prompt │ │ │ ├── ex03.prompt │ │ │ ├── ex07.prompt │ │ │ ├── ex06.prompt │ │ │ ├── ex04.prompt │ │ │ └── ex01.prompt │ ├── tsconfig.json │ └── package.json └── tsconfig.json ├── samples ├── js-angular │ ├── .gitignore │ ├── genkit-app │ │ ├── public │ │ │ └── favicon.ico │ │ ├── tsconfig.spec.json │ │ ├── tsconfig.app.json │ │ ├── .editorconfig │ │ ├── src │ │ │ └── app │ │ │ │ ├── home │ │ │ │ └── home.component.scss │ │ │ │ └── samples │ │ │ │ └── streaming-json │ │ │ │ └── streaming-json.component.scss │ │ └── .gitignore │ ├── server │ │ ├── tsconfig.json │ │ ├── src │ │ │ └── genkit.ts │ │ └── package.json │ └── package.json ├── js-chatbot │ ├── .gitignore │ ├── genkit-app │ │ ├── public │ │ │ └── favicon.ico │ │ ├── proxy.conf.json │ │ ├── tsconfig.spec.json │ │ ├── tsconfig.app.json │ │ ├── .editorconfig │ │ └── .gitignore │ ├── eval.json │ └── server │ │ └── tsconfig.json ├── js-menu │ ├── .gitignore │ ├── src │ │ ├── 04 │ │ │ └── example.menuQuestion.json │ │ ├── 02 │ │ │ └── example.json │ │ ├── 05 │ │ │ └── example.visualMenuQuestion.json │ │ ├── 03 │ │ │ └── example.json │ │ └── 01 │ │ │ └── example.json │ ├── data │ │ └── menu.jpeg │ └── tsconfig.json ├── js-character-generator │ ├── .gitignore │ ├── idx-template.json │ ├── tsconfig.json │ ├── README_IDX.md │ └── package.json ├── js-gemini │ ├── photo.jpg │ ├── my_room.png │ ├── palm_tree.png │ ├── README.md │ ├── tsconfig.json │ └── package.json ├── js-openai │ ├── photo.jpg │ ├── README.md │ ├── tsconfig.json │ └── package.json ├── js-schoolAgent │ ├── prompts │ │ └── myPrompt.prompt │ └── tsconfig.json ├── js-coffee-shop │ ├── README.md │ ├── src │ │ └── input.json │ └── tsconfig.json └── js-prompts │ ├── tsconfig.json │ ├── README.md │ └── package.json ├── docs ├── resources │ ├── genkit-logo.png │ ├── genkit-logo-dark.png │ └── readme-ui-traces-screenshot.png └── README.md ├── genkit-tools ├── cli │ ├── .npmignore │ ├── tsconfig.json │ └── src │ │ ├── commands │ │ └── init-ai-tools │ │ │ └── index.ts │ │ └── bin │ │ └── genkit.ts ├── telemetry-server │ ├── .npmignore │ ├── tsconfig.esm.json │ ├── tsconfig.cjs.json │ ├── tsconfig.types.json │ ├── tsconfig.json │ └── README.md ├── common │ ├── .npmignore │ ├── tsconfig.esm.json │ ├── tsconfig.cjs.json │ ├── tsconfig.types.json │ ├── tsconfig.json │ └── src │ │ ├── server │ │ └── index.ts │ │ ├── plugin │ │ └── index.ts │ │ └── utils │ │ └── package.ts ├── tsconfig.base.json └── pnpm-workspace.yaml ├── go ├── samples │ ├── files-api-vision │ │ └── test.jpg │ ├── menu │ │ └── testdata │ │ │ └── menu.jpeg │ ├── text-to-speech │ │ └── genkit.wav │ ├── prompts │ │ └── prompts │ │ │ ├── media.prompt │ │ │ ├── multi-msg.prompt │ │ │ ├── countries.prompt │ │ │ └── recipe.prompt │ ├── rag │ │ └── data │ │ │ └── eval-inputs.json │ └── prompts-dir │ │ └── prompts │ │ └── example.prompt ├── README.md └── internal │ └── cmd │ ├── jsonschemagen │ └── testdata │ │ └── test.config │ └── copy │ └── testdata │ └── simple.txt ├── .prettierignore ├── .hooks ├── conventional-commit-msg ├── no-commits-on-branches └── commit-message-format-pre-push ├── bin └── check-licenses ├── tests ├── tsconfig.json └── test_js_app │ ├── tsconfig.json │ └── package.json ├── .editorconfig ├── .npmrc ├── taplo.toml └── .prettierrc.yaml /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /py/samples/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/.python-version: -------------------------------------------------------------------------------- 1 | 3.12 2 | -------------------------------------------------------------------------------- /js/testapps/esm/.gitignore: -------------------------------------------------------------------------------- 1 | .genkit -------------------------------------------------------------------------------- /js/testapps/rag/.gitignore: -------------------------------------------------------------------------------- 1 | .genkit -------------------------------------------------------------------------------- /samples/js-angular/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /samples/js-chatbot/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /py/engdoc/contributing/git_workflow.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/engdoc/contributing/installation.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/engdoc/user_guide/introduction.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/packages/genkit/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/flask/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/ollama/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /js/testapps/context-caching/.gitignore: -------------------------------------------------------------------------------- 1 | data -------------------------------------------------------------------------------- /js/testapps/context-caching2/.gitignore: -------------------------------------------------------------------------------- 1 | data -------------------------------------------------------------------------------- /js/testapps/mcp/README.md: -------------------------------------------------------------------------------- 1 | # MCP sample 2 | -------------------------------------------------------------------------------- /py/engdoc/contributing/troubleshooting.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/engdoc/user_guide/developer_tools.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/anthropic/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/compat-oai/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/evaluators/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/firebase/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/google-cloud/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/google-genai/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/vertex-ai/src/genkit/py.typed: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /js/plugins/cloud-sql-pg/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /py/engdoc/user_guide/go/index.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | -------------------------------------------------------------------------------- /py/packages/genkit/src/genkit/plugins/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /py/plugins/dev-local-vectorstore/tests/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /samples/js-menu/.gitignore: -------------------------------------------------------------------------------- 1 | __db_menu-items.json -------------------------------------------------------------------------------- /js/testapps/durable-streaming/.gitignore: -------------------------------------------------------------------------------- 1 | .firebaserc -------------------------------------------------------------------------------- /js/testapps/mcp/test-workspace/hello-world.txt: -------------------------------------------------------------------------------- 1 | Hi! -------------------------------------------------------------------------------- /py/engdoc/extending/tooling/index.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | -------------------------------------------------------------------------------- /py/engdoc/user_guide/typescript/index.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | -------------------------------------------------------------------------------- /js/ai/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/core/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/tsconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [".eslintrc.js"] 3 | } 4 | -------------------------------------------------------------------------------- /js/genkit/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/anthropic/.gitignore: -------------------------------------------------------------------------------- 1 | lib/ 2 | node_modules/ 3 | coverage/ 4 | -------------------------------------------------------------------------------- /js/plugins/evaluators/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /js/plugins/checks/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/chroma/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/express/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/mcp/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/next/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/ollama/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/checks/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/chroma/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/evaluators/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/express/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/googleai/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/googleai/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/langchain/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/langchain/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/ollama/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/pinecone/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/pinecone/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/vertexai/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/cloud-sql-pg/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/compat-oai/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/evaluators/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/google-cloud/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /samples/js-character-generator/.gitignore: -------------------------------------------------------------------------------- 1 | test/ 2 | node_modules/ 3 | .genkit/ 4 | *.js -------------------------------------------------------------------------------- /js/ai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/plugins/dev-local-vectorstore/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/dev-local-vectorstore/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/firebase/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jest.config.ts 3 | tsconfig.json 4 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/next/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jest.config.ts 3 | tsconfig.json 4 | tsup.config.ts -------------------------------------------------------------------------------- /py/docs/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/py/docs/assets/logo.png -------------------------------------------------------------------------------- /js/plugins/google-cloud/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jest.config.ts 3 | tsconfig.json 4 | tsup.config.ts -------------------------------------------------------------------------------- /py/docs/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/py/docs/assets/favicon.png -------------------------------------------------------------------------------- /py/engdoc/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/py/engdoc/assets/logo.png -------------------------------------------------------------------------------- /js/plugins/checks/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/plugins/mcp/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/plugins/ollama/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/testapps/menu/src/04/example.menuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like something cheesy!" 3 | } 4 | -------------------------------------------------------------------------------- /py/engdoc/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/py/engdoc/assets/favicon.png -------------------------------------------------------------------------------- /samples/js-gemini/photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/samples/js-gemini/photo.jpg -------------------------------------------------------------------------------- /samples/js-menu/src/04/example.menuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like something cheesy!" 3 | } 4 | -------------------------------------------------------------------------------- /samples/js-openai/photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/samples/js-openai/photo.jpg -------------------------------------------------------------------------------- /docs/resources/genkit-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/docs/resources/genkit-logo.png -------------------------------------------------------------------------------- /genkit-tools/cli/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | plugins/ 3 | common/ 4 | ui/ 5 | jest.config.ts 6 | tsconfig.json -------------------------------------------------------------------------------- /js/genkit/.guides/style.md: -------------------------------------------------------------------------------- 1 | - Prefer destructuring generate calls e.g. `const {text} = await ai.generate(...)` 2 | -------------------------------------------------------------------------------- /js/genkit/tests/prompts/test.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | config: 3 | temperature: 11 4 | --- 5 | Hello from the prompt file -------------------------------------------------------------------------------- /js/plugins/anthropic/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/plugins/compat-oai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/plugins/evaluators/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/plugins/express/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/plugins/googleai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/testapps/menu/data/menu.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/menu/data/menu.jpeg -------------------------------------------------------------------------------- /py/samples/menu/data/menu.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/py/samples/menu/data/menu.jpeg -------------------------------------------------------------------------------- /py/samples/menu/src/case_04/example.menuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like something cheesy!" 3 | } 4 | -------------------------------------------------------------------------------- /samples/js-gemini/my_room.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/samples/js-gemini/my_room.png -------------------------------------------------------------------------------- /samples/js-gemini/palm_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/samples/js-gemini/palm_tree.png -------------------------------------------------------------------------------- /samples/js-menu/data/menu.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/samples/js-menu/data/menu.jpeg -------------------------------------------------------------------------------- /genkit-tools/telemetry-server/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.cjs.json 3 | tsconfig.esm.json 4 | tsconfig.json -------------------------------------------------------------------------------- /js/testapps/compat-oai/photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/compat-oai/photo.jpg -------------------------------------------------------------------------------- /py/engdoc/user_guide/python/getting_started.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ::: genkit.core.action.types.ActionKind 4 | -------------------------------------------------------------------------------- /docs/resources/genkit-logo-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/docs/resources/genkit-logo-dark.png -------------------------------------------------------------------------------- /genkit-tools/common/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jest.config.ts 3 | tsconfig.cjs.json 4 | tsconfig.esm.json 5 | tsconfig.json -------------------------------------------------------------------------------- /go/samples/files-api-vision/test.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/go/samples/files-api-vision/test.jpg -------------------------------------------------------------------------------- /go/samples/menu/testdata/menu.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/go/samples/menu/testdata/menu.jpeg -------------------------------------------------------------------------------- /go/samples/text-to-speech/genkit.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/go/samples/text-to-speech/genkit.wav -------------------------------------------------------------------------------- /js/plugins/dev-local-vectorstore/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/testapps/basic-gemini/my_room.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/basic-gemini/my_room.png -------------------------------------------------------------------------------- /js/testapps/basic-gemini/photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/basic-gemini/photo.jpg -------------------------------------------------------------------------------- /js/testapps/esm/docs/flume-java.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/esm/docs/flume-java.pdf -------------------------------------------------------------------------------- /js/testapps/esm/prompts/myPrompt.prompt: -------------------------------------------------------------------------------- 1 | {{ role "system" }} your name is {{ @state.userName }}, always introduce yourself) -------------------------------------------------------------------------------- /js/testapps/evals/docs/cat-wiki.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/evals/docs/cat-wiki.pdf -------------------------------------------------------------------------------- /js/testapps/flow-simple-ai/photo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/flow-simple-ai/photo.jpg -------------------------------------------------------------------------------- /js/testapps/rag/docs/flume-java.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/rag/docs/flume-java.pdf -------------------------------------------------------------------------------- /js/testapps/rag/prompts/myPrompt.prompt: -------------------------------------------------------------------------------- 1 | {{ role "system" }} your name is {{ @state.userName }}, always introduce yourself) -------------------------------------------------------------------------------- /samples/js-menu/src/02/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like to try something spicy. What do you recommend?" 3 | } 4 | -------------------------------------------------------------------------------- /js/genkit/tests/prompts/chat_preamble.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | config: 3 | version: 'abc' 4 | --- 5 | hi {{ name }} from template 6 | -------------------------------------------------------------------------------- /js/genkit/tests/prompts/sub/test.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | config: 3 | temperature: 12 4 | --- 5 | Hello from the sub folder prompt file -------------------------------------------------------------------------------- /js/testapps/basic-gemini/palm_tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/basic-gemini/palm_tree.png -------------------------------------------------------------------------------- /js/testapps/menu/src/02/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like to try something spicy. What do you recommend?" 3 | } 4 | -------------------------------------------------------------------------------- /js/testapps/menu/src/05/example.visualMenuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "What kind of burger buns do you have?" 3 | } 4 | -------------------------------------------------------------------------------- /py/samples/menu/src/case_02/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like to try something spicy. What do you recommend?" 3 | } 4 | -------------------------------------------------------------------------------- /samples/js-menu/src/05/example.visualMenuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "What kind of burger buns do you have?" 3 | } 4 | -------------------------------------------------------------------------------- /samples/js-schoolAgent/prompts/myPrompt.prompt: -------------------------------------------------------------------------------- 1 | {{ role "system" }} your name is {{ @state.userName }}, always introduce yourself) -------------------------------------------------------------------------------- /js/testapps/evals/docs/cat-handbook.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/evals/docs/cat-handbook.pdf -------------------------------------------------------------------------------- /py/samples/google-genai-image/image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/py/samples/google-genai-image/image.jpg -------------------------------------------------------------------------------- /py/samples/menu/src/case_05/example.visualMenuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "What kind of burger buns do you have?" 3 | } 4 | -------------------------------------------------------------------------------- /js/testapps/vertexai-reranker/.env.example: -------------------------------------------------------------------------------- 1 | # .env.example 2 | 3 | PROJECT_ID=your_project_id_here 4 | LOCATION=your_location_here 5 | -------------------------------------------------------------------------------- /docs/resources/readme-ui-traces-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/docs/resources/readme-ui-traces-screenshot.png -------------------------------------------------------------------------------- /js/testapps/multimodal/docs/BirthdayPets.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/multimodal/docs/BirthdayPets.pdf -------------------------------------------------------------------------------- /py/plugins/flask/README.md: -------------------------------------------------------------------------------- 1 | # Genkit Flask plugin 2 | 3 | This Genkit plugin provides a set of tools and utilities for working with Flask. 4 | -------------------------------------------------------------------------------- /samples/js-menu/src/03/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "sessionId": "session123", 3 | "question": "Do you have anything healthy on this menu?" 4 | } 5 | -------------------------------------------------------------------------------- /js/testapps/docs-menu-rag/docs/GenkitGrubPub.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/docs-menu-rag/docs/GenkitGrubPub.pdf -------------------------------------------------------------------------------- /js/testapps/express/prompts/TellJoke.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | modelProvider: google-vertex 3 | modelName: gemini-pro 4 | --- 5 | Tell a joke about {subject} -------------------------------------------------------------------------------- /py/samples/menu/src/case_03/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "sessionId": "session123", 3 | "question": "Do you have anything healthy on this menu?" 4 | } 5 | -------------------------------------------------------------------------------- /samples/js-angular/genkit-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/samples/js-angular/genkit-app/public/favicon.ico -------------------------------------------------------------------------------- /samples/js-chatbot/genkit-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/samples/js-chatbot/genkit-app/public/favicon.ico -------------------------------------------------------------------------------- /js/plugins/google-genai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "exclude": ["node_modules"] 5 | } 6 | -------------------------------------------------------------------------------- /py/plugins/firebase/README.md: -------------------------------------------------------------------------------- 1 | # Genkit Firebase plugin 2 | 3 | This Genkit plugin provides a set of tools and utilities for working with 4 | Firebase. 5 | -------------------------------------------------------------------------------- /py/tests/smoke/README.md: -------------------------------------------------------------------------------- 1 | # Packaging Smoke Test 2 | 3 | This is a smoke test for the packaging system 4 | to ensure that our imports work as expected. 5 | -------------------------------------------------------------------------------- /samples/js-coffee-shop/README.md: -------------------------------------------------------------------------------- 1 | # Running the sample 2 | 3 | ```bash 4 | export GOOGLE_GENAI_API_KEY= 5 | npm i 6 | npm run genkit:dev 7 | ``` 8 | -------------------------------------------------------------------------------- /py/plugins/google-cloud/README.md: -------------------------------------------------------------------------------- 1 | # Google Cloud Plugin 2 | 3 | This Genkit plugin provides a set of tools and utilities for working with Google 4 | Cloud. 5 | -------------------------------------------------------------------------------- /py/plugins/google-genai/README.md: -------------------------------------------------------------------------------- 1 | # Genkit Google AI plugin 2 | 3 | This Genkit plugin provides a set of tools and utilities for working with 4 | Google AI. 5 | -------------------------------------------------------------------------------- /js/genkit/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "lib": ["es2022", "DOM"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /js/testapps/anthropic/src/stable/attention-first-page.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/HEAD/js/testapps/anthropic/src/stable/attention-first-page.pdf -------------------------------------------------------------------------------- /py/plugins/anthropic/README.md: -------------------------------------------------------------------------------- 1 | # Genkit Anthropic model provider Plugin 2 | 3 | This Genkit plugin provides a set of tools and utilities for working with Anthropic. -------------------------------------------------------------------------------- /py/samples/menu/README.md: -------------------------------------------------------------------------------- 1 | # Menu Sample 2 | 3 | ## Run the sample 4 | 5 | TODO 6 | 7 | ```bash 8 | genkit start -- uv run src/menu_example.py 9 | ``` 10 | -------------------------------------------------------------------------------- /go/README.md: -------------------------------------------------------------------------------- 1 | # Genkit 2 | 3 | This package is the Go version of Genkit, a framework for building 4 | AI-powered apps. See: https://genkit.dev/go/docs/get-started-go 5 | -------------------------------------------------------------------------------- /js/genkit/tests/prompts/toolPrompt.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | description: prompt in a file 3 | tools: 4 | - agentA 5 | --- 6 | {{ role "system" }} {{ @state.name }} toolPrompt prompt -------------------------------------------------------------------------------- /py/plugins/compat-oai/README.md: -------------------------------------------------------------------------------- 1 | # OpenAI API Compatible model provider Plugin 2 | 3 | This Genkit plugin provides a set of tools and utilities for working with OpenAI. 4 | -------------------------------------------------------------------------------- /samples/js-menu/src/01/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "input": { 3 | "question": "Which of your burgers would you recommend for someone like me who loves bacon?" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /genkit-tools/common/tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib/esm", 5 | "module": "esnext" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /js/testapps/firebase-functions-sample1/functions/prompts/TellJoke.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | modelProvider: google-vertex 3 | modelName: gemini-2.5-pro 4 | --- 5 | Tell a joke about {subject} -------------------------------------------------------------------------------- /js/testapps/menu/src/01/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "input": { 3 | "question": "Which of your burgers would you recommend for someone like me who loves bacon?" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /js/testapps/prompt-file/prompts/_style.prompt: -------------------------------------------------------------------------------- 1 | {{ role "system" }} 2 | You should speak as if you are a {{#if personality}}{{personality}}{{else}}pirate{{/if}}. 3 | {{role "user"}} -------------------------------------------------------------------------------- /py/plugins/dev-local-vectorstore/README.md: -------------------------------------------------------------------------------- 1 | # Dev Local Vector Store Plugin 2 | 3 | Local file-based vectorstore plugin that provides retriever and indexer helper for Genkit. 4 | -------------------------------------------------------------------------------- /py/plugins/vertex-ai/README.md: -------------------------------------------------------------------------------- 1 | # Google Cloud Vertex AI Plugin 2 | 3 | This Genkit plugin provides a set of tools and utilities for working with Google 4 | Cloud Vertex AI. 5 | -------------------------------------------------------------------------------- /py/samples/menu/src/case_01/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "input": { 3 | "question": "Which of your burgers would you recommend for someone like me who loves bacon?" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /genkit-tools/common/tsconfig.cjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib/cjs", 5 | "module": "commonjs" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /js/genkit/tests/prompts/test.variant.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | description: a prompt variant in a file 3 | config: 4 | temperature: 13 5 | --- 6 | Hello from a variant of the hello prompt 7 | -------------------------------------------------------------------------------- /js/plugins/cloud-sql-pg/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "skipLibCheck": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /js/testapps/flow-simple-ai/prompts/TellJoke.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | input: 4 | schema: 5 | subject: string 6 | --- 7 | Tell a joke about {subject} -------------------------------------------------------------------------------- /samples/js-coffee-shop/src/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "start": { 3 | "customerName": "sam", 4 | "currentTime": "12:30AM", 5 | "previousOrders": ["Americano"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .github/ 2 | .mypy_cache/* 3 | .prettierrc.yaml 4 | docs/* 5 | genkit-tools/genkit-schema.json 6 | go/ 7 | pnpm-lock.yaml 8 | public/ 9 | py/* 10 | README.md 11 | -------------------------------------------------------------------------------- /genkit-tools/telemetry-server/tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib/esm", 5 | "module": "esnext" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /samples/js-chatbot/genkit-app/proxy.conf.json: -------------------------------------------------------------------------------- 1 | { 2 | "/chatbotFlow": { 3 | "target": "http://localhost:3400/", 4 | "secure": false, 5 | "logLevel": "debug" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /genkit-tools/telemetry-server/tsconfig.cjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib/cjs", 5 | "module": "commonjs" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex02.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-2.5-flash 3 | --- 4 | You are the world's most welcoming AI assistant. Greet the user and offer your assistance. -------------------------------------------------------------------------------- /js/genkit/tests/prompts/badSchemaRef.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | input: 4 | schema: badSchemaRef1 5 | output: 6 | schema: badSchemaRef2 7 | --- 8 | 9 | doesn't matter -------------------------------------------------------------------------------- /js/plugins/firebase/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": [ 3 | "src/context.ts", 4 | "src/index.ts", 5 | "src/user_engagement.ts", 6 | "src/beta/data-connect.ts" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /js/plugins/evaluators/README.md: -------------------------------------------------------------------------------- 1 | These evaluators were based on https://github.com/explodinggradients/ragas evaluators, but have been ported to Typescript and modified to work best with Gemini models. 2 | -------------------------------------------------------------------------------- /.hooks/conventional-commit-msg: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2025 Google LLC 4 | # SPDX-License-Identifier: Apache-2.0 5 | 6 | set -euo pipefail 7 | 8 | cat "$1" | convco check --from-stdin 9 | -------------------------------------------------------------------------------- /js/genkit/tests/prompts/output.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: staticResponseModel 3 | input: 4 | schema: 5 | name: string 6 | output: 7 | schema: 8 | bar: string 9 | --- 10 | 11 | Hi {{ name }} -------------------------------------------------------------------------------- /js/genkit/tests/prompts/schemaRef.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | input: 4 | schema: myInputSchema 5 | output: 6 | schema: myOutputSchema 7 | --- 8 | 9 | Write a poem about {{foo}}. -------------------------------------------------------------------------------- /js/core/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | // DOM is needed for streaming APIs. 6 | "lib": ["es2022", "dom"] 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /genkit-tools/common/tsconfig.types.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib/types", 5 | "declaration": true, 6 | "emitDeclarationOnly": true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex05.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | input: 4 | schema: 5 | theme?: string 6 | --- 7 | Invent a menu item for a {{#if theme}}{{theme}} themed{{/if}} restaurant. -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex08.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-2.5-flash 3 | input: 4 | schema: 5 | photoUrl: string 6 | --- 7 | Describe this image in a detailed paragraph: 8 | 9 | {{media url=photoUrl}} -------------------------------------------------------------------------------- /genkit-tools/telemetry-server/tsconfig.types.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib/types", 5 | "declaration": true, 6 | "emitDeclarationOnly": true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /py/samples/google-genai-context-caching/README.md: -------------------------------------------------------------------------------- 1 | # Context Caching example. 2 | 3 | ## Run the sample 4 | 5 | TODO 6 | 7 | ```bash 8 | genkit start -- uv run google-genai-context-caching/src/context_caching.py 9 | ``` 10 | -------------------------------------------------------------------------------- /samples/js-openai/README.md: -------------------------------------------------------------------------------- 1 | # OpenAI Samples 2 | 3 | Examples of how to use OpenAI models and their custom features. 4 | 5 | To run these examples, run: `npm start` 6 | 7 | Then navigate to http://localhost:4000/flows and run sample flows. -------------------------------------------------------------------------------- /js/plugins/vertexai/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": [ 3 | "src/index.ts", 4 | "src/modelgarden/index.ts", 5 | "src/evaluation/index.ts", 6 | "src/rerankers/index.ts", 7 | "src/vectorsearch/index.ts" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /samples/js-gemini/README.md: -------------------------------------------------------------------------------- 1 | # Google Gemini Samples 2 | 3 | Examples of how to use Google Gemini models and their custom features. 4 | 5 | To run these examples, run: `npm start` 6 | 7 | Then navigate to http://localhost:4000/flows and run sample flows. -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex03.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | temperature: 1.4 5 | topK: 50 6 | topP: 0.4 7 | maxOutputTokens: 400 8 | stopSequences: 9 | - "" 10 | - "" 11 | --- -------------------------------------------------------------------------------- /py/docs/index.md: -------------------------------------------------------------------------------- 1 | # API Reference 2 | 3 | !!! note 4 | Full Genkit documentation is available at [genkit.dev](https://genkit.dev/python/docs/get-started/) 5 | 6 | ::: genkit.ai.Genkit 7 | 8 | ::: genkit.ai.GenkitRegistry 9 | 10 | ::: genkit.ai.Plugin 11 | -------------------------------------------------------------------------------- /genkit-tools/cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "dist", 6 | "types": ["bun-types"], 7 | "resolveJsonModule": true 8 | }, 9 | "include": ["src"] 10 | } 11 | -------------------------------------------------------------------------------- /js/core/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": [ 3 | "src/index.ts", 4 | "src/metrics.ts", 5 | "src/registry.ts", 6 | "src/tracing.ts", 7 | "src/logging.ts", 8 | "src/config.ts", 9 | "src/runtime.ts", 10 | "src/schema.ts" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex07.prompt: -------------------------------------------------------------------------------- 1 | 2 | {{role "system"}} 3 | This is the system prompt. 4 | {{history}} 5 | {{role "user"}} 6 | This is a user message. 7 | {{role "model"}} 8 | This is a model message. 9 | {{role "user"}} 10 | This is the final user message. -------------------------------------------------------------------------------- /js/plugins/next/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | // Open telemetry has a metric load of type errors when trying to import React DOM and @vercel/og/types 6 | "skipLibCheck": true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /samples/js-chatbot/eval.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "conversationId": "1234", 4 | "prompt": "tell me a joke" 5 | }, 6 | { 7 | "conversationId": "2345", 8 | "prompt": "wtite a python program that prints out weather for the current location" 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /js/testapps/evals/prompts/hello.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | config: 3 | temperature: 0.75 4 | topK: 10 5 | input: 6 | schema: 7 | query: string 8 | --- 9 | 10 | {{role "system"}} 11 | Only write code, do not explain 12 | 13 | {{role "user"}} 14 | Assist the user with: {{query}} -------------------------------------------------------------------------------- /js/testapps/evals/data/cat_adoption_questions.jsonl: -------------------------------------------------------------------------------- 1 | {"input":"What are typical cat behaviors?"} 2 | {"input":"What supplies do you need when bringing home a new cat?"} 3 | {"input":"How often should you trim your cat's nails?"} 4 | {"input":"What are some plants that are toxic to cats?"} 5 | -------------------------------------------------------------------------------- /py/samples/compat-oai-hello/README.md: -------------------------------------------------------------------------------- 1 | # OpenAI Sample. 2 | 3 | ## Setup environment 4 | 5 | ```bash 6 | uv venv 7 | source .venv/bin/activate 8 | ``` 9 | 10 | ## Run the sample 11 | 12 | TODO 13 | 14 | ```bash 15 | genkit start -- uv run src/compat_oai_hello.py 16 | ``` 17 | -------------------------------------------------------------------------------- /js/testapps/prompt-file/prompts/story.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-pro 3 | input: 4 | schema: 5 | subject: string 6 | personality?: string 7 | output: 8 | format: text 9 | --- 10 | {{>style personality=personality}} 11 | 12 | Tell me a story about {{subject}}. 13 | -------------------------------------------------------------------------------- /py/plugins/evaluators/README.md: -------------------------------------------------------------------------------- 1 | # Genkit Evaluators plugin 2 | 3 | This Genkit plugin provides a set of pre-defined evaluators for assessing the quality of you LLM outputs. The evaluators provided in this plugin are thin-wrappers around [RAGAS evaluators](https://docs.ragas.io/en/stable/). 4 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/prompts/hello.first-last-name.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | input: 4 | schema: 5 | firstName: string 6 | lastName: string 7 | persona: string 8 | --- 9 | 10 | You are a {{persona}}. Say hello to {{firstName}} {{lastName}}. 11 | -------------------------------------------------------------------------------- /js/plugins/firebase/tests/emulator/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "emulators": { 3 | "database": { 4 | "port": 9000 5 | }, 6 | "ui": { 7 | "enabled": true 8 | }, 9 | "singleProjectMode": true, 10 | "firestore": { 11 | "port": 8080 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /py/samples/model-garden/README.md: -------------------------------------------------------------------------------- 1 | # Model Garden 2 | 3 | ## Setup environment 4 | 5 | ```bash 6 | uv venv 7 | source .venv/bin/activate 8 | ``` 9 | 10 | ## Run the sample 11 | 12 | TODO 13 | 14 | ```bash 15 | genkit start -- uv run --directory py samples/model-garden/src/main.py 16 | ``` 17 | -------------------------------------------------------------------------------- /samples/js-character-generator/idx-template.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Genkit", 3 | "description": "Build a new web app using Genkit", 4 | "categories": ["Web app", "AI ML"], 5 | "icon": "https://www.gstatic.com/monospace/240513/logo_firebase.svg", 6 | "params": [], 7 | "publisher": "Google LLC" 8 | } 9 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/prompts/hello.json-output.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | input: 4 | schema: 5 | name: string 6 | persona: string 7 | output: 8 | format: json 9 | schema: 10 | greeting: string 11 | --- 12 | 13 | You are a {{persona}}. Say hello to {{name}}. 14 | -------------------------------------------------------------------------------- /js/plugins/anthropic/.npmignore: -------------------------------------------------------------------------------- 1 | # typescript source files 2 | src/ 3 | tests/ 4 | tsconfig.json 5 | tsup.common.ts 6 | tsup.config.ts 7 | 8 | # GitHub files 9 | .github/ 10 | .gitignore 11 | .npmignore 12 | CODE_OF_CONDUCT.md 13 | CONTRIBUTING.md 14 | 15 | # Developer related files 16 | .devcontainer/ 17 | .vscode/ 18 | -------------------------------------------------------------------------------- /js/plugins/compat-oai/.npmignore: -------------------------------------------------------------------------------- 1 | # typescript source files 2 | src/ 3 | tests/ 4 | tsconfig.json 5 | tsup.common.ts 6 | tsup.config.ts 7 | 8 | # GitHub files 9 | .github/ 10 | .gitignore 11 | .npmignore 12 | CODE_OF_CONDUCT.md 13 | CONTRIBUTING.md 14 | 15 | # Developer related files 16 | .devcontainer/ 17 | .vscode/ 18 | -------------------------------------------------------------------------------- /go/samples/prompts/prompts/media.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | temperature: 0.1 5 | input: 6 | schema: 7 | imageUrl: string 8 | output: 9 | animal: string 10 | --- 11 | Analyze the provided image of an animal, tell which animal is in the picture 12 | 13 | {{media url=imageUrl}} 14 | -------------------------------------------------------------------------------- /bin/check-licenses: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # Copyright 2025 Google LLC 4 | # SPDX-License-Identifier: Apache-2.0 5 | 6 | set -euo pipefail 7 | 8 | TOP_DIR=$(git rev-parse --show-toplevel) 9 | 10 | pushd "${TOP_DIR}/go" 11 | go-licenses check ./... --disallowed_types=restricted,forbidden,reciprocal,unknown 12 | popd 13 | -------------------------------------------------------------------------------- /samples/js-angular/genkit-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": ["jasmine"] 7 | }, 8 | "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /samples/js-chatbot/genkit-app/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/spec", 6 | "types": ["jasmine"] 7 | }, 8 | "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] 9 | } 10 | -------------------------------------------------------------------------------- /samples/js-angular/genkit-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": ["src/main.ts"], 9 | "include": ["src/**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /samples/js-chatbot/genkit-app/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */ 2 | { 3 | "extends": "./tsconfig.json", 4 | "compilerOptions": { 5 | "outDir": "./out-tsc/app", 6 | "types": [] 7 | }, 8 | "files": ["src/main.ts"], 9 | "include": ["src/**/*.d.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /js/ai/README.md: -------------------------------------------------------------------------------- 1 | # Genkit 2 | 3 | The sources for this package are in the main [Genkit](https://github.com/firebase/genkit) repo. Please file issues and pull requests against that repo. 4 | 5 | Usage information and reference details can be found in [official Genkit documentation](https://genkit.dev/docs/get-started/). 6 | 7 | License: Apache 2.0 8 | -------------------------------------------------------------------------------- /js/core/README.md: -------------------------------------------------------------------------------- 1 | # Genkit 2 | 3 | The sources for this package are in the main [Genkit](https://github.com/firebase/genkit) repo. Please file issues and pull requests against that repo. 4 | 5 | Usage information and reference details can be found in [official Genkit documentation](https://genkit.dev/docs/get-started/). 6 | 7 | License: Apache 2.0 8 | -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex06.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-2.5-flash 3 | input: 4 | schema: 5 | userQuestion: string 6 | --- 7 | {{role "system"}} 8 | You are a helpful AI assistant that really loves to talk about food. Try to work 9 | food items into all of your conversations. 10 | {{role "user"}} 11 | {{userQuestion}} -------------------------------------------------------------------------------- /js/plugins/chroma/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | // chromadb does not compile cleany. It tries to import @xenova/transformers and 6 | // chromadb-default-embed, which do not seem to be packaged with the library 7 | "skipLibCheck": true 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /js/ai/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": [ 3 | "src/index.ts", 4 | "src/retriever.ts", 5 | "src/embedder.ts", 6 | "src/evaluator.ts", 7 | "src/model.ts", 8 | "src/model/middleware.ts", 9 | "src/extract.ts", 10 | "src/tool.ts", 11 | "src/reranker.ts", 12 | "src/chat.ts", 13 | "src/session.ts" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /js/plugins/chroma/README.md: -------------------------------------------------------------------------------- 1 | # Genkit 2 | 3 | The sources for this package are in the main [Genkit](https://github.com/firebase/genkit) repo. Please file issues and pull requests against that repo. 4 | 5 | Usage information and reference details can be found in [official Genkit documentation](https://genkit.dev/docs/get-started/). 6 | 7 | License: Apache 2.0 8 | -------------------------------------------------------------------------------- /genkit-tools/telemetry-server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "outDir": "lib/esm", 7 | "esModuleInterop": true, 8 | "typeRoots": ["./node_modules/@types"], 9 | "rootDirs": ["src"] 10 | }, 11 | "include": ["src"] 12 | } 13 | -------------------------------------------------------------------------------- /js/plugins/langchain/README.md: -------------------------------------------------------------------------------- 1 | # Genkit 2 | 3 | The sources for this package are in the main [Genkit](https://github.com/firebase/genkit) repo. Please file issues and pull requests against that repo. 4 | 5 | Usage information and reference details can be found in [official Genkit documentation](https://genkit.dev/docs/get-started/). 6 | 7 | License: Apache 2.0 8 | -------------------------------------------------------------------------------- /genkit-tools/telemetry-server/README.md: -------------------------------------------------------------------------------- 1 | # Genkit 2 | 3 | The sources for this package are in the main [Genkit](https://github.com/firebase/genkit) repo. Please file issues and pull requests against that repo. 4 | 5 | Usage information and reference details can be found in [official Genkit documentation](https://genkit.dev/docs/get-started/). 6 | 7 | License: Apache 2.0 8 | -------------------------------------------------------------------------------- /js/testapps/anthropic/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/ollama/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/js-gemini/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/js-openai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/js-prompts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/basic-gemini/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/compat-oai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/esm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "es2022", 4 | "moduleResolution": "bundler", 5 | "noImplicitReturns": true, 6 | "noUnusedLocals": false, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "skipLibCheck": true 11 | }, 12 | "compileOnSave": true, 13 | "include": ["src"] 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/model-armor/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/js-angular/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/js-chatbot/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /go/internal/cmd/jsonschemagen/testdata/test.config: -------------------------------------------------------------------------------- 1 | Part omit 2 | Candidate.index type int 3 | Candidate doc 4 | A Candidate is a single generated result. 5 | 6 | Something after a blank line. 7 | . 8 | Candidate.index doc 9 | Position of candidate in list. 10 | . 11 | Candidate_finishReason name FinishReason 12 | FlowResult omit 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /js/testapps/context-caching/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/context-caching2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/docs-menu-basic/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/vertexai-reranker/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /py/samples/dev-local-vectorstore-hello/README.md: -------------------------------------------------------------------------------- 1 | # Hello world 2 | 3 | ## Setup environment 4 | Use `gcloud auth application-default login` to connect to the VertexAI. 5 | 6 | ```bash 7 | uv venv 8 | source .venv/bin/activate 9 | ``` 10 | 11 | ## Run the sample 12 | 13 | TODO 14 | 15 | ```bash 16 | genkit start -- uv run --directory py samples/hello/src/hello.py 17 | ``` 18 | -------------------------------------------------------------------------------- /go/samples/prompts/prompts/multi-msg.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | input: 4 | schema: 5 | videoUrl: string 6 | output: 7 | summary: string 8 | --- 9 | {{ role "system" }} 10 | 11 | You are a great AI assistant that summarizes videos talking as a pirate 12 | 13 | {{ role "user" }} 14 | 15 | Give me a summary of this video 16 | {{media url=videoUrl}} 17 | -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex04.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | input: 4 | schema: 5 | theme?: string 6 | default: 7 | theme: "pirate" 8 | output: 9 | schema: 10 | dishname: string 11 | description: string 12 | calories: integer 13 | allergens(array): string 14 | --- 15 | Invent a menu item for a {{theme}} themed restaurant. -------------------------------------------------------------------------------- /js/testapps/vertexai-modelgarden/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/js-angular/genkit-app/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /samples/js-character-generator/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["index.ts"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /samples/js-chatbot/genkit-app/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.ts] 12 | quote_type = single 13 | 14 | [*.md] 15 | max_line_length = off 16 | trim_trailing_whitespace = false 17 | -------------------------------------------------------------------------------- /genkit-tools/common/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "ES2022", 5 | "moduleResolution": "Node", 6 | "outDir": "lib/esm", 7 | "esModuleInterop": true, 8 | "typeRoots": ["./node_modules/@types"], 9 | "rootDirs": ["src"], 10 | "resolveJsonModule": true 11 | }, 12 | "include": ["src"] 13 | } 14 | -------------------------------------------------------------------------------- /js/testapps/vertexai-vector-search-custom/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /tests/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": true, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /.hooks/no-commits-on-branches: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # pre-commit script 3 | 4 | protected_branches="$@" 5 | 6 | branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,') 7 | 8 | for protected_branch in $protected_branches; do 9 | if [ "$branch" = "$protected_branch" ]; then 10 | echo "Direct commits to the '$protected_branch' branch are not allowed." 11 | exit 1 12 | fi 13 | done 14 | -------------------------------------------------------------------------------- /js/testapps/vertexai-vector-search-bigquery/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/vertexai-vector-search-firestore/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": true, 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "module": "commonjs", 6 | "noImplicitReturns": true, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /go/samples/rag/data/eval-inputs.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "testCaseId": "dog_ancestry", 4 | "input": "What animal are dogs descended from?", 5 | "context": [ 6 | "Dogs are domesticated animals and often considered \"man's best friend\".", 7 | "Dogs share many physical similarities with wolves." 8 | ], 9 | "output": "Dogs are descended from gray wolves." 10 | } 11 | ] 12 | -------------------------------------------------------------------------------- /js/plugins/anthropic/NOTICE: -------------------------------------------------------------------------------- 1 | This project includes code derived from the Firebase Genkit Anthropic community plugin 2 | (https://github.com/BloomLabsInc/genkit-plugins/tree/main/plugins/anthropic). 3 | 4 | Copyright 2024 Bloom Labs Inc. 5 | Copyright 2025 Google LLC. 6 | 7 | Licensed under the Apache License, Version 2.0. 8 | See the LICENSE file distributed with this project for the full license text. 9 | -------------------------------------------------------------------------------- /js/testapps/evals/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/testapps/firebase-functions-sample1/functions/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": true, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true 11 | }, 12 | "compileOnSave": true, 13 | "include": ["src"] 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/mcp/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /py/samples/anthropic-hello/README.md: -------------------------------------------------------------------------------- 1 | ## Anthropic Sample 2 | 3 | 1. Setup environment and install dependencies: 4 | ```bash 5 | uv venv 6 | source .venv/bin/activate 7 | 8 | uv sync 9 | ``` 10 | 11 | 2. Set Anthropic API key: 12 | ```bash 13 | export ANTHROPIC_API_KEY=your-api-key 14 | ``` 15 | 16 | 3. Run the sample: 17 | ```bash 18 | genkit start -- uv run src/anthropic_hello.py 19 | ``` 20 | -------------------------------------------------------------------------------- /py/samples/tool-interrupts/README.md: -------------------------------------------------------------------------------- 1 | # Hello world 2 | 3 | ## Setup environment 4 | Export the api key as env variable GEMINI_API_KEY 5 | export GEMINI_API_KEY= 6 | 7 | ```bash 8 | uv venv 9 | source .venv/bin/activate 10 | ``` 11 | 12 | ## Run the sample 13 | 14 | TODO 15 | 16 | ```bash 17 | genkit start -- uv run --directory py samples/tool-interrupts/src/hello.py 18 | ``` 19 | -------------------------------------------------------------------------------- /py/tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = 3 | py310, 4 | py311, 5 | py312, 6 | py313 7 | isolated_build = True 8 | skipsdist = True # We install editable, so don't build sdist. 9 | 10 | [testenv] 11 | description = Run tests with pytest 12 | deps = 13 | pytest 14 | pytest-cov 15 | pytest-asyncio 16 | pytest-mock 17 | PyYAML 18 | -e . 19 | commands = 20 | pytest {posargs} 21 | -------------------------------------------------------------------------------- /samples/js-menu/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /tests/test_js_app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/testapps/express/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /samples/js-coffee-shop/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/testapps/docs-menu-rag/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/testapps/flow-sample1/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/testapps/flow-simple-ai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/testapps/format-tester/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/testapps/model-tester/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/testapps/prompt-file/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /js/plugins/pinecone/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | // The @pinecone-database+pinecone library has TypeScript errors: 6 | // 1. There are three errors that the type RequestCredentials cannot be found 7 | // 2. There is one error that WindowOrWorkerGlobalScope cannot be found 8 | "skipLibCheck": true 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /js/testapps/durable-streaming/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "noImplicitReturns": true, 5 | "noUnusedLocals": false, 6 | "outDir": "lib", 7 | "sourceMap": true, 8 | "strict": true, 9 | "target": "es2017", 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "compileOnSave": true, 14 | "include": ["src"] 15 | } 16 | -------------------------------------------------------------------------------- /samples/js-prompts/README.md: -------------------------------------------------------------------------------- 1 | # Prompts Samples 2 | 3 | These sample shows off several of the prompting techniques show in [docs/prompts.md](/docs/prompts.md) 4 | 5 | These examples use Google Gemini, set your API key in the `GOOGLE_GENAI_API_KEY` environment variable. 6 | 7 | You can run these prompts in the Developer UI with `genkit start` 8 | 9 | or invoke them with e.g. `genkit flow:run simplePrompt` 10 | -------------------------------------------------------------------------------- /js/testapps/firebase-functions-sample1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "build": "(cd functions && npm i && npm run build) && (npm run build:js)", 4 | "build:js": "webpack" 5 | }, 6 | "private": true, 7 | "dependencies": { 8 | "firebase": "^10.9.0", 9 | "jquery": "^3.7.1" 10 | }, 11 | "devDependencies": { 12 | "webpack": "^5.90.3", 13 | "webpack-cli": "^5.1.4" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /genkit-tools/tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "esModuleInterop": true, 5 | "strict": true, 6 | "strictNullChecks": true, 7 | "removeComments": true, 8 | "target": "ES2022", 9 | "sourceMap": true, 10 | "noImplicitOverride": true, 11 | "noPropertyAccessFromIndexSignature": false, 12 | "skipLibCheck": true 13 | }, 14 | "lib": ["ES2022"] 15 | } 16 | -------------------------------------------------------------------------------- /js/doc-snippets/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "moduleResolution": "NodeNext", 5 | "noImplicitReturns": true, 6 | "noUnusedLocals": false, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | }, 14 | "compileOnSave": true, 15 | "include": ["src"] 16 | } 17 | -------------------------------------------------------------------------------- /js/testapps/rag/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "moduleResolution": "NodeNext", 5 | "noImplicitReturns": true, 6 | "noUnusedLocals": false, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | }, 14 | "compileOnSave": true, 15 | "include": ["src"] 16 | } 17 | -------------------------------------------------------------------------------- /py/.gitignore: -------------------------------------------------------------------------------- 1 | *$py.class 2 | *.egg 3 | *.egg-info/ 4 | *.py[cod] 5 | *.so 6 | .DS_Store 7 | .Python 8 | .cache/ 9 | .coverage 10 | .eggs/ 11 | .genkit 12 | .idea/ 13 | .installed.cfg 14 | .mypy_cache/ 15 | .pytest_cache/ 16 | .ruff_cache/ 17 | .venv 18 | ENV/ 19 | __pycache__/ 20 | build/ 21 | develop-eggs/ 22 | dist/ 23 | downloads/ 24 | eggs/ 25 | lib/ 26 | lib64/ 27 | parts/ 28 | sdist/ 29 | site/ 30 | var/ 31 | venv/ 32 | wheels/ 33 | -------------------------------------------------------------------------------- /js/testapps/multimodal/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "moduleResolution": "NodeNext", 5 | "noImplicitReturns": true, 6 | "noUnusedLocals": false, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | }, 14 | "compileOnSave": true, 15 | "include": ["src"] 16 | } 17 | -------------------------------------------------------------------------------- /samples/js-schoolAgent/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "moduleResolution": "NodeNext", 5 | "noImplicitReturns": true, 6 | "noUnusedLocals": false, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | }, 14 | "compileOnSave": true, 15 | "include": ["src"] 16 | } 17 | -------------------------------------------------------------------------------- /js/testapps/custom-evaluators/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "moduleResolution": "NodeNext", 5 | "noImplicitReturns": true, 6 | "noUnusedLocals": false, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true 13 | }, 14 | "compileOnSave": true, 15 | "include": ["src"] 16 | } 17 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Genkit Documentation 2 | 3 | The source files for the official Genkit documentation (available at [genkit.dev](https://genkit.dev)) have been moved to: 4 | 5 | https://github.com/genkit-ai/docsite 6 | 7 | Please refer to the new repository for all documentation updates, contributions, and issues. 8 | 9 | ## Resources 10 | 11 | The `resources` directory in this location contains assets that may still be referenced by other parts of the project. 12 | -------------------------------------------------------------------------------- /js/testapps/prompt-file/prompts/recipe.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-pro 3 | input: 4 | schema: 5 | food: string 6 | ingredients?(array): string 7 | output: 8 | schema: Recipe 9 | --- 10 | 11 | You are a chef famous for making creative recipes that can be prepared in 45 minutes or less. 12 | 13 | Generate a recipe for {{food}}. 14 | 15 | {{#if ingredients}} 16 | Make sure to include the following ingredients: 17 | {{list ingredients}} 18 | {{/if}} -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex01.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | temperature: 0.9 5 | input: 6 | schema: 7 | location: string 8 | style?: string 9 | name?: string 10 | default: 11 | location: a restaurant 12 | --- 13 | 14 | You are the world's most welcoming AI assistant and are currently working at {{location}}. 15 | 16 | Greet a guest{{#if name}} named {{name}}{{/if}}{{#if style}} in the style of {{style}}{{/if}}. -------------------------------------------------------------------------------- /js/testapps/menu/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "moduleResolution": "NodeNext", 5 | "noImplicitReturns": true, 6 | "noUnusedLocals": false, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true, 13 | "resolveJsonModule": true 14 | }, 15 | "compileOnSave": true, 16 | "include": ["src"] 17 | } 18 | -------------------------------------------------------------------------------- /go/samples/prompts/prompts/countries.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | temperature: 0.5 5 | output: 6 | format: json 7 | schema: 8 | countries(array, A list of countries with their inhabitants): 9 | name: string, Name of the country 10 | habitants: integer, Number of inhabitants in the country 11 | language: string, Official language of the country 12 | --- 13 | Generate a list of countries with their habitants and language 14 | -------------------------------------------------------------------------------- /js/testapps/multiagents-demo/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "NodeNext", 4 | "moduleResolution": "NodeNext", 5 | "noImplicitReturns": true, 6 | "noUnusedLocals": false, 7 | "outDir": "lib", 8 | "sourceMap": true, 9 | "strict": true, 10 | "target": "es2017", 11 | "skipLibCheck": true, 12 | "esModuleInterop": true, 13 | "resolveJsonModule": true 14 | }, 15 | "compileOnSave": true, 16 | "include": ["src"] 17 | } 18 | -------------------------------------------------------------------------------- /py/samples/flask-hello/README.md: -------------------------------------------------------------------------------- 1 | # Flask hello example 2 | 3 | ## Setup environment 4 | 5 | Use `gcloud auth application-default login` to connect to the VertexAI. 6 | 7 | ## Run the sample 8 | 9 | TODO 10 | 11 | ```bash 12 | genkit start -- uv run flask --app src/flask_hello.py run 13 | ``` 14 | 15 | ```bash 16 | curl -X POST http://127.0.0.1:5000/chat -d '{"data": "banana"}' -H 'content-Type: application/json' -H 'accept: text/event-stream' -H 'Authorization: Pavel' 17 | ``` 18 | -------------------------------------------------------------------------------- /go/samples/prompts/prompts/recipe.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-pro 3 | input: 4 | schema: 5 | food: string 6 | ingredients?(array): string 7 | output: 8 | schema: Recipe 9 | --- 10 | 11 | You are a chef famous for making spicy recipes that can be prepared in 45 minutes or less. 12 | 13 | Generate a recipe for {{food}}. 14 | 15 | {{#if ingredients}} 16 | Make sure to include the following ingredients: 17 | {{#each ingredients}} 18 | * {{this}} 19 | {{/each}} 20 | {{/if}} 21 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/prompts/hello.system.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | maxOutputTokens: 2048 5 | temperature: 0.6 6 | topK: 16 7 | topP: 0.95 8 | input: 9 | schema: 10 | name: string 11 | persona?: string 12 | default: 13 | persona: Space Pirate 14 | --- 15 | 16 | {{role "system"}} 17 | You are a helpful AI assistant that really loves to make impressions. 18 | {{role "user"}} 19 | Say hello to {{name}} in the voice of a {{persona}}. 20 | -------------------------------------------------------------------------------- /py/samples/google-genai-code-execution/README.md: -------------------------------------------------------------------------------- 1 | # Hello Google GenAI 2 | 3 | An example demonstrating running flows using the Google GenAI plugin. 4 | 5 | ## Setup environment 6 | 7 | Obtain an API key from [ai.dev](https://ai.dev). 8 | 9 | Export the API key as env variable `GEMINI\_API\_KEY` in your shell 10 | configuration. 11 | 12 | ```bash 13 | export GEMINI_API_KEY='' 14 | ``` 15 | 16 | ## Run the sample 17 | 18 | ```bash 19 | genkit start -- uv run src/main.py 20 | ``` 21 | -------------------------------------------------------------------------------- /py/samples/google-genai-hello/README.md: -------------------------------------------------------------------------------- 1 | # Hello Google GenAI 2 | 3 | An example demonstrating running flows using the Google GenAI plugin. 4 | 5 | ## Setup environment 6 | 7 | Obtain an API key from [ai.dev](https://ai.dev). 8 | 9 | Export the API key as env variable `GEMINI\_API\_KEY` in your shell 10 | configuration. 11 | 12 | ```bash 13 | export GEMINI_API_KEY='' 14 | ``` 15 | 16 | ## Run the sample 17 | 18 | ```bash 19 | genkit start -- uv run src/google_genai_hello.py 20 | ``` 21 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | Description here... Help the reviewer by: 2 | - linking to an issue that includes more details 3 | - if it's a new feature include samples of how to use the new feature 4 | - (optional if issue link is provided) if you fixed a bug include basic bug details 5 | 6 | Checklist (if applicable): 7 | - [ ] PR title is following https://www.conventionalcommits.org/en/v1.0.0/ 8 | - [ ] Tested (manually, unit tested, etc.) 9 | - [ ] Docs updated (updated docs or a docs bug required) 10 | -------------------------------------------------------------------------------- /js/plugins/mcp/examples/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@genkit-ai/mcp-examples-server", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "node index.js", 8 | "inspect": "npx @modelcontextprotocol/inspector index.js" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "dependencies": { 14 | "genkit": "file:../../../../genkit", 15 | "@genkit-ai/mcp": "file:../.." 16 | }, 17 | "type": "module" 18 | } 19 | -------------------------------------------------------------------------------- /js/testapps/prompt-file/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prompt-file", 3 | "version": "1.0.0", 4 | "description": "", 5 | "dependencies": { 6 | "genkit": "workspace:*", 7 | "@genkit-ai/googleai": "workspace:*" 8 | }, 9 | "main": "lib/index.js", 10 | "scripts": { 11 | "build": "tsc", 12 | "test": "echo \"Error: no test specified\" && exit 1" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "devDependencies": { 18 | "typescript": "^5.3.3" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /go/samples/prompts-dir/prompts/example.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | temperature: 0.9 5 | input: 6 | schema: 7 | location: string 8 | style?: string 9 | name?: string 10 | default: 11 | name: Rutuja 12 | output: 13 | schema: 14 | greeting: string 15 | --- 16 | 17 | You are the world's most welcoming AI assistant and are currently working at {{location}}. 18 | 19 | Greet a guest{{#if name}} named {{name}}{{/if}}{{#if style}} in the style of {{style}}{{/if}}. 20 | -------------------------------------------------------------------------------- /samples/js-character-generator/README_IDX.md: -------------------------------------------------------------------------------- 1 | #Genkit 2 | 3 | This is a simple demonstration web app using the [Genkit Library](https://github.com/firebase/genkit) with Gemini to characters for an adventure game. 4 | 5 | In IDX, get started by with API key at https://g.co/ai/idxGetGeminiKey and enter it in `.idx/dev.nix` and rebuild the environment. 6 | 7 | After rebuilding the environment, open a new terminal (`Ctrl`+ `` ` ``) and follow the link that said "Genkit Developer UI" to use Genkit's built-in local developer playground. 8 | -------------------------------------------------------------------------------- /js/testapps/flow-simple-ai/prompts/dotpromptContext.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-2.5-flash 3 | input: 4 | schema: 5 | question: string 6 | output: 7 | format: json 8 | schema: 9 | answer: string, the answer to the question 10 | id: string, the selected id of the saying 11 | reasoning: string, why the saying applies to the question 12 | --- 13 | 14 | You are a mystic wisdom bot designed to help people with their problems. Use the provided 15 | sayings to answer the question. 16 | 17 | Question: {{question}} -------------------------------------------------------------------------------- /js/genkit/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": [ 3 | "src/index.ts", 4 | "src/beta.ts", 5 | "src/client/index.ts", 6 | "src/model.ts", 7 | "src/tool.ts", 8 | "src/retriever.ts", 9 | "src/reranker.ts", 10 | "src/context.ts", 11 | "src/plugin.ts", 12 | "src/middleware.ts", 13 | "src/registry.ts", 14 | "src/tracing.ts", 15 | "src/logging.ts", 16 | "src/schema.ts", 17 | "src/embedder.ts", 18 | "src/evaluator.ts", 19 | "src/extract.ts", 20 | "src/testing.ts" 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/prompts/media/imagen3.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/imagen3-fast 3 | config: 4 | temperature: 0.6 5 | candidates: 2 6 | addWatermark: true 7 | personGeneration: "adults_only" 8 | aspectRatio: "16:9" 9 | safetySetting: "block_some" 10 | input: 11 | schema: 12 | prompt: string 13 | default: 14 | prompt: A penguin strapped to a jetpack from the side profile, flying through the Earth's atmosphere. 15 | --- 16 | 17 | Generate an image using the following description: 18 | 19 | {{prompt}} 20 | -------------------------------------------------------------------------------- /js/plugins/mcp/examples/server/prompts/port_code.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | input: 3 | schema: 4 | code: string, the source code to port from one language to another 5 | fromLang?: string, the original language of the source code (e.g. js, python) 6 | toLang: string, the destination language of the source code (e.g. python, js) 7 | --- 8 | 9 | You are assisting the user in translating code between two programming languages. Given the code below, translate it into {{toLang}}. 10 | 11 | ```{{#if fromLang}}{{fromLang}}{{/if}} 12 | {{code}} 13 | ``` -------------------------------------------------------------------------------- /js/testapps/prompt-file/prompts/recipe.robot.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-pro 3 | input: 4 | schema: 5 | food: string 6 | output: 7 | schema: 8 | title: string, recipe title 9 | ingredients(array): 10 | name: string 11 | quantity: string 12 | steps(array, the steps required to complete the recipe): string 13 | --- 14 | 15 | You are a robot chef famous for making creative recipes that robots love to eat. Robots love things like motor oil, RAM, bolts, and uranium. 16 | 17 | Generate a recipe for {{food}}. -------------------------------------------------------------------------------- /js/testapps/vertexai-vector-search-custom/.env.example: -------------------------------------------------------------------------------- 1 | # .env.example 2 | 3 | # Firebase project configuration 4 | PROJECT_ID=your_project_id_here 5 | LOCATION=your_location_here 6 | 7 | LOCAL_DIR=your_local_dir_here 8 | 9 | # Vector Search configuration 10 | VECTOR_SEARCH_PUBLIC_DOMAIN_NAME=your_vector_search_public_endpoint_here 11 | VECTOR_SEARCH_INDEX_ENDPOINT_ID=your_vector_search_index_endpoint_id_here 12 | VECTOR_SEARCH_INDEX_ID=your_vector_search_index_id_here 13 | VECTOR_SEARCH_DEPLOYED_INDEX_ID=your_vector_search_deployed_index_id_here 14 | -------------------------------------------------------------------------------- /py/samples/anthropic-hello/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "anthropic-hello" 3 | version = "0.1.0" 4 | description = "Anthropic Hello Sample" 5 | requires-python = ">=3.10" 6 | dependencies = [ 7 | "genkit", 8 | "genkit-plugin-anthropic", 9 | "pydantic>=2.0.0", 10 | "structlog>=24.0.0", 11 | ] 12 | 13 | [tool.uv.sources] 14 | genkit-plugin-anthropic = { workspace = true } 15 | 16 | [build-system] 17 | requires = ["hatchling"] 18 | build-backend = "hatchling.build" 19 | 20 | [tool.hatch.build.targets.wheel] 21 | packages = ["src"] 22 | -------------------------------------------------------------------------------- /js/plugins/firebase/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | // Google protobuf libraries have a transitive dependency on the long 5 | // library, which incorrectly implements the ESM/CSM dual mode. This 6 | // started in 5.0.0 and protobufjs requires ^5.0.0. 7 | // This can be removed if https://github.com/dcodeIO/long.js/pull/130 gets 8 | // approved, though it's been sitting around for over a year without 9 | // acceptance. 10 | "skipLibCheck": true 11 | }, 12 | "include": ["src"] 13 | } 14 | -------------------------------------------------------------------------------- /js/plugins/vertexai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | // Google protobuf libraries have a transitive dependency on the long 6 | // library, which incorrectly implements the ESM/CSM dual mode. This 7 | // started in 5.0.0 and protobufjs requires ^5.0.0. 8 | // This can be removed if https://github.com/dcodeIO/long.js/pull/130 gets 9 | // approved, though it's been sitting around for over a year without 10 | // acceptance. 11 | "skipLibCheck": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /js/testapps/docs-menu-basic/README.md: -------------------------------------------------------------------------------- 1 | ## Build it 2 | 3 | ``` 4 | pnpm build 5 | ``` 6 | 7 | or if you need to, build everything: 8 | 9 | ``` 10 | cd ; pnpm run setup; cd - 11 | ``` 12 | 13 | where `` is the top level of the genkit repo. 14 | 15 | ## Run the flow via cli 16 | 17 | ``` 18 | genkit flow:run menuSuggestionFlow '"astronauts"' 19 | ``` 20 | 21 | ## Run the flow in the Developer UI 22 | 23 | ``` 24 | genkit start 25 | ``` 26 | 27 | Click on `menuSuggestionFlow` in the lefthand navigation panel to run the new flow. 28 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see https://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | end_of_line = lf 7 | indent_size = 2 8 | indent_style = space 9 | insert_final_newline = true 10 | max_line_length = 80 11 | trim_trailing_whitespace = true 12 | 13 | [*.{js,jsx,ts,tsx}] 14 | quote_type = single 15 | 16 | [*.py] 17 | indent_size = 4 18 | max_line_length = 120 19 | indent_style = space 20 | quote_type = single 21 | 22 | [{Makefile,go.mod,go.sum,*.go,.gitmodules}] 23 | indent_size = 4 24 | indent_style = tab 25 | max_line_length = 120 26 | -------------------------------------------------------------------------------- /js/plugins/google-cloud/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | // Google protobuf libraries have a transitive dependency on the long 6 | // library, which incorrectly implements the ESM/CSM dual mode. This 7 | // started in 5.0.0 and protobufjs requires ^5.0.0. 8 | // This can be removed if https://github.com/dcodeIO/long.js/pull/130 gets 9 | // approved, though it's been sitting around for over a year without 10 | // acceptance. 11 | "skipLibCheck": true 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /py/samples/google-genai-vertexai-hello/README.md: -------------------------------------------------------------------------------- 1 | # Hello Google GenAI - Vertex AI 2 | 3 | An example demonstrating the use of the Google GenAI plugin to use 4 | Vertex AI. 5 | 6 | ## Setup environment 7 | 8 | 1. Install [GCP CLI](https://cloud.google.com/sdk/docs/install). 9 | 2. Put your GCP project and location in the code to run VertexAI there. 10 | 3. Run the sample. 11 | 12 | ```bash 13 | uv venv 14 | source .venv/bin/activate 15 | ``` 16 | 17 | ## Run the sample 18 | 19 | TODO 20 | 21 | ```bash 22 | genkit start -- uv run src/google_genai_vertexai_hello.py 23 | ``` 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/dev-ui-feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Dev UI feature request 3 | about: Use this to request a feature in the Dev UI 4 | title: "[Dev UI]" 5 | labels: devui 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Overview 11 | A clear and concise description of what the feature is. 12 | 13 | ### User goal(s) 14 | What is the user trying to accomplish with this feature? 15 | 16 | ## Requirements 17 | ### Acceptance Criteria 18 | - 1 19 | - 2 20 | - 3 21 | 22 | ### Designs 23 | 24 | Inlined screenshots 25 | 26 | ## Notes 27 | 28 | Are there any open questions? Anything else 29 | 30 | -------------------------------------------------------------------------------- /py/docs/types.md: -------------------------------------------------------------------------------- 1 | # Types 2 | 3 | ::: genkit.types.GenerateResponseWrapper 4 | 5 | ::: genkit.types.GenerateRequest 6 | 7 | ::: genkit.types.GenerateResponse 8 | 9 | ::: genkit.types.MessageWrapper 10 | 11 | ::: genkit.types.MessageWrapper 12 | 13 | ::: genkit.types.Message 14 | 15 | ::: genkit.types.Part 16 | 17 | ::: genkit.types.TextPart 18 | 19 | ::: genkit.types.MediaPart 20 | 21 | ::: genkit.types.Media 22 | 23 | ::: genkit.types.ToolRequestPart 24 | 25 | ::: genkit.types.ToolRequest 26 | 27 | ::: genkit.types.ToolResponsePart 28 | 29 | ::: genkit.types.ToolResponse 30 | -------------------------------------------------------------------------------- /.hooks/commit-message-format-pre-push: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # put this file in: .git/hooks/pre-push 3 | z40=0000000000000000000000000000000000000000 4 | while read _ local_sha _ remote_sha; do 5 | if [ "$local_sha" != $z40 ]; then 6 | if [ "$remote_sha" = $z40 ]; then 7 | # New branch, examine all commits 8 | range="$local_sha" 9 | else 10 | # Update to existing branch, examine new commits 11 | range="$remote_sha..$local_sha" 12 | fi 13 | 14 | # Check for WIP commit 15 | if ! convco check "$range"; then 16 | exit 1 17 | fi 18 | fi 19 | done 20 | -------------------------------------------------------------------------------- /js/testapps/model-armor/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "model-armor-testapp", 3 | "version": "1.0.0", 4 | "private": true, 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "build": "tsc", 8 | "build:watch": "tsc --watch", 9 | "start": "genkit start -- npx tsx --watch src/index.ts" 10 | }, 11 | "dependencies": { 12 | "@genkit-ai/google-cloud": "workspace:*", 13 | "@genkit-ai/google-genai": "workspace:*", 14 | "genkit": "workspace:*", 15 | "zod": "^3.22.4" 16 | }, 17 | "devDependencies": { 18 | "tsx": "^4.7.1", 19 | "typescript": "^5.3.3" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /go/internal/cmd/copy/testdata/simple.txt: -------------------------------------------------------------------------------- 1 | -- source -- 2 | first 3 | second 4 | //copy:start dest foo 5 | third 6 | fourth 7 | //copy:stop 8 | fifth 9 | //copy:start dest bar 10 | sixth 11 | //copy:stop 12 | seventh 13 | -- dest -- 14 | line1 15 | //copy:sink bar 16 | line2 17 | //copy:sink foo 18 | -- want -- 19 | line1 20 | //copy:sink bar from source 21 | // DO NOT MODIFY below vvvv 22 | sixth 23 | // DO NOT MODIFY above ^^^^ 24 | //copy:endsink bar 25 | line2 26 | //copy:sink foo from source 27 | // DO NOT MODIFY below vvvv 28 | third 29 | fourth 30 | // DO NOT MODIFY above ^^^^ 31 | //copy:endsink foo 32 | -------------------------------------------------------------------------------- /js/genkit/tests/prompts/kitchensink.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-5.0-ultimate-pro-plus 3 | description: a description 4 | config: 5 | temperature: 11 6 | tools: 7 | - toolA 8 | - toolB 9 | returnToolRequests: true 10 | input: 11 | schema: 12 | subject: string 13 | output: 14 | format: csv 15 | schema: 16 | obj?(object, a nested object): 17 | nest1?: string 18 | arr(array, array of objects): 19 | nest2?: boolean 20 | maxTurns: 77 21 | toolChoice: required 22 | metadata: 23 | foo: bar 24 | --- 25 | {{role "system"}} Hello {{history}} from the prompt file {{ subject }} -------------------------------------------------------------------------------- /js/testapps/vertexai-vector-search-firestore/.env.example: -------------------------------------------------------------------------------- 1 | # .env.example 2 | 3 | # Firebase project configuration 4 | PROJECT_ID=your_project_id_here 5 | LOCATION=your_location_here 6 | 7 | # Firestore configuration 8 | FIRESTORE_COLLECTION=your_firestore_collection_here 9 | 10 | # Vector Search configuration 11 | VECTOR_SEARCH_PUBLIC_DOMAIN_NAME=your_vector_search_public_endpoint_here 12 | VECTOR_SEARCH_INDEX_ENDPOINT_ID=your_vector_search_index_endpoint_id_here 13 | VECTOR_SEARCH_INDEX_ID=your_vector_search_index_id_here 14 | VECTOR_SEARCH_DEPLOYED_INDEX_ID=your_vector_search_deployed_index_id_here 15 | -------------------------------------------------------------------------------- /py/samples/firestore-retreiver/README.md: -------------------------------------------------------------------------------- 1 | # Hello world 2 | 3 | ## Setup environment 4 | 5 | ```bash 6 | uv venv 7 | source .venv/bin/activate 8 | ``` 9 | 10 | ## Create a index to be able to retrieve 11 | ``` 12 | gcloud firestore indexes composite create \ 13 | --project=\ 14 | --collection-group=films \ 15 | --query-scope=COLLECTION \ 16 | --field-config=vector-config='{"dimension":"768","flat": "{}"}',field-path=embedding 17 | ``` 18 | ## Run the sample 19 | 20 | TODO 21 | 22 | ```bash 23 | genkit start -- uv run --directory py samples/firestore-retreiver/src/main.py 24 | ``` -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/docs.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Docs 3 | about: File issues or improvement suggestions for documentation 4 | title: '[Docs]' 5 | labels: docs 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your report related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Please provide links where you observed the problem. 12 | 13 | **Is your report related to a suggestion/improvement? Please describe.** 14 | Please provide a concise description of the suggestion with examples or relevant scenarios. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the request here. 18 | -------------------------------------------------------------------------------- /js/testapps/vertexai-vector-search-bigquery/.env.example: -------------------------------------------------------------------------------- 1 | # .env.example 2 | 3 | # Firebase project configuration 4 | PROJECT_ID=your_project_id_here 5 | LOCATION=your_location_here 6 | 7 | # BigQuery configuration 8 | BIGQUERY_DATASET=your_bigquery_dataset_here 9 | BIGQUERY_TABLE=your_bigquery_table_here 10 | 11 | # Vector Search configuration 12 | VECTOR_SEARCH_PUBLIC_DOMAIN_NAME=your_vector_search_public_endpoint_here 13 | VECTOR_SEARCH_INDEX_ENDPOINT_ID=your_vector_search_index_endpoint_id_here 14 | VECTOR_SEARCH_INDEX_ID=your_vector_search_index_id_here 15 | VECTOR_SEARCH_DEPLOYED_INDEX_ID=your_vector_search_deployed_index_id_here 16 | -------------------------------------------------------------------------------- /samples/js-character-generator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-character-generator", 3 | "version": "0.1.0", 4 | "description": "A simple Genkit app to generate fantasy characters", 5 | "main": "index.js", 6 | "scripts": { 7 | "build": "npx tsc", 8 | "genkit:dev": "npx genkit start -- npx tsx --watch index.ts" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC", 13 | "devDependencies": { 14 | "genkit-cli": "^1.0.4", 15 | "tsx": "^4.19.2", 16 | "typescript": "^5.6.3" 17 | }, 18 | "dependencies": { 19 | "genkit": "^1.0.4", 20 | "@genkit-ai/google-genai": "^1.0.4" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tests/test_js_app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "test_js_app", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "start": "node lib/index.js", 8 | "compile": "tsc", 9 | "build": "pnpm build:clean && pnpm compile", 10 | "build:clean": "rimraf ./lib", 11 | "build:watch": "tsc --watch", 12 | "build-and-run": "pnpm build && node lib/index.js" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "dependencies": { 18 | "zod": "^3.22.4" 19 | }, 20 | "devDependencies": { 21 | "rimraf": "^6.0.1", 22 | "typescript": "^5.3.3" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/prompts/code.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | temperature: 0.4 5 | safetySettings: 6 | - category: HARM_CATEGORY_HATE_SPEECH 7 | threshold: BLOCK_ONLY_HIGH 8 | - category: HARM_CATEGORY_DANGEROUS_CONTENT 9 | threshold: BLOCK_ONLY_HIGH 10 | - category: HARM_CATEGORY_HARASSMENT 11 | threshold: BLOCK_ONLY_HIGH 12 | - category: HARM_CATEGORY_SEXUALLY_EXPLICIT 13 | threshold: BLOCK_ONLY_HIGH 14 | input: 15 | schema: 16 | language: string 17 | default: 18 | persona: java 19 | --- 20 | 21 | Generate a program that calculates fibonacci in {{language}}. 22 | -------------------------------------------------------------------------------- /py/README.md: -------------------------------------------------------------------------------- 1 | # Genkit Python SDK 2 | 3 | ## Setup Instructions 4 | 5 | 1. Install `uv` from https://docs.astral.sh/uv/getting-started/installation/ 6 | 7 | ```bash 8 | curl -LsSf https://astral.sh/uv/install.sh | sh 9 | ``` 10 | 11 | 2. Install required tools using `uv` 12 | 13 | ```bash 14 | uv tool install httpie 15 | uv tool install mypy 16 | uv tool install ruff 17 | ``` 18 | 19 | 3. If you are using VSCode, install the `Ruff` extension from the marketplace to 20 | add linter support. 21 | 22 | ## Run test app 23 | 24 | See the README.md in the samples folder. 25 | 26 | 27 | ## Run all unit tests 28 | 29 | ``` bash 30 | uv run pytest . 31 | ``` 32 | -------------------------------------------------------------------------------- /js/testapps/compat-oai/README.md: -------------------------------------------------------------------------------- 1 | # Manual Test for Genkit Plugins 2 | 3 | To run this example: 4 | 5 | 1. Set the appropriate environment variables in a `.env` file in this directory. 6 | 2. Run `pnpm i` and `pnpm run setup` in the root of this repository. 7 | 3. In this app directory, run: 8 | ```bash 9 | npm run build 10 | npm run genkit:dev 11 | ``` 12 | 4. In another terminal, execute: 13 | ```bash 14 | genkit flow:run jokeFlow "chicken" 15 | ``` 16 | 17 | > Note: Due to a known issue, testing of flows should be conducted via the CLI via genkit flow:run etc. 18 | > Tools and other actions can still be inspected in the UI with `genkit ui:start` 19 | -------------------------------------------------------------------------------- /js/testapps/evals/data/cat_adoption_questions_with_reference.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "input": "What are typical cat behaviors?", 4 | "reference": "Cats like to purr, push things away and cuddle." 5 | }, 6 | { 7 | "input": "What supplies do you need when bringing home a new cat?", 8 | "reference": "Litter box, cat food and plenty of yarn" 9 | }, 10 | { 11 | "input": "How often should you trim your cat's nails?", 12 | "reference": "Trim your cat's nails only when you feel like they're overgrown" 13 | }, 14 | { 15 | "input": "What are some plants that are toxic to cats?", 16 | "reference": "I don't know, maybe poison ivy?" 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /samples/js-angular/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-angular", 3 | "version": "1.0.0", 4 | "description": "This is a simple UI for streaming RPG character generator.", 5 | "scripts": { 6 | "genkit:dev": "concurrently npm:start:server npm:start:ng", 7 | "start:server": "cd server && npm run genkit:dev", 8 | "start:ng": "cd genkit-app && npm run start", 9 | "setup": "npm i && cd server && npm i && cd ../genkit-app && npm i", 10 | "build": "cd server && npm run build && cd ../genkit-app && npm run build" 11 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "devDependencies": { 16 | "concurrently": "^8.2.2" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /js/plugins/langchain/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | // The langchain+core package has multiple ts errors: 6 | // 1. In chat_models.d.ts and llms.d.ts, TypeScript cannot infer the type of `this`. 7 | // this error might be resolved by upgrading typescript versions 8 | // 2. outputs.d.cts and base.d.cts mix up ESM and CSM and are using the wrong loader. 9 | // 10 | // The langchain package also has errors: 11 | // 1. callbacks.d.ts, evaluation.d.cts, and base.d.cts mix up ESM and CSM and are 12 | // using the wrong loader 13 | "skipLibCheck": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /py/plugins/anthropic/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | -------------------------------------------------------------------------------- /py/samples/menu/src/case_01/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | -------------------------------------------------------------------------------- /py/samples/menu/src/case_02/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | -------------------------------------------------------------------------------- /py/samples/menu/src/case_03/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | -------------------------------------------------------------------------------- /py/samples/menu/src/case_04/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | -------------------------------------------------------------------------------- /py/samples/menu/src/case_05/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | -------------------------------------------------------------------------------- /js/testapps/flow-sample1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "flow-sample1", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "start": "node lib/index.js", 8 | "compile": "tsc", 9 | "build": "pnpm build:clean && pnpm compile", 10 | "build:clean": "rimraf ./lib", 11 | "build:watch": "tsc --watch", 12 | "build-and-run": "pnpm build && node lib/index.js" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "dependencies": { 18 | "genkit": "workspace:^", 19 | "@genkit-ai/firebase": "workspace:^" 20 | }, 21 | "devDependencies": { 22 | "rimraf": "^6.0.1", 23 | "typescript": "^5.3.3" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /js/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | // Please do not turn on helper settings like esModuleInterop because 4 | // customers either need to use the same helper settings or turn on 5 | // skipLibCheck. 6 | "declaration": true, 7 | "module": "NodeNext", 8 | "moduleResolution": "NodeNext", 9 | "allowSyntheticDefaultImports": true, 10 | "noImplicitReturns": true, 11 | "noUnusedLocals": true, 12 | "noImplicitAny": false, 13 | "resolveJsonModule": true, 14 | "sourceMap": true, 15 | "esModuleInterop": false, 16 | "strict": true, 17 | "target": "es2022", 18 | "lib": ["es2022", "DOM"], 19 | "noEmit": true 20 | }, 21 | "compileOnSave": true 22 | } 23 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /js/testapps/ollama/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "basic-gemini", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node lib/index.js", 9 | "build": "tsc", 10 | "build:watch": "tsc --watch", 11 | "genkit:dev": "genkit start -- tsx --watch src/index.ts", 12 | "dev": "tsx --watch src/index.ts" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "dependencies": { 18 | "genkit": "workspace:*", 19 | "genkitx-ollama": "workspace:*" 20 | }, 21 | "devDependencies": { 22 | "cross-env": "^7.0.3", 23 | "typescript": "^5.6.2" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /js/ai/src/testing/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { testModels } from './model-tester.js'; 18 | -------------------------------------------------------------------------------- /js/genkit/src/logging.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { logger } from '@genkit-ai/core/logging'; 18 | -------------------------------------------------------------------------------- /js/genkit/src/testing.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { testModels } from '@genkit-ai/ai/testing'; 18 | -------------------------------------------------------------------------------- /py/plugins/vertex-ai/src/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | """Vertex AI plugin.""" 18 | -------------------------------------------------------------------------------- /py/plugins/google-genai/src/genkit/plugins/google_genai/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | -------------------------------------------------------------------------------- /js/testapps/firebase-functions-sample1/firebase.json: -------------------------------------------------------------------------------- 1 | { 2 | "functions": [ 3 | { 4 | "source": "functions", 5 | "codebase": "default", 6 | "ignore": [ 7 | "node_modules", 8 | ".git", 9 | "firebase-debug.log", 10 | "firebase-debug.*.log" 11 | ], 12 | "predeploy": ["npm --prefix \"$RESOURCE_DIR\" run build"] 13 | } 14 | ], 15 | "hosting": { 16 | "public": "public" 17 | }, 18 | "emulators": { 19 | "auth": { 20 | "port": 9099 21 | }, 22 | "functions": { 23 | "port": 5001 24 | }, 25 | "hosting": { 26 | "port": 5000 27 | }, 28 | "ui": { 29 | "enabled": true 30 | }, 31 | "singleProjectMode": true 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /js/testapps/multiagents-demo/src/data/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { mockCatalog } from './catalog'; 18 | -------------------------------------------------------------------------------- /py/packages/genkit/src/genkit/lang/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | """Language utilities.""" 18 | -------------------------------------------------------------------------------- /genkit-tools/cli/src/commands/init-ai-tools/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { initAiTools } from './command'; 18 | -------------------------------------------------------------------------------- /genkit-tools/common/src/server/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './router'; 18 | export * from './server'; 19 | -------------------------------------------------------------------------------- /js/genkit/src/extract.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { extractJson, parsePartialJson } from '@genkit-ai/ai/extract'; 18 | -------------------------------------------------------------------------------- /js/genkit/src/formats.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export type { FormatArgument, Formatter } from '@genkit-ai/ai/formats'; 18 | -------------------------------------------------------------------------------- /js/testapps/multimodal/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './pdf.js'; 18 | export * from './video.js'; 19 | -------------------------------------------------------------------------------- /genkit-tools/common/src/plugin/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './config'; 18 | export * from './plugins'; 19 | -------------------------------------------------------------------------------- /py/samples/short-n-long/src/short_n_long/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | """Short and long sample.""" 18 | -------------------------------------------------------------------------------- /genkit-tools/pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | packages: 16 | - '.' 17 | - 'cli' 18 | - 'common' 19 | - 'telemetry-server' 20 | - 'plugins/*' 21 | -------------------------------------------------------------------------------- /py/plugins/google-genai/src/genkit/plugins/google_genai/models/context_caching/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | -------------------------------------------------------------------------------- /samples/js-angular/genkit-app/src/app/home/home.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .wrapper { 18 | padding: 20px; 19 | } 20 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/prompts/tools/weather.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | maxOutputTokens: 2048 5 | temperature: 0.6 6 | topK: 16 7 | topP: 0.95 8 | stopSequences: 9 | - STAWP! 10 | safetySettings: 11 | - category: HARM_CATEGORY_HATE_SPEECH 12 | threshold: BLOCK_ONLY_HIGH 13 | - category: HARM_CATEGORY_DANGEROUS_CONTENT 14 | threshold: BLOCK_ONLY_HIGH 15 | - category: HARM_CATEGORY_HARASSMENT 16 | threshold: BLOCK_ONLY_HIGH 17 | - category: HARM_CATEGORY_SEXUALLY_EXPLICIT 18 | threshold: BLOCK_ONLY_HIGH 19 | input: 20 | schema: 21 | city: string 22 | default: 23 | city: Cambridge, MA 24 | tools: 25 | - getWeather 26 | --- 27 | 28 | Is it raining in {{city}}? 29 | -------------------------------------------------------------------------------- /py/packages/genkit/src/genkit/web/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | """Web framework for the Genkit framework.""" 18 | -------------------------------------------------------------------------------- /samples/js-prompts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "prompts", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node lib/index.js", 9 | "genkit:dev": "genkit start -- tsx --watch src/index.ts", 10 | "build": "tsc", 11 | "build:watch": "tsc --watch" 12 | }, 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "dependencies": { 17 | "genkit": "^1.0.4", 18 | "@genkit-ai/googleai": "^1.0.4", 19 | "@genkit-ai/express": "^1.0.4", 20 | "express": "^4.21.0", 21 | "zod": "^3.23.8" 22 | }, 23 | "devDependencies": { 24 | "genkit-cli": "^1.0.4", 25 | "typescript": "^5.5.4" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /py/plugins/evaluators/src/metrics/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | # Run tests for all supported Python versions using tox 18 | -------------------------------------------------------------------------------- /py/samples/menu/src/case_04/flows.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | 18 | # TODO: implement it once Genkit AI will have index API 19 | -------------------------------------------------------------------------------- /genkit-tools/common/src/utils/package.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import toolsPackage from '../../package.json'; 18 | 19 | export { toolsPackage }; 20 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/prompts/hello.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | maxOutputTokens: 2048 5 | temperature: 0.6 6 | topK: 16 7 | topP: 0.95 8 | stopSequences: 9 | - STAWP! 10 | safetySettings: 11 | - category: HARM_CATEGORY_HATE_SPEECH 12 | threshold: BLOCK_ONLY_HIGH 13 | - category: HARM_CATEGORY_DANGEROUS_CONTENT 14 | threshold: BLOCK_ONLY_HIGH 15 | - category: HARM_CATEGORY_HARASSMENT 16 | threshold: BLOCK_ONLY_HIGH 17 | - category: HARM_CATEGORY_SEXUALLY_EXPLICIT 18 | threshold: BLOCK_ONLY_HIGH 19 | input: 20 | schema: 21 | name: string 22 | persona?: string 23 | default: 24 | persona: Space Pirate 25 | --- 26 | 27 | Say hello to {{name}} in the voice of a {{persona}}. 28 | -------------------------------------------------------------------------------- /js/testapps/evals/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './eval-in-code.js'; 18 | export * from './pdf-rag.js'; 19 | export * from './setup.js'; 20 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | # This prevents pnpm publish from running if you aren't on the specified 2 | # branch, which can save you some headaches. 3 | publish-branch=main 4 | 5 | # This option tells pnpm to only resolve local deps to the local files when 6 | # the `workspace:` protocol is used, and to otherwise download published versions. 7 | link-workspace-packages=false 8 | 9 | # This option will cause pnpm to fail if its version doesn't exactly match the 10 | # version specified in the `packageManager` field of package.json. 11 | package-manager-strict-version=true 12 | 13 | # This option will cause pnpm to automatically download and run the version of 14 | # pnpm specified in the `packageManager` field of package.json. This is the same 15 | # field used by Corepack. 16 | manage-package-manager-versions=true 17 | -------------------------------------------------------------------------------- /js/testapps/rag/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './pdf-rag-firebase.js'; 18 | export * from './pdf-rag.js'; 19 | export * from './simple-rag.js'; 20 | -------------------------------------------------------------------------------- /samples/js-gemini/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gemini", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "npm run genkit:dev", 9 | "genkit:dev": "genkit start -- npx tsx --watch src/index.ts", 10 | "build": "tsc", 11 | "build:watch": "tsc --watch" 12 | }, 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "dependencies": { 17 | "@genkit-ai/google-genai": "^1.17.0", 18 | "genkit": "^1.17.0", 19 | "node-fetch": "3.3.2", 20 | "wav": "^1.0.2" 21 | }, 22 | "devDependencies": { 23 | "@types/wav": "^1.0.4", 24 | "genkit-cli": "^1.17.0", 25 | "tsx": "^4.20.3", 26 | "typescript": "^5.5.4" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/js-openai/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "openai", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "npm run genkit:dev", 9 | "genkit:dev": "genkit start -- npx tsx --watch src/index.ts", 10 | "build": "tsc", 11 | "build:watch": "tsc --watch" 12 | }, 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "dependencies": { 17 | "@genkit-ai/compat-oai": "^1.16.0", 18 | "genkit": "^1.16.0", 19 | "node-fetch": "3.3.2", 20 | "wav": "^1.0.2" 21 | }, 22 | "devDependencies": { 23 | "@types/wav": "^1.0.4", 24 | "genkit-cli": "^1.16.0", 25 | "tsx": "^4.20.3", 26 | "typescript": "^5.5.4" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /js/plugins/vertexai/src/common/constants.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export const CLOUD_PLATFORM_OAUTH_SCOPE = 18 | 'https://www.googleapis.com/auth/cloud-platform'; 19 | -------------------------------------------------------------------------------- /js/doc-snippets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "doc-snippets", 3 | "version": "1.0.0", 4 | "description": "", 5 | "keywords": [], 6 | "author": "", 7 | "license": "ISC", 8 | "scripts": { 9 | "compile": "tsc", 10 | "build": "pnpm build:clean && pnpm compile", 11 | "build:clean": "rimraf ./lib", 12 | "build:watch": "tsc --watch" 13 | }, 14 | "dependencies": { 15 | "@genkit-ai/express": "workspace:*", 16 | "@genkit-ai/googleai": "workspace:*", 17 | "@genkit-ai/vertexai": "workspace:*", 18 | "data-urls": "^5.0.0", 19 | "firebase-functions": "^6.3.1", 20 | "genkit": "workspace:*" 21 | }, 22 | "devDependencies": { 23 | "@types/data-urls": "^3.0.4", 24 | "npm-run-all": "^4.1.5", 25 | "rimraf": "^6.0.1", 26 | "typescript": "^5.6.3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/js-angular/genkit-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /samples/js-chatbot/genkit-app/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files. 2 | 3 | # Compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | /bazel-out 8 | 9 | # Node 10 | /node_modules 11 | npm-debug.log 12 | yarn-error.log 13 | 14 | # IDEs and editors 15 | .idea/ 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # Visual Studio Code 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | .history/* 30 | 31 | # Miscellaneous 32 | /.angular/cache 33 | .sass-cache/ 34 | /connect.lock 35 | /coverage 36 | /libpeerconnection.log 37 | testem.log 38 | /typings 39 | 40 | # System files 41 | .DS_Store 42 | Thumbs.db 43 | -------------------------------------------------------------------------------- /js/testapps/multiagents-demo/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { config } from 'dotenv'; 18 | import { defineFlows } from './flows'; 19 | 20 | config(); 21 | defineFlows(); 22 | -------------------------------------------------------------------------------- /py/samples/google-genai-image/README.md: -------------------------------------------------------------------------------- 1 | # Google Gemini Image Generation 2 | 3 | This sample uses the Gemini API for image generation. This sample uses the 4 | experimental Gemini model, which is available for now only in the Gemini API, 5 | not in Vertex AI api. If you need to run it on Vertex AI, please, refer to 6 | the Imagen sample. 7 | 8 | Prerequisites: 9 | 10 | * A Google Cloud account with access to Gemini API. 11 | * The `genkit` package. 12 | 13 | To run this sample: 14 | 15 | 1. Install the `genkit` package. 16 | 2. Set the `GOOGLE_API_KEY` environment variable to your Google Cloud API key. 17 | 18 | ```bash 19 | export GEMINI_API_KEY= 20 | ``` 21 | 22 | 3. Run the sample. 23 | 24 | ## Run the sample 25 | 26 | TODO 27 | 28 | ```bash 29 | uv run src/google_genai_image.py 30 | ``` 31 | -------------------------------------------------------------------------------- /js/genkit/src/registry.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { 18 | Registry, 19 | type ActionType, 20 | type AsyncProvider, 21 | type Schema, 22 | } from '@genkit-ai/core/registry'; 23 | -------------------------------------------------------------------------------- /js/plugins/anthropic/src/runner/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { BaseRunner } from './base.js'; 18 | export { BetaRunner } from './beta.js'; 19 | export { Runner } from './stable.js'; 20 | -------------------------------------------------------------------------------- /js/plugins/firebase/src/beta.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { FirestoreStreamManager } from './stream-manager/firestore.js'; 18 | export { RtdbStreamManager } from './stream-manager/rtdb.js'; 19 | -------------------------------------------------------------------------------- /js/plugins/mcp/src/util/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './message.js'; 18 | export * from './prompts.js'; 19 | export * from './tools.js'; 20 | export * from './transport.js'; 21 | -------------------------------------------------------------------------------- /js/testapps/context-caching2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "context-cashing2", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node lib/index.js", 9 | "build": "tsc", 10 | "build:watch": "tsc --watch", 11 | "genkit:dev": "cross-env GENKIT_ENV=dev npm run dev", 12 | "dev": "export GENKIT_RUNTIME_ID=$(openssl rand -hex 8) && node lib/index.js 2>&1" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "dependencies": { 18 | "@genkit-ai/googleai": "workspace:*", 19 | "@google/generative-ai": "^0.21.0", 20 | "genkit": "workspace:*" 21 | }, 22 | "devDependencies": { 23 | "cross-env": "^7.0.3", 24 | "typescript": "^5.6.2" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /js/testapps/next/src/app/page.module.css: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | * SPDX-License-Identifier: Apache-2.0 17 | */ 18 | 19 | .title { 20 | display: flex; 21 | gap: 10px; 22 | margin-bottom: 10px; 23 | } 24 | -------------------------------------------------------------------------------- /taplo.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | [formatting] 18 | align_entries = true 19 | array_trailing_comma = true 20 | reorder_keys = true 21 | trailing_newline = true 22 | -------------------------------------------------------------------------------- /js/plugins/mcp/examples/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@genkit-ai/mcp-examples-client-stdio", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "start": "genkit start -- tsx --watch index.ts", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "ISC", 14 | "dependencies": { 15 | "@genkit-ai/googleai": "file:../../../googleai", 16 | "@modelcontextprotocol/server-filesystem": "^0.5.1", 17 | "@modelcontextprotocol/server-github": "^0.5.1", 18 | "genkit": "file:../../../../genkit", 19 | "@genkit-ai/mcp": "file:../../" 20 | }, 21 | "devDependencies": { 22 | "@modelcontextprotocol/server-puppeteer": "^0.5.1", 23 | "tsx": "^4.19.2" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /js/testapps/vertexai-modelgarden/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "scripts": { 4 | "build": "tsc", 5 | "build:watch": "tsc --watch", 6 | "test": "echo \"Error: no test specified\" && exit 1", 7 | "genkit:dev": "genkit start -- npx tsx --watch src/index.ts" 8 | }, 9 | "name": "anthropic-models", 10 | "version": "1.0.0", 11 | "description": "", 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "dependencies": { 16 | "@genkit-ai/firebase": "workspace:*", 17 | "@genkit-ai/vertexai": "workspace:*", 18 | "@genkit-ai/google-genai": "workspace:*", 19 | "@mistralai/mistralai-gcp": "^1.3.4", 20 | "express": "^4.21.0", 21 | "genkit": "workspace:*", 22 | "zod": "3.22.4" 23 | }, 24 | "devDependencies": { 25 | "typescript": "^5.5.3" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /js/testapps/next/src/app/api/joke/route.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { tellJoke } from '@/genkit/joke'; 18 | import { appRoute } from '@genkit-ai/next'; 19 | 20 | export const POST = appRoute(tellJoke); 21 | -------------------------------------------------------------------------------- /js/testapps/docs-menu-basic/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "scripts": { 4 | "start": "node lib/index.js", 5 | "compile": "tsc", 6 | "build": "npm run build:clean && npm run compile", 7 | "build:clean": "rimraf ./lib", 8 | "build:watch": "tsc --watch", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "name": "basic", 12 | "version": "1.0.0", 13 | "description": "", 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "dependencies": { 18 | "genkit": "workspace:*", 19 | "@genkit-ai/firebase": "workspace:*", 20 | "@genkit-ai/google-genai": "workspace:*", 21 | "@genkit-ai/express": "workspace:*", 22 | "express": "^4.21.0" 23 | }, 24 | "devDependencies": { 25 | "rimraf": "^6.0.1", 26 | "typescript": "^5.3.3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /js/testapps/format-tester/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "format-tester", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "start": "node lib/index.js", 8 | "compile": "tsc", 9 | "build": "pnpm build:clean && pnpm compile", 10 | "build:clean": "rimraf ./lib", 11 | "build:watch": "tsc --watch", 12 | "build-and-run": "pnpm build && node lib/index.js" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "dependencies": { 18 | "@genkit-ai/google-genai": "workspace:*", 19 | "@genkit-ai/vertexai": "workspace:*", 20 | "@opentelemetry/sdk-trace-base": "~1.25.0", 21 | "genkit": "workspace:*" 22 | }, 23 | "devDependencies": { 24 | "rimraf": "^6.0.1", 25 | "tsx": "^4.19.2", 26 | "typescript": "^5.3.3" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /samples/js-angular/genkit-app/src/app/samples/streaming-json/streaming-json.component.scss: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | .wrapper { 18 | padding: 20px; 19 | } 20 | 21 | .characters { 22 | margin-top: 20px; 23 | } 24 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/go-runtime-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Go runtime bug report 3 | about: Create a report for Go runtime 4 | title: "[Go]" 5 | labels: bug, go 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. include full error messages. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior. Code samples. 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Screenshots** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Runtime (please complete the following information):** 23 | - OS: [e.g. Linux, MacOS] 24 | - Version [e.g. 22] 25 | 26 | ** Go version 27 | - run `go version` at paste here 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | -------------------------------------------------------------------------------- /js/testapps/vertexai-reranker/src/config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | import { config } from 'dotenv'; 17 | config(); 18 | export const PROJECT_ID = process.env.PROJECT_ID!; 19 | export const LOCATION = process.env.LOCATION!; 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/js-runtime-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: JS runtime bug report 3 | about: Create a report for JS runtime 4 | title: "[JS] " 5 | labels: bug, js 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. include full error messages. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior. Code samples. 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Screenshots** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Runtime (please complete the following information):** 23 | - OS: [e.g. Linux, MacOS] 24 | - Version [e.g. 22] 25 | 26 | ** Node version 27 | - run `node --version` at paste here 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | -------------------------------------------------------------------------------- /.prettierrc.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | trailingComma: 'es5' 16 | semi: true 17 | singleQuote: true 18 | bracketSameLine: true 19 | cssDeclarationSorterOrder: 'alphabetical' 20 | plugins: ['prettier-plugin-css-order', 'prettier-plugin-organize-imports'] 21 | -------------------------------------------------------------------------------- /js/plugins/vertexai/README.md: -------------------------------------------------------------------------------- 1 | # A Vertex AI plugin for Genkit 2 | 3 | ## Installing the plugin 4 | 5 | ```bash 6 | npm i --save @genkit-ai/vertexai 7 | ``` 8 | 9 | ## Using the plugin 10 | 11 | ```ts 12 | import { genkit } from 'genkit'; 13 | import { vertexAI } from '@genkit-ai/vertexai'; 14 | 15 | const ai = genkit({ 16 | plugins: [vertexAI()], 17 | model: vertexAI.model('gemini-2.5-flash'), 18 | }); 19 | 20 | async () => { 21 | const { text } = ai.generate('hi Gemini!'); 22 | console.log(text); 23 | }; 24 | ``` 25 | 26 | The sources for this package are in the main [Genkit](https://github.com/firebase/genkit) repo. Please file issues and pull requests against that repo. 27 | 28 | Usage information and reference details can be found in [official Genkit documentation](https://genkit.dev/docs/get-started/). 29 | 30 | License: Apache 2.0 31 | -------------------------------------------------------------------------------- /js/genkit/src/context.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { 18 | apiKey, 19 | getCallableJSON, 20 | getHttpStatus, 21 | type ApiKeyContext, 22 | type ContextProvider, 23 | type RequestData, 24 | } from '@genkit-ai/core'; 25 | -------------------------------------------------------------------------------- /samples/js-angular/server/src/genkit.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { googleAI } from '@genkit-ai/google-genai'; 18 | import { genkit } from 'genkit'; 19 | 20 | export const ai = genkit({ 21 | plugins: [googleAI()], 22 | }); 23 | -------------------------------------------------------------------------------- /js/testapps/custom-evaluators/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "custom-evaluators", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "start": "node lib/index.js", 8 | "compile": "tsc", 9 | "build": "pnpm build:clean && pnpm compile", 10 | "build:clean": "rimraf ./lib", 11 | "build:watch": "tsc --watch", 12 | "dev": "tsx --watch src/index.ts", 13 | "genkit:dev": "genkit start -- tsx --watch src/index.ts" 14 | }, 15 | "keywords": [], 16 | "author": "", 17 | "license": "ISC", 18 | "dependencies": { 19 | "@genkit-ai/google-genai": "workspace:*", 20 | "genkit": "workspace:*", 21 | "path": "^0.12.7" 22 | }, 23 | "devDependencies": { 24 | "cross-env": "^7.0.3", 25 | "tsx": "^4.19.2", 26 | "rimraf": "^6.0.1", 27 | "typescript": "^5.3.3" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export * from './main/flows-firebase-functions.js'; 18 | export * from './main/flows.js'; 19 | export * from './main/prompts.js'; 20 | export * from './main/tools.js'; 21 | -------------------------------------------------------------------------------- /js/ai/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/core/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/googleai/README.md: -------------------------------------------------------------------------------- 1 | # Google Gemini Developer API plugin for Genkit 2 | 3 | ## Installing the plugin 4 | 5 | ```bash 6 | npm i --save @genkit-ai/googleai 7 | ``` 8 | 9 | ## Using the plugin 10 | 11 | ```ts 12 | import { genkit } from 'genkit'; 13 | import { googleAI, gemini } from '@genkit-ai/googleai'; 14 | 15 | const ai = genkit({ 16 | plugins: [googleAI()], 17 | model: gemini('gemini-2.5-flash'), 18 | }); 19 | 20 | async () => { 21 | const { text } = ai.generate('hi Gemini!'); 22 | console.log(text); 23 | }; 24 | ``` 25 | 26 | The sources for this package are in the main [Genkit](https://github.com/firebase/genkit) repo. Please file issues and pull requests against that repo. 27 | 28 | Usage information and reference details can be found in [Genkit documentation](https://genkit.dev/docs/plugins/google-genai/). 29 | 30 | License: Apache 2.0 31 | -------------------------------------------------------------------------------- /js/testapps/durable-streaming/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "durable-streaming", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "start": "node lib/index.js", 8 | "compile": "tsc", 9 | "build": "pnpm build:clean && pnpm compile", 10 | "build:clean": "rimraf ./lib", 11 | "build:watch": "tsc --watch", 12 | "build-and-run": "pnpm build && node lib/index.js" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "dependencies": { 18 | "genkit": "workspace:^", 19 | "@genkit-ai/express": "workspace:^", 20 | "@genkit-ai/firebase": "workspace:^", 21 | "firebase-admin": "^13.5.0", 22 | "express": "^5.1.0" 23 | }, 24 | "devDependencies": { 25 | "rimraf": "^6.0.1", 26 | "typescript": "^5.3.3", 27 | "@types/express": "^4" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /js/genkit/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/testapps/context-caching/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "context-cashing", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "node lib/index.js", 9 | "build": "tsc", 10 | "build:watch": "tsc --watch", 11 | "genkit:dev": "cross-env GENKIT_ENV=dev npm run dev", 12 | "dev": "export GENKIT_RUNTIME_ID=$(openssl rand -hex 8) && node lib/index.js 2>&1" 13 | }, 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "dependencies": { 18 | "@genkit-ai/googleai": "workspace:*", 19 | "@genkit-ai/vertexai": "workspace:*", 20 | "@google/generative-ai": "^0.21.0", 21 | "genkit": "workspace:*" 22 | }, 23 | "devDependencies": { 24 | "cross-env": "^7.0.3", 25 | "typescript": "^5.6.2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /js/testapps/docs-menu-rag/README.md: -------------------------------------------------------------------------------- 1 | # Evaluating menuQA flow 2 | 3 | ## Build it 4 | 5 | ``` 6 | pnpm build 7 | ``` 8 | 9 | or if you need to, build everything: 10 | 11 | ``` 12 | cd ; pnpm run setup; cd - 13 | ``` 14 | 15 | where `` is the top level of the genkit repo. 16 | 17 | ## Run setup 18 | 19 | This will add the `GenkitGrubPub.pdf` to your index: 20 | 21 | ``` 22 | genkit flow:run setup 23 | ``` 24 | 25 | or add more pdfs to the index if you want: 26 | 27 | ``` 28 | genkit flow:run setup '["./path/to/your/file.pdf"]' 29 | ``` 30 | 31 | ## Run the flow via cli 32 | 33 | ``` 34 | genkit flow:run menuQA '"What burgers are on the menu?"' 35 | ``` 36 | 37 | ## Run the flow in the Developer UI 38 | 39 | ``` 40 | genkit start 41 | ``` 42 | 43 | Click on the `menuQA` flow in the lefthand navigation panel to run the new flow. 44 | -------------------------------------------------------------------------------- /js/testapps/multiagents-demo/src/config/genkit.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { googleAI } from '@genkit-ai/google-genai'; 18 | import { genkit } from 'genkit/beta'; 19 | 20 | export const ai = genkit({ 21 | plugins: [googleAI()], 22 | }); 23 | -------------------------------------------------------------------------------- /py/plugins/dev-local-vectorstore/src/genkit/plugins/dev_local_vectorstore/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | from .plugin_api import DevLocalVectorStore 18 | 19 | __all__ = [ 20 | DevLocalVectorStore.__name__, 21 | ] 22 | -------------------------------------------------------------------------------- /js/plugins/firebase/src/helpers.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { getApps, initializeApp } from 'firebase-admin/app'; 18 | 19 | export function initializeAppIfNecessary() { 20 | if (!getApps().length) { 21 | initializeApp(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /js/plugins/mcp/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/vertexai/src/rerankers/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { vertexAIRerankers, type PluginOptions } from './legacy/index.js'; 18 | export { 19 | vertexRerankers, 20 | type VertexRerankerPluginOptions, 21 | } from './v2/index.js'; 22 | -------------------------------------------------------------------------------- /js/testapps/multiagents-demo/src/flows/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { flow as multiAgentMultiModel } from './multiAgentMultiModel'; 18 | 19 | export function defineFlows() { 20 | return { 21 | multiAgentMultiModel, 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /samples/js-angular/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "scripts": { 4 | "start": "node lib/index.js", 5 | "genkit:dev": "genkit start -- tsx --watch src/index.ts", 6 | "build": "tsc", 7 | "build:watch": "tsc --watch", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "name": "js-angular", 11 | "version": "1.0.0", 12 | "description": "This is a simple UI for streaming RPG character generator.", 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "dependencies": { 17 | "genkit": "^1.0.4", 18 | "@genkit-ai/google-genai": "^1.17.0", 19 | "@genkit-ai/express": "^1.17.0", 20 | "express": "^4.21.0", 21 | "partial-json": "^0.1.7" 22 | }, 23 | "devDependencies": { 24 | "genkit-cli": "^1.17.0", 25 | "typescript": "^5.4.5", 26 | "tsx": "^4.19.2" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/py-runtime-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Python runtime bug report 3 | about: Create a report for Python runtime 4 | title: "[PY] " 5 | labels: bug, python 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. include full error messages. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior. Code samples. 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Screenshots** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Runtime (please complete the following information):** 23 | - OS: [e.g. Linux, macOS] 24 | - Genkit Version: [e.g. 0.3.1] 25 | 26 | **Python version** 27 | - Run `python3 --version` at paste here 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | -------------------------------------------------------------------------------- /.github/workflows/scripts/ensure-clean-working-tree.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2024 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | 17 | if [ "$(git status --short)" ] 18 | then 19 | echo "Unclean git status" 20 | git status --long 21 | exit 1 22 | else 23 | echo "Git status is clean" 24 | exit 0 25 | fi -------------------------------------------------------------------------------- /genkit-tools/cli/src/bin/genkit.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | /** 3 | * Copyright 2024 Google LLC 4 | * 5 | * Licensed under the Apache License, Version 2.0 (the "License"); 6 | * you may not use this file except in compliance with the License. 7 | * You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | /** Shim wrapper for genkit CLI */ 19 | 20 | import { startCLI } from '../cli'; 21 | 22 | void (async () => { 23 | await startCLI(); 24 | process.exit(); 25 | })(); 26 | -------------------------------------------------------------------------------- /js/genkit/src/tool.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | export { 18 | asTool, 19 | dynamicTool, 20 | interrupt, 21 | toToolDefinition, 22 | tool, 23 | type ToolAction, 24 | type ToolArgument, 25 | type ToolConfig, 26 | } from '@genkit-ai/ai/tool'; 27 | -------------------------------------------------------------------------------- /js/plugins/checks/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/chroma/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/cloud-sql-pg/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/express/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/firebase/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/google-genai/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/googleai/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/next/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/ollama/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/pinecone/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/vertexai/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/prompts/markdown.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-2.5-flash 3 | config: 4 | temperature: 0.4 5 | safetySettings: 6 | - category: HARM_CATEGORY_HATE_SPEECH 7 | threshold: BLOCK_ONLY_HIGH 8 | - category: HARM_CATEGORY_DANGEROUS_CONTENT 9 | threshold: BLOCK_ONLY_HIGH 10 | - category: HARM_CATEGORY_HARASSMENT 11 | threshold: BLOCK_ONLY_HIGH 12 | - category: HARM_CATEGORY_SEXUALLY_EXPLICIT 13 | threshold: BLOCK_ONLY_HIGH 14 | input: 15 | schema: 16 | thingOne: string 17 | thingTwo: string 18 | default: 19 | persona: java 20 | --- 21 | 22 | Compare {{thingOne}} to {{thingTwo}}. 23 | 24 | Instructions: 25 | 26 | 1. Use a markdown table with the first column for {{thingOne}} and the second for {{thingTwo}}. 27 | 1. Include approximately 5 rows. 28 | 1. Use appropriate styling, markup, etc as needed. 29 | -------------------------------------------------------------------------------- /js/testapps/next/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "noImplicitReturns": true, 4 | "noUnusedLocals": false, 5 | "outDir": "lib", 6 | "sourceMap": true, 7 | "strict": true, 8 | "target": "es2017", 9 | "skipLibCheck": true, 10 | "esModuleInterop": true, 11 | "lib": ["dom", "dom.iterable", "esnext"], 12 | "allowJs": true, 13 | "noEmit": true, 14 | "incremental": true, 15 | "isolatedModules": true, 16 | "jsx": "preserve", 17 | "plugins": [ 18 | { 19 | "name": "next" 20 | } 21 | ], 22 | "baseUrl": ".", 23 | "paths": { 24 | "@/*": ["src/*"] 25 | }, 26 | "moduleResolution": "bundler", 27 | "resolveJsonModule": true, 28 | "module": "esnext" 29 | }, 30 | "compileOnSave": true, 31 | "include": ["src", ".next/types/**/*.ts"], 32 | "exclude": ["node_modules"] 33 | } 34 | -------------------------------------------------------------------------------- /py/bin/cleanup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2025 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # SPDX-License-Identifier: Apache-2.0 17 | 18 | set -x 19 | set -euo pipefail 20 | 21 | function genkit::cleanup() { 22 | rm -rf /tmp/e2e* || true && rm -rf /tmp/test-cli* || true 23 | } 24 | 25 | genkit::cleanup 26 | -------------------------------------------------------------------------------- /py/bin/watch_python_tests: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2025 Google LLC 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # SPDX-License-Identifier: Apache-2.0 17 | 18 | # Watch python tests. 19 | 20 | set -euo pipefail 21 | 22 | TOP_DIR=$(git rev-parse --show-toplevel) 23 | 24 | uv run --directory "${TOP_DIR}/py" ptw -- . 25 | -------------------------------------------------------------------------------- /js/plugins/anthropic/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2025 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/compat-oai/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/google-cloud/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /js/plugins/langchain/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | -------------------------------------------------------------------------------- /py/plugins/google-cloud/src/genkit/plugins/google_cloud/telemetry/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Google LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # 15 | # SPDX-License-Identifier: Apache-2.0 16 | 17 | """Telemetry exports for Google Cloud plugin.""" 18 | 19 | from .tracing import add_gcp_telemetry 20 | 21 | __all__ = ['add_gcp_telemetry'] 22 | -------------------------------------------------------------------------------- /py/samples/ollama-hello/README.md: -------------------------------------------------------------------------------- 1 | # Hello Ollama 2 | 3 | ## Prerequisites 4 | 5 | - **Ollama** - a local AI model server, which is used to handle embeddings and generate responses. 6 | 7 | ### Step 1: Install Ollama 8 | 9 | 1. Go to the [Ollama website](https://ollama.com/download) to download and install Ollama for your operating system. 10 | 2. Once installed, start the Ollama server by running: 11 | 12 | ```bash 13 | ollama serve 14 | ``` 15 | 16 | The server will run at http://localhost:11434 by default. 17 | 18 | ### Step 2: Pull the Required Models 19 | 20 | In this example, we use two models with Ollama. 21 | Run the following commands in your terminal to pull these models: 22 | 23 | ```bash 24 | ollama pull mistral-nemo:latest 25 | ollama pull gemma3:latest 26 | ``` 27 | 28 | ### Step 3: Execute Sample 29 | 30 | ```bash 31 | genkit start -- uv run src/ollama_hello.py 32 | ``` 33 | -------------------------------------------------------------------------------- /js/plugins/dev-local-vectorstore/tsup.config.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2024 Google LLC 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | import { defineConfig, type Options } from 'tsup'; 18 | import { defaultOptions } from '../../tsup.common'; 19 | 20 | export default defineConfig({ 21 | ...(defaultOptions as Options), 22 | }); 23 | --------------------------------------------------------------------------------