├── .editorconfig ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── cli-or-dev-ui-bug-report.md │ ├── dev-ui-feature.md │ ├── docs.md │ ├── feature_request.md │ ├── go-runtime-bug-report.md │ ├── js-runtime-bug-report.md │ └── py-runtime-bug-report.md ├── labeler.yml ├── pull_request_template.md └── workflows │ ├── builder.yml │ ├── bump-cli-version.yml │ ├── bump-js-version.yml │ ├── bump-package-version.yml │ ├── e2e-tests.yml │ ├── engdoc.yml │ ├── formatter.yml │ ├── go.yml │ ├── labeler.yml │ ├── publish_python.yml │ ├── python.yml │ ├── release_js_main.yml │ ├── samples.yml │ ├── scripts │ ├── check-generated-go.sh │ └── ensure-clean-working-tree.sh │ └── tests.yml ├── .gitignore ├── .hooks ├── commit-message-format-pre-push ├── conventional-commit-msg └── no-commits-on-branches ├── .npmrc ├── .prettierignore ├── .prettierrc.yaml ├── COMMIT_MESSAGE_TEMPLATE ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── bin ├── add_license ├── check-licenses ├── check_license ├── fmt ├── format_toml_files ├── golang ├── killports ├── run_go_tests ├── run_lint ├── setup └── update_deps ├── biome.json ├── captainhook.json ├── docs ├── README.md └── resources │ ├── genkit-logo-dark.png │ ├── genkit-logo.png │ └── readme-ui-traces-screenshot.png ├── genkit-tools ├── cli │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── jest.config.ts │ ├── package.json │ ├── src │ │ ├── bin │ │ │ └── genkit.ts │ │ ├── cli.ts │ │ ├── commands │ │ │ ├── config.ts │ │ │ ├── eval-extract-data.ts │ │ │ ├── eval-flow.ts │ │ │ ├── eval-run.ts │ │ │ ├── flow-batch-run.ts │ │ │ ├── flow-run.ts │ │ │ ├── plugins.ts │ │ │ ├── start.ts │ │ │ ├── ui-start.ts │ │ │ └── ui-stop.ts │ │ └── utils │ │ │ ├── manager-utils.ts │ │ │ └── server-harness.ts │ ├── tests │ │ └── commands │ │ │ ├── eval-flow_test.ts │ │ │ └── eval-run_test.ts │ └── tsconfig.json ├── common │ ├── .npmignore │ ├── LICENSE │ ├── jest.config.ts │ ├── package.json │ ├── src │ │ ├── api │ │ │ └── reflection.ts │ │ ├── eval │ │ │ ├── evaluate.ts │ │ │ ├── exporter.ts │ │ │ ├── index.ts │ │ │ ├── localFileDatasetStore.ts │ │ │ ├── localFileEvalStore.ts │ │ │ ├── parser.ts │ │ │ └── validate.ts │ │ ├── manager │ │ │ ├── index.ts │ │ │ ├── manager.ts │ │ │ └── types.ts │ │ ├── plugin │ │ │ ├── config.ts │ │ │ ├── index.ts │ │ │ └── plugins.ts │ │ ├── server │ │ │ ├── index.ts │ │ │ ├── router.ts │ │ │ └── server.ts │ │ ├── types │ │ │ ├── action.ts │ │ │ ├── analytics.ts │ │ │ ├── apis.ts │ │ │ ├── document.ts │ │ │ ├── embedder.ts │ │ │ ├── env.ts │ │ │ ├── error.ts │ │ │ ├── eval.ts │ │ │ ├── evaluator.ts │ │ │ ├── index.ts │ │ │ ├── model.ts │ │ │ ├── prompt.ts │ │ │ ├── reranker.ts │ │ │ ├── retriever.ts │ │ │ ├── status.ts │ │ │ └── trace.ts │ │ └── utils │ │ │ ├── analytics.ts │ │ │ ├── configstore.ts │ │ │ ├── eval.ts │ │ │ ├── index.ts │ │ │ ├── logger.ts │ │ │ ├── package.ts │ │ │ ├── prompt.ts │ │ │ ├── trace.ts │ │ │ ├── ui-assets.ts │ │ │ └── utils.ts │ ├── tests │ │ ├── eval │ │ │ ├── exporter_test.ts │ │ │ ├── localFileDatasetStore_test.ts │ │ │ ├── localFileEvalStore_test.ts │ │ │ └── parser_test.ts │ │ └── utils │ │ │ ├── eval_test.ts │ │ │ ├── prompt_test.ts │ │ │ ├── trace.ts │ │ │ ├── trace_test.ts │ │ │ └── utils_test.ts │ ├── tsconfig.cjs.json │ ├── tsconfig.esm.json │ ├── tsconfig.json │ └── tsconfig.types.json ├── genkit-schema.json ├── package.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── reflectionApi.yaml ├── scripts │ └── schema-exporter.ts ├── telemetry-server │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ ├── localFileTraceStore.ts │ │ └── types.ts │ ├── tests │ │ ├── file_store_test.ts │ │ └── utils.ts │ ├── tsconfig.cjs.json │ ├── tsconfig.esm.json │ ├── tsconfig.json │ └── tsconfig.types.json └── tsconfig.base.json ├── go ├── README.md ├── ai │ ├── action_test.go │ ├── document.go │ ├── document_test.go │ ├── embedder.go │ ├── evaluator.go │ ├── evaluator_test.go │ ├── format_array.go │ ├── format_enum.go │ ├── format_json.go │ ├── format_jsonl.go │ ├── format_text.go │ ├── formatter.go │ ├── formatter_test.go │ ├── gen.go │ ├── generate.go │ ├── generate_test.go │ ├── model_middleware.go │ ├── model_middleware_test.go │ ├── option.go │ ├── option_test.go │ ├── prompt.go │ ├── prompt_test.go │ ├── request_helpers.go │ ├── retriever.go │ └── tools.go ├── core │ ├── action.go │ ├── action_test.go │ ├── context.go │ ├── core.go │ ├── error.go │ ├── flow.go │ ├── flow_test.go │ ├── logger │ │ └── logger.go │ ├── middleware.go │ ├── schemas.config │ ├── status_types.go │ └── tracing │ │ ├── milliseconds.go │ │ ├── milliseconds_test.go │ │ ├── store.go │ │ ├── store_test.go │ │ ├── telemetry.go │ │ ├── testdata │ │ └── trace.json │ │ ├── trace_server_exporter.go │ │ ├── trace_server_exporter_test.go │ │ ├── tracing.go │ │ └── tracing_test.go ├── genkit │ ├── genkit.go │ ├── genkit_test.go │ ├── plugin.go │ ├── reflection.go │ ├── reflection_test.go │ ├── servers.go │ ├── servers_test.go │ └── testdata │ │ └── conformance │ │ ├── basic.json │ │ └── run-1.json ├── go.mod ├── go.sum ├── internal │ ├── base │ │ ├── context_key.go │ │ ├── json.go │ │ ├── json_test.go │ │ ├── misc.go │ │ └── validation.go │ ├── cmd │ │ ├── copy │ │ │ ├── copy.go │ │ │ ├── copy_test.go │ │ │ └── testdata │ │ │ │ ├── multiple.txt │ │ │ │ └── simple.txt │ │ ├── jsonschemagen │ │ │ ├── jsonschema.go │ │ │ ├── jsonschema_test.go │ │ │ ├── jsonschemagen.go │ │ │ ├── jsonschemagen_test.go │ │ │ └── testdata │ │ │ │ ├── golden │ │ │ │ ├── test.config │ │ │ │ └── test.json │ │ └── weave │ │ │ └── weave.go │ ├── doc-snippets │ │ ├── doc.go │ │ ├── dotprompt.go │ │ ├── flows.go │ │ ├── gcp.go │ │ ├── googleai.go │ │ ├── init │ │ │ └── main.go │ │ ├── modelplugin │ │ │ └── modelplugin.go │ │ ├── models.go │ │ ├── ollama.go │ │ ├── pinecone.go │ │ ├── plugin │ │ │ └── plugin.go │ │ ├── prompts.go │ │ ├── rag │ │ │ ├── main.go │ │ │ ├── pdf │ │ │ │ └── pdf.go │ │ │ └── textsplitter │ │ │ │ └── textsplitter.go │ │ ├── telemetryplugin │ │ │ ├── exporters.go │ │ │ └── telemetryplugin.go │ │ └── vertexai.go │ ├── fakeembedder │ │ ├── fakeembedder.go │ │ └── fakeembedder_test.go │ ├── metrics │ │ └── metrics.go │ ├── registry │ │ └── registry.go │ └── version.go ├── plugins │ ├── compat_oai │ │ ├── README.md │ │ ├── anthropic │ │ │ ├── README.md │ │ │ ├── anthropic.go │ │ │ └── anthropic_live_test.go │ │ ├── compat_oai.go │ │ ├── generate.go │ │ ├── generate_live_test.go │ │ └── openai │ │ │ ├── README.md │ │ │ ├── openai.go │ │ │ └── openai_live_test.go │ ├── evaluators │ │ ├── evaluators.go │ │ └── evaluators_test.go │ ├── firebase │ │ ├── auth.go │ │ ├── firebase.go │ │ ├── firebase_test.go │ │ ├── retriever.go │ │ └── retriever_test.go │ ├── googlecloud │ │ ├── googlecloud.go │ │ ├── googlecloud_test.go │ │ ├── slog_handler.go │ │ └── slog_handler_test.go │ ├── googlegenai │ │ ├── cache.go │ │ ├── cache_test.go │ │ ├── gemini.go │ │ ├── gemini_test.go │ │ ├── googleai_live_test.go │ │ ├── googlegenai.go │ │ ├── models.go │ │ └── vertexai_live_test.go │ ├── internal │ │ ├── models.go │ │ └── uri │ │ │ ├── uri.go │ │ │ └── uri_test.go │ ├── localvec │ │ ├── localvec.go │ │ └── localvec_test.go │ ├── ollama │ │ ├── embed.go │ │ ├── embed_test.go │ │ ├── ollama.go │ │ ├── ollama_live_test.go │ │ └── ollama_test.go │ ├── pinecone │ │ ├── genkit.go │ │ ├── genkit_test.go │ │ ├── pinecone.go │ │ └── pinecone_test.go │ ├── server │ │ └── server.go │ ├── vertexai │ │ └── modelgarden │ │ │ ├── anthropic.go │ │ │ ├── anthropic_live_test.go │ │ │ ├── anthropic_test.go │ │ │ └── models.go │ └── weaviate │ │ ├── weaviate.go │ │ └── weaviate_test.go ├── samples │ ├── basic-gemini-with-context │ │ └── main.go │ ├── basic-gemini │ │ └── main.go │ ├── cache-gemini │ │ └── main.go │ ├── cloud_run_deploy.sh │ ├── cloud_run_request.sh │ ├── code-execution-gemini │ │ └── main.go │ ├── coffee-shop │ │ └── main.go │ ├── compat_oai │ │ ├── anthropic │ │ │ └── main.go │ │ └── openai │ │ │ └── main.go │ ├── firebase-retrievers │ │ ├── README.md │ │ └── main.go │ ├── flow-sample1 │ │ └── main.go │ ├── formats │ │ └── main.go │ ├── imagen-gemini │ │ └── main.go │ ├── menu │ │ ├── main.go │ │ ├── s01.go │ │ ├── s02.go │ │ ├── s03.go │ │ ├── s04.go │ │ ├── s05.go │ │ └── testdata │ │ │ ├── menu.jpeg │ │ │ └── menu.json │ ├── modelgarden │ │ └── main.go │ ├── ollama-tools │ │ └── main.go │ ├── ollama-vision │ │ └── main.go │ ├── partials-and-helpers │ │ └── main.go │ ├── pgvector │ │ ├── main.go │ │ └── pgvector.sql │ ├── prompts-dir │ │ ├── main.go │ │ └── prompts │ │ │ └── example.prompt │ ├── prompts │ │ ├── main.go │ │ └── prompts │ │ │ ├── countries.prompt │ │ │ └── media.prompt │ └── rag │ │ ├── data │ │ └── eval-inputs.json │ │ └── main.go └── tests │ ├── api_test.go │ ├── test_app │ └── main.go │ └── utils │ └── utils.go ├── js ├── ai │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── chat.ts │ │ ├── document.ts │ │ ├── embedder.ts │ │ ├── evaluator.ts │ │ ├── extract.ts │ │ ├── formats │ │ │ ├── array.ts │ │ │ ├── enum.ts │ │ │ ├── index.ts │ │ │ ├── json.ts │ │ │ ├── jsonl.ts │ │ │ ├── text.ts │ │ │ └── types.ts │ │ ├── generate.ts │ │ ├── generate │ │ │ ├── action.ts │ │ │ ├── chunk.ts │ │ │ ├── resolve-tool-requests.ts │ │ │ └── response.ts │ │ ├── index.ts │ │ ├── message.ts │ │ ├── model.ts │ │ ├── model │ │ │ └── middleware.ts │ │ ├── prompt.ts │ │ ├── reranker.ts │ │ ├── retriever.ts │ │ ├── session.ts │ │ ├── testing │ │ │ ├── index.ts │ │ │ └── model-tester.ts │ │ ├── tool.ts │ │ └── types.ts │ ├── tests │ │ ├── extract_test.ts │ │ ├── formats │ │ │ ├── array_test.ts │ │ │ ├── enum_test.ts │ │ │ ├── format_test.ts │ │ │ ├── json_test.ts │ │ │ ├── jsonl_test.ts │ │ │ └── text_test.ts │ │ ├── generate │ │ │ ├── action_test.ts │ │ │ ├── chunk_test.ts │ │ │ ├── generate_test.ts │ │ │ └── response_test.ts │ │ ├── helpers.ts │ │ ├── message │ │ │ └── message_test.ts │ │ ├── model │ │ │ ├── document_test.ts │ │ │ └── middleware_test.ts │ │ ├── prompt │ │ │ └── prompt_test.ts │ │ ├── reranker │ │ │ └── reranker_test.ts │ │ └── tool_test.ts │ ├── tsconfig.json │ ├── tsup.config.ts │ └── typedoc.json ├── core │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── api │ │ └── reflectionApi.yaml │ ├── package.json │ ├── src │ │ ├── action.ts │ │ ├── async.ts │ │ ├── context.ts │ │ ├── error.ts │ │ ├── flow.ts │ │ ├── index.ts │ │ ├── logging.ts │ │ ├── plugin.ts │ │ ├── reflection.ts │ │ ├── registry.ts │ │ ├── schema.ts │ │ ├── statusTypes.ts │ │ ├── telemetryTypes.ts │ │ ├── tracing.ts │ │ ├── tracing │ │ │ ├── exporter.ts │ │ │ ├── instrumentation.ts │ │ │ ├── multiSpanProcessor.ts │ │ │ ├── processor.ts │ │ │ └── types.ts │ │ └── utils.ts │ ├── tests │ │ ├── action_test.ts │ │ ├── async_test.ts │ │ ├── context_test.ts │ │ ├── flow_test.ts │ │ ├── registry_test.ts │ │ ├── schema_test.ts │ │ └── utils.ts │ ├── tsconfig.json │ ├── tsup.config.ts │ └── typedoc.json ├── doc-snippets │ ├── package.json │ ├── src │ │ ├── dotprompt │ │ │ ├── index.ts │ │ │ ├── minimal.ts │ │ │ └── prompts │ │ │ │ ├── ex01.prompt │ │ │ │ ├── ex02.prompt │ │ │ │ ├── ex03.prompt │ │ │ │ ├── ex04.prompt │ │ │ │ ├── ex05.prompt │ │ │ │ ├── ex06.prompt │ │ │ │ ├── ex07.prompt │ │ │ │ └── ex08.prompt │ │ ├── flows │ │ │ ├── express.ts │ │ │ ├── firebase.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── models │ │ │ ├── imagen.ts │ │ │ ├── index.ts │ │ │ └── minimal.ts │ │ └── multi-agent │ │ │ ├── multi.ts │ │ │ └── simple.ts │ └── tsconfig.json ├── genkit │ ├── .npmignore │ ├── LICENSE │ ├── README.md │ ├── package.json │ ├── src │ │ ├── beta.ts │ │ ├── client │ │ │ ├── client.ts │ │ │ └── index.ts │ │ ├── common.ts │ │ ├── context.ts │ │ ├── embedder.ts │ │ ├── evaluator.ts │ │ ├── extract.ts │ │ ├── formats.ts │ │ ├── genkit-beta.ts │ │ ├── genkit.ts │ │ ├── index.ts │ │ ├── logging.ts │ │ ├── middleware.ts │ │ ├── model.ts │ │ ├── plugin.ts │ │ ├── registry.ts │ │ ├── reranker.ts │ │ ├── retriever.ts │ │ ├── schema.ts │ │ ├── testing.ts │ │ ├── tool.ts │ │ └── tracing.ts │ ├── tests │ │ ├── chat_test.ts │ │ ├── embed_test.ts │ │ ├── evaluate_test.ts │ │ ├── flow_test.ts │ │ ├── formats_test.ts │ │ ├── generate_test.ts │ │ ├── helpers.ts │ │ ├── prompts │ │ │ ├── badSchemaRef.prompt │ │ │ ├── chat_preamble.prompt │ │ │ ├── kitchensink.prompt │ │ │ ├── output.prompt │ │ │ ├── schemaRef.prompt │ │ │ ├── sub │ │ │ │ └── test.prompt │ │ │ ├── test.prompt │ │ │ ├── test.variant.prompt │ │ │ └── toolPrompt.prompt │ │ ├── prompts_test.ts │ │ └── session_test.ts │ ├── tsconfig.json │ ├── tsup.config.ts │ └── typedoc.json ├── index.typedoc.md ├── package.json ├── plugins │ ├── checks │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── evaluation.ts │ │ │ ├── guardrails.ts │ │ │ ├── index.ts │ │ │ ├── metrics.ts │ │ │ └── middleware.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── chroma │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── compat-oai │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── jest.config.js │ │ ├── package.json │ │ ├── src │ │ │ ├── dalle.ts │ │ │ ├── embedder.ts │ │ │ ├── gpt.test.ts │ │ │ ├── gpt.ts │ │ │ ├── index.ts │ │ │ ├── tts.ts │ │ │ └── whisper.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── dev-local-vectorstore │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── evaluators │ │ ├── .gitignore │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── prompts │ │ │ ├── answer_accuracy.prompt │ │ │ ├── answer_relevancy.prompt │ │ │ ├── faithfulness_long_form.prompt │ │ │ ├── faithfulness_nli.prompt │ │ │ └── maliciousness.prompt │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── metrics │ │ │ │ ├── answer_accuracy.ts │ │ │ │ ├── answer_relevancy.ts │ │ │ │ ├── deep-equal.ts │ │ │ │ ├── faithfulness.ts │ │ │ │ ├── helper.ts │ │ │ │ ├── index.ts │ │ │ │ ├── jsonata.ts │ │ │ │ ├── maliciousness.ts │ │ │ │ └── regexp.ts │ │ │ └── types.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── express │ │ ├── .npmignore │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── index.ts │ │ │ └── utils.ts │ │ ├── tests │ │ │ └── express_test.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── firebase │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── jest.config.ts │ │ ├── package.json │ │ ├── src │ │ │ ├── beta │ │ │ │ └── data-connect.ts │ │ │ ├── context.ts │ │ │ ├── firestore-retriever.ts │ │ │ ├── helpers.ts │ │ │ ├── index.ts │ │ │ └── user-engagement.ts │ │ ├── tests │ │ │ ├── context_test.ts │ │ │ └── user_engagement_test.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── google-cloud │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── jest.config.ts │ │ ├── package.json │ │ ├── src │ │ │ ├── auth.ts │ │ │ ├── gcpLogger.ts │ │ │ ├── gcpOpenTelemetry.ts │ │ │ ├── index.ts │ │ │ ├── metrics.ts │ │ │ ├── telemetry │ │ │ │ ├── action.ts │ │ │ │ ├── defaults.ts │ │ │ │ ├── engagement.ts │ │ │ │ ├── feature.ts │ │ │ │ ├── generate.ts │ │ │ │ └── path.ts │ │ │ ├── types.ts │ │ │ └── utils.ts │ │ ├── tests │ │ │ ├── logs_no_input_output_test.ts │ │ │ ├── logs_session_test.ts │ │ │ ├── logs_test.ts │ │ │ ├── metrics_test.ts │ │ │ └── traces_test.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── googleai │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── common.ts │ │ │ ├── context-caching │ │ │ │ ├── constants.ts │ │ │ │ ├── index.ts │ │ │ │ ├── types.ts │ │ │ │ └── utils.ts │ │ │ ├── embedder.ts │ │ │ ├── gemini.ts │ │ │ ├── index.ts │ │ │ └── list-models.ts │ │ ├── tests │ │ │ ├── context-caching │ │ │ │ └── utils_test.ts │ │ │ └── gemini_test.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── langchain │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── evaluators.ts │ │ │ ├── index.ts │ │ │ ├── model.ts │ │ │ └── tracing.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── mcp │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── examples │ │ │ ├── client │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ │ └── server │ │ │ │ ├── index.js │ │ │ │ ├── package.json │ │ │ │ └── prompts │ │ │ │ └── port_code.prompt │ │ ├── package.json │ │ ├── src │ │ │ ├── client │ │ │ │ ├── message.ts │ │ │ │ ├── prompts.ts │ │ │ │ ├── resources.ts │ │ │ │ └── tools.ts │ │ │ ├── index.ts │ │ │ └── server.ts │ │ ├── tests │ │ │ └── mcp_test.ts │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── next │ │ ├── .npmignore │ │ ├── README.md │ │ ├── jest.config.ts │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ ├── src │ │ │ ├── client.ts │ │ │ └── index.ts │ │ ├── tests │ │ │ └── index_test.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── ollama │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── embeddings.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── tests │ │ │ ├── embedding_live_test.ts │ │ │ ├── embeddings_test.ts │ │ │ └── model_test.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ ├── pinecone │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json │ └── vertexai │ │ ├── .npmignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ ├── common │ │ │ ├── constants.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── context-caching │ │ │ ├── constants.ts │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ └── utils.ts │ │ ├── embedder.ts │ │ ├── evaluation │ │ │ ├── evaluation.ts │ │ │ ├── evaluator_factory.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── gemini.ts │ │ ├── imagen.ts │ │ ├── index.ts │ │ ├── list-models.ts │ │ ├── modelgarden │ │ │ ├── anthropic.ts │ │ │ ├── index.ts │ │ │ ├── mistral.ts │ │ │ ├── model_garden.ts │ │ │ ├── openai_compatibility.ts │ │ │ └── types.ts │ │ ├── predict.ts │ │ ├── rerankers │ │ │ ├── constants.ts │ │ │ ├── index.ts │ │ │ ├── reranker.ts │ │ │ └── types.ts │ │ └── vectorsearch │ │ │ ├── index.ts │ │ │ ├── types.ts │ │ │ └── vector_search │ │ │ ├── bigquery.ts │ │ │ ├── firestore.ts │ │ │ ├── index.ts │ │ │ ├── indexers.ts │ │ │ ├── query_public_endpoint.ts │ │ │ ├── retrievers.ts │ │ │ ├── types.ts │ │ │ ├── upsert_datapoints.ts │ │ │ └── utils.ts │ │ ├── tests │ │ ├── context-caching │ │ │ └── utils_test.ts │ │ ├── gemini_test.ts │ │ ├── modelgarden │ │ │ ├── anthropic_test.ts │ │ │ └── mistral_test.ts │ │ ├── plugin_test.ts │ │ └── vectorsearch │ │ │ ├── bigquery_test.ts │ │ │ ├── query_public_endpoint_test.ts │ │ │ ├── upsert_datapoints_test.ts │ │ │ └── utils_test.ts │ │ ├── tsconfig.json │ │ ├── tsup.config.ts │ │ └── typedoc.json ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── testapps │ ├── basic-gemini │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── compat-oai │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── context-caching │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── context-caching2 │ │ ├── .gitignore │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── custom-evaluators │ │ ├── README.md │ │ ├── datasets │ │ │ ├── deliciousness_dataset.json │ │ │ ├── funniness_dataset.json │ │ │ ├── pii_detection_dataset.json │ │ │ └── regex_dataset.json │ │ ├── package.json │ │ ├── prompts │ │ │ ├── deliciousness.prompt │ │ │ ├── funniness.prompt │ │ │ └── pii_detection.prompt │ │ ├── src │ │ │ ├── constants.ts │ │ │ ├── deliciousness │ │ │ │ ├── deliciousness.ts │ │ │ │ └── deliciousness_evaluator.ts │ │ │ ├── funniness │ │ │ │ ├── funniness.ts │ │ │ │ └── funniness_evaluator.ts │ │ │ ├── index.ts │ │ │ ├── pii │ │ │ │ ├── pii_detection.ts │ │ │ │ └── pii_evaluator.ts │ │ │ └── regex │ │ │ │ └── regex_evaluator.ts │ │ └── tsconfig.json │ ├── dev-ui-gallery │ │ ├── package.json │ │ ├── prompts │ │ │ ├── hello.first-last-name.prompt │ │ │ ├── hello.history.prompt │ │ │ ├── hello.json-output.prompt │ │ │ ├── hello.prompt │ │ │ ├── hello.system.prompt │ │ │ ├── media │ │ │ │ └── imagen3.prompt │ │ │ └── tools │ │ │ │ └── weather.prompt │ │ ├── src │ │ │ ├── common │ │ │ │ ├── types.ts │ │ │ │ └── util.ts │ │ │ ├── genkit.ts │ │ │ ├── index.ts │ │ │ └── main │ │ │ │ ├── flows-firebase-functions.ts │ │ │ │ ├── flows.ts │ │ │ │ ├── prompts.ts │ │ │ │ └── tools.ts │ │ └── tsconfig.json │ ├── docs-menu-basic │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── docs-menu-rag │ │ ├── README.md │ │ ├── docs │ │ │ └── GenkitGrubPub.pdf │ │ ├── package.json │ │ ├── src │ │ │ ├── genkit.ts │ │ │ ├── index.ts │ │ │ ├── indexer.ts │ │ │ └── menuQA.ts │ │ └── tsconfig.json │ ├── esm │ │ ├── .gitignore │ │ ├── docs │ │ │ └── flume-java.pdf │ │ ├── package.json │ │ ├── prompts │ │ │ └── myPrompt.prompt │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── evals │ │ ├── README.md │ │ ├── data │ │ │ ├── capra-test.json │ │ │ ├── cat_adoption_questions.jsonl │ │ │ ├── cat_adoption_questions_with_reference.json │ │ │ └── dogfacts.json │ │ ├── docs │ │ │ ├── cat-handbook.pdf │ │ │ └── cat-wiki.pdf │ │ ├── package.json │ │ ├── src │ │ │ ├── eval-in-code.ts │ │ │ ├── genkit.ts │ │ │ ├── index.ts │ │ │ ├── pdf-rag.ts │ │ │ └── setup.ts │ │ └── tsconfig.json │ ├── express │ │ ├── package.json │ │ ├── prompts │ │ │ └── TellJoke.prompt │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── firebase-functions-sample1 │ │ ├── README.md │ │ ├── demopage │ │ │ └── index.js │ │ ├── firebase.json │ │ ├── functions │ │ │ ├── package.json │ │ │ ├── prompts │ │ │ │ └── TellJoke.prompt │ │ │ ├── src │ │ │ │ └── index.ts │ │ │ └── tsconfig.json │ │ ├── package.json │ │ ├── public │ │ │ ├── index.html │ │ │ └── style.css │ │ └── webpack.config.js │ ├── flow-sample1 │ │ ├── genkit-tools.conf.js │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── flow-simple-ai │ │ ├── package.json │ │ ├── prompts │ │ │ ├── TellJoke.prompt │ │ │ └── dotpromptContext.prompt │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── format-tester │ │ ├── package.json │ │ ├── src │ │ │ ├── index.ts │ │ │ └── tools.ts │ │ └── tsconfig.json │ ├── google-ai-code-execution │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── langchain │ │ ├── genkit-getting-started.pdf │ │ ├── genkit-getting-started.txt │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── menu │ │ ├── README.md │ │ ├── data │ │ │ ├── menu.jpeg │ │ │ └── menu.json │ │ ├── package.json │ │ ├── src │ │ │ ├── 01 │ │ │ │ ├── example.json │ │ │ │ └── prompts.ts │ │ │ ├── 02 │ │ │ │ ├── example.json │ │ │ │ ├── flows.ts │ │ │ │ ├── prompts.ts │ │ │ │ └── tools.ts │ │ │ ├── 04 │ │ │ │ ├── example.indexMenuItems.json │ │ │ │ ├── example.menuQuestion.json │ │ │ │ ├── flows.ts │ │ │ │ └── prompts.ts │ │ │ ├── 05 │ │ │ │ ├── example.visualMenuQuestion.json │ │ │ │ ├── flows.ts │ │ │ │ └── prompts.ts │ │ │ ├── genkit.ts │ │ │ ├── index.ts │ │ │ └── types.ts │ │ └── tsconfig.json │ ├── model-tester │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── multimodal │ │ ├── docs │ │ │ └── BirthdayPets.pdf │ │ ├── package.json │ │ ├── src │ │ │ ├── genkit.ts │ │ │ ├── index.ts │ │ │ ├── pdf.ts │ │ │ ├── prompt.ts │ │ │ └── video.ts │ │ └── tsconfig.json │ ├── next │ │ ├── package.json │ │ ├── pnpm-lock.yaml │ │ ├── src │ │ │ ├── app │ │ │ │ ├── api │ │ │ │ │ └── joke │ │ │ │ │ │ └── route.ts │ │ │ │ ├── globals.css │ │ │ │ ├── layout.tsx │ │ │ │ ├── page.module.css │ │ │ │ └── page.tsx │ │ │ └── genkit │ │ │ │ ├── index.ts │ │ │ │ └── joke.ts │ │ └── tsconfig.json │ ├── ollama │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── prompt-file │ │ ├── package.json │ │ ├── prompts │ │ │ ├── _style.prompt │ │ │ ├── recipe.prompt │ │ │ ├── recipe.robot.prompt │ │ │ └── story.prompt │ │ ├── src │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── rag │ │ ├── .gitignore │ │ ├── docs │ │ │ └── flume-java.pdf │ │ ├── package.json │ │ ├── prompts │ │ │ └── myPrompt.prompt │ │ ├── src │ │ │ ├── genkit.ts │ │ │ ├── index.ts │ │ │ ├── pdf-rag-firebase.ts │ │ │ ├── pdf-rag.ts │ │ │ ├── prompt.ts │ │ │ └── simple-rag.ts │ │ └── tsconfig.json │ ├── tools-config-test1 │ │ ├── genkit-tools.conf.js │ │ └── package.json │ ├── vertexai-modelgarden │ │ ├── package.json │ │ ├── src │ │ │ ├── anthropic.ts │ │ │ └── mistral.ts │ │ └── tsconfig.json │ ├── vertexai-reranker │ │ ├── .env.example │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── config.ts │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── vertexai-vector-search-bigquery │ │ ├── .env.example │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── config.ts │ │ │ └── index.ts │ │ └── tsconfig.json │ ├── vertexai-vector-search-custom │ │ ├── .env.example │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ │ ├── config.ts │ │ │ └── index.ts │ │ └── tsconfig.json │ └── vertexai-vector-search-firestore │ │ ├── .env.example │ │ ├── README.md │ │ ├── package.json │ │ ├── src │ │ ├── config.ts │ │ └── index.ts │ │ └── tsconfig.json ├── tsconfig.dev.json ├── tsconfig.json ├── tsup.common.ts ├── typedoc-ga.mjs └── typedoc.json ├── package.json ├── pnpm-lock.yaml ├── py ├── .gitignore ├── .python-version ├── LICENSE ├── README.md ├── bin │ ├── build_dists │ ├── cleanup │ ├── generate_schema_typing │ ├── publish_pypi.sh │ ├── run_python_tests │ ├── run_python_tests_with_nox │ ├── run_python_tests_with_tox │ ├── sanitize_schema_typing.py │ └── watch_python_tests ├── docs │ ├── assets │ │ ├── favicon.png │ │ └── logo.png │ ├── index.md │ └── types.md ├── engdoc │ ├── ROADMAP.org │ ├── assets │ │ ├── favicon.png │ │ └── logo.png │ ├── contributing │ │ ├── coding_guidelines.md │ │ ├── git_workflow.md │ │ ├── index.md │ │ ├── installation.md │ │ └── troubleshooting.md │ ├── extending │ │ ├── api.md │ │ ├── glossary.md │ │ ├── index.md │ │ ├── servers.md │ │ └── tooling │ │ │ └── index.md │ ├── img │ │ ├── asgi.svg │ │ └── onion.svg │ ├── index.md │ └── user_guide │ │ ├── developer_tools.md │ │ ├── go │ │ └── index.md │ │ ├── introduction.md │ │ ├── python │ │ ├── getting_started.md │ │ ├── index.md │ │ └── publishing_pypi.md │ │ └── typescript │ │ └── index.md ├── mkdocs.yml ├── noxfile.py ├── packages │ └── genkit │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── src │ │ └── genkit │ │ │ ├── ai │ │ │ ├── __init__.py │ │ │ ├── _aio.py │ │ │ ├── _base.py │ │ │ ├── _base_async.py │ │ │ ├── _plugin.py │ │ │ ├── _registry.py │ │ │ ├── _runtime.py │ │ │ └── _server.py │ │ │ ├── aio │ │ │ ├── __init__.py │ │ │ ├── _compat.py │ │ │ ├── _util.py │ │ │ ├── channel.py │ │ │ └── loop.py │ │ │ ├── blocks │ │ │ ├── __init__.py │ │ │ ├── document.py │ │ │ ├── embedding.py │ │ │ ├── evaluator.py │ │ │ ├── formats │ │ │ │ ├── __init__.py │ │ │ │ ├── json.py │ │ │ │ └── types.py │ │ │ ├── generate.py │ │ │ ├── messages.py │ │ │ ├── middleware.py │ │ │ ├── model.py │ │ │ ├── prompt.py │ │ │ ├── retriever.py │ │ │ └── tools.py │ │ │ ├── codec.py │ │ │ ├── core │ │ │ ├── __init__.py │ │ │ ├── action │ │ │ │ ├── __init__.py │ │ │ │ ├── _action.py │ │ │ │ ├── _key.py │ │ │ │ ├── _tracing.py │ │ │ │ ├── _util.py │ │ │ │ └── types.py │ │ │ ├── constants.py │ │ │ ├── context.py │ │ │ ├── environment.py │ │ │ ├── error.py │ │ │ ├── extract.py │ │ │ ├── flows.py │ │ │ ├── reflection.py │ │ │ ├── registry.py │ │ │ ├── schema.py │ │ │ ├── status_types.py │ │ │ ├── trace │ │ │ │ ├── __init__.py │ │ │ │ ├── default_exporter.py │ │ │ │ └── types.py │ │ │ ├── tracing.py │ │ │ └── typing.py │ │ │ ├── lang │ │ │ ├── __init__.py │ │ │ └── deprecations.py │ │ │ ├── plugins │ │ │ └── .gitignore │ │ │ ├── py.typed │ │ │ ├── testing.py │ │ │ ├── types │ │ │ └── __init__.py │ │ │ └── web │ │ │ ├── __init__.py │ │ │ ├── manager │ │ │ ├── __init__.py │ │ │ ├── _adapters.py │ │ │ ├── _base_server.py │ │ │ ├── _info.py │ │ │ ├── _manager.py │ │ │ ├── _ports.py │ │ │ ├── _server.py │ │ │ └── signals.py │ │ │ ├── requests.py │ │ │ └── typing.py │ │ └── tests │ │ └── genkit │ │ ├── ai │ │ └── ai_registry_test.py │ │ ├── aio │ │ └── channel_test.py │ │ ├── blocks │ │ ├── document_test.py │ │ ├── embedding_test.py │ │ ├── formats │ │ │ └── json_test.py │ │ ├── generate_test.py │ │ ├── message_utils_test.py │ │ ├── middleware_test.py │ │ ├── model_test.py │ │ └── prompt_test.py │ │ ├── codec_test.py │ │ ├── core │ │ ├── action_test.py │ │ ├── endpoints │ │ │ └── reflection_test.py │ │ ├── environment_test.py │ │ ├── error_test.py │ │ ├── extract_test.py │ │ ├── registry_test.py │ │ ├── schema_test.py │ │ └── status_types_test.py │ │ ├── lang │ │ └── deprecations_test.py │ │ ├── veneer │ │ ├── server_test.py │ │ └── veneer_test.py │ │ └── web │ │ └── manager │ │ └── signals_test.py ├── plugins │ ├── compat-oai │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── src │ │ │ └── genkit │ │ │ │ ├── plugins │ │ │ │ └── compat_oai │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── models │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── handler.py │ │ │ │ │ ├── model.py │ │ │ │ │ ├── model_info.py │ │ │ │ │ └── utils.py │ │ │ │ │ ├── openai_plugin.py │ │ │ │ │ └── typing.py │ │ │ │ └── py.typed │ │ └── tests │ │ │ ├── conftest.py │ │ │ ├── test_handler.py │ │ │ ├── test_model.py │ │ │ ├── test_plugin.py │ │ │ └── test_tool_calling.py │ ├── dev-local-vectorstore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── src │ │ │ └── genkit │ │ │ │ └── plugins │ │ │ │ └── dev_local_vectorstore │ │ │ │ ├── __init__.py │ │ │ │ ├── constant.py │ │ │ │ ├── indexer.py │ │ │ │ ├── local_vector_store_api.py │ │ │ │ ├── plugin_api.py │ │ │ │ └── retriever.py │ │ └── tests │ │ │ └── .gitkeep │ ├── evaluators │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── genkit │ │ │ ├── plugins │ │ │ └── evaluators │ │ │ │ ├── __init__.py │ │ │ │ ├── constant.py │ │ │ │ └── plugin_api.py │ │ │ └── py.typed │ ├── firebase │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── genkit │ │ │ ├── plugins │ │ │ └── firebase │ │ │ │ ├── __init__.py │ │ │ │ ├── constant.py │ │ │ │ ├── firestore.py │ │ │ │ └── retriever.py │ │ │ └── py.typed │ ├── flask │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── src │ │ │ └── genkit │ │ │ │ ├── plugins │ │ │ │ └── flask │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── handler.py │ │ │ │ └── py.typed │ │ └── tests │ │ │ └── flask_test.py │ ├── google-cloud │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── genkit │ │ │ ├── plugins │ │ │ └── google_cloud │ │ │ │ ├── __init__.py │ │ │ │ └── telemetry │ │ │ │ └── tracing.py │ │ │ └── py.typed │ ├── google-genai │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── src │ │ │ └── genkit │ │ │ │ ├── plugins │ │ │ │ └── google_genai │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── constants.py │ │ │ │ │ ├── google.py │ │ │ │ │ └── models │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── context_caching │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── constants.py │ │ │ │ │ ├── types.py │ │ │ │ │ └── utils.py │ │ │ │ │ ├── embedder.py │ │ │ │ │ ├── gemini.py │ │ │ │ │ ├── imagen.py │ │ │ │ │ └── utils.py │ │ │ │ └── py.typed │ │ └── test │ │ │ ├── models │ │ │ ├── test_googlegenai_embedder.py │ │ │ ├── test_googlegenai_gemini.py │ │ │ └── test_googlegenai_imagen.py │ │ │ └── test_google_plugin.py │ ├── ollama │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── src │ │ │ └── genkit │ │ │ │ ├── plugins │ │ │ │ └── ollama │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── constants.py │ │ │ │ │ ├── embedders.py │ │ │ │ │ ├── models.py │ │ │ │ │ └── plugin_api.py │ │ │ │ └── py.typed │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── conftest.py │ │ │ ├── models │ │ │ ├── test_embedders.py │ │ │ └── test_models.py │ │ │ ├── test_integration.py │ │ │ └── test_plugin_api.py │ └── vertex-ai │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ ├── src │ │ ├── __init__.py │ │ └── genkit │ │ │ ├── plugins │ │ │ └── vertex_ai │ │ │ │ ├── __init__.py │ │ │ │ ├── constants.py │ │ │ │ ├── model_garden │ │ │ │ ├── __init__.py │ │ │ │ ├── client.py │ │ │ │ ├── model_garden.py │ │ │ │ └── modelgarden_plugin.py │ │ │ │ └── vector_search │ │ │ │ ├── __init__.py │ │ │ │ ├── retriever.py │ │ │ │ └── vector_search.py │ │ │ └── py.typed │ │ └── tests │ │ └── vector_search │ │ ├── test_retrievers.py │ │ └── test_vector_search_plugin.py ├── pyproject.toml ├── samples │ ├── .gitignore │ ├── compat-oai-hello │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── compat_oai_hello.py │ ├── dev-local-vectorstore-hello │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── hello.py │ ├── firestore-retreiver │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── main.py │ ├── flask-hello │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── flask_hello.py │ ├── google-genai-code-execution │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── google-genai-code-execution.py │ ├── google-genai-context-caching │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── context_caching.py │ ├── google-genai-hello │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── google_genai_hello.py │ ├── google-genai-image │ │ ├── LICENSE │ │ ├── README.md │ │ ├── image.jpg │ │ ├── pyproject.toml │ │ └── src │ │ │ └── google_genai_image.py │ ├── google-genai-vertexai-hello │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── google_genai_vertexai_hello.py │ ├── google-genai-vertexai-image │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── google_genai_vertexai_image.py │ ├── menu │ │ ├── LICENSE │ │ ├── README.md │ │ ├── data │ │ │ ├── menu.jpeg │ │ │ └── menu.json │ │ ├── pyproject.toml │ │ └── src │ │ │ ├── __init__.py │ │ │ ├── case_01 │ │ │ ├── __init__.py │ │ │ ├── example.json │ │ │ └── prompts.py │ │ │ ├── case_02 │ │ │ ├── __init__.py │ │ │ ├── example.json │ │ │ ├── flows.py │ │ │ ├── prompts.py │ │ │ └── tools.py │ │ │ ├── case_03 │ │ │ ├── __init__.py │ │ │ ├── chats.py │ │ │ ├── example.json │ │ │ ├── flows.py │ │ │ └── prompts.py │ │ │ ├── case_04 │ │ │ ├── __init__.py │ │ │ ├── example.indexMenuItems.json │ │ │ ├── example.menuQuestion.json │ │ │ ├── flows.py │ │ │ └── prompts.py │ │ │ ├── case_05 │ │ │ ├── __init__.py │ │ │ ├── example.visualMenuQuestion.json │ │ │ ├── flows.py │ │ │ └── prompts.py │ │ │ ├── menu_ai.py │ │ │ ├── menu_example.py │ │ │ └── menu_schemas.py │ ├── model-garden │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── main.py │ ├── multi-server │ │ ├── README.md │ │ ├── architecture.svg │ │ ├── multi_server.py │ │ └── pyproject.toml │ ├── ollama-hello │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── ollama_hello.py │ ├── ollama-simple-embed │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── pokemon_glossary.py │ ├── short-n-long │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── short_n_long │ │ │ ├── __init__.py │ │ │ └── main.py │ ├── tool-interrupts │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ └── tool_interrupts.py │ ├── vertex-ai-vector-search-bigquery │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ │ ├── sample.py │ │ │ └── setup_env.py │ └── vertex-ai-vector-search-firestore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── pyproject.toml │ │ └── src │ │ └── sample.py ├── tests │ └── smoke │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package_test.py │ │ └── pyproject.toml ├── tox.ini └── uv.lock ├── samples ├── README.md ├── idx-template.json ├── idx-template.nix ├── js-angular │ ├── .gitignore │ ├── README.md │ ├── genkit-app │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── README.md │ │ ├── angular.json │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── app │ │ │ │ ├── app.component.html │ │ │ │ ├── app.component.scss │ │ │ │ ├── app.component.spec.ts │ │ │ │ ├── app.component.ts │ │ │ │ ├── app.config.ts │ │ │ │ ├── app.routes.ts │ │ │ │ ├── home │ │ │ │ │ ├── home.component.html │ │ │ │ │ ├── home.component.scss │ │ │ │ │ ├── home.component.spec.ts │ │ │ │ │ └── home.component.ts │ │ │ │ └── samples │ │ │ │ │ ├── chatbot │ │ │ │ │ ├── chatbot.component.html │ │ │ │ │ ├── chatbot.component.scss │ │ │ │ │ ├── chatbot.component.spec.ts │ │ │ │ │ └── chatbot.component.ts │ │ │ │ │ └── streaming-json │ │ │ │ │ ├── streaming-json.component.html │ │ │ │ │ ├── streaming-json.component.scss │ │ │ │ │ ├── streaming-json.component.spec.ts │ │ │ │ │ └── streaming-json.component.ts │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ └── styles.scss │ │ ├── tsconfig.app.json │ │ ├── tsconfig.json │ │ └── tsconfig.spec.json │ ├── package-lock.json │ ├── package.json │ └── server │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ ├── agent.ts │ │ ├── chatbot.ts │ │ ├── genkit.ts │ │ ├── index.ts │ │ └── jsonStreaming.ts │ │ └── tsconfig.json ├── js-character-generator │ ├── .gitignore │ ├── .idx │ │ └── dev.nix │ ├── README.md │ ├── README_IDX.md │ ├── idx-template.json │ ├── idx-template.nix │ ├── index.ts │ ├── package-lock.json │ ├── package.json │ └── tsconfig.json ├── js-chatbot │ ├── .gitignore │ ├── .idx │ │ └── dev.nix │ ├── README.md │ ├── eval.json │ ├── genkit-app │ │ ├── .editorconfig │ │ ├── .gitignore │ │ ├── README.md │ │ ├── angular.json │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── proxy.conf.json │ │ ├── public │ │ │ └── favicon.ico │ │ ├── src │ │ │ ├── app │ │ │ │ ├── app.component.html │ │ │ │ ├── app.component.scss │ │ │ │ ├── app.component.spec.ts │ │ │ │ ├── app.component.ts │ │ │ │ ├── app.config.ts │ │ │ │ ├── app.routes.ts │ │ │ │ └── samples │ │ │ │ │ └── chatbot │ │ │ │ │ ├── chatbot.component.html │ │ │ │ │ ├── chatbot.component.scss │ │ │ │ │ ├── chatbot.component.spec.ts │ │ │ │ │ └── chatbot.component.ts │ │ │ ├── index.html │ │ │ ├── main.ts │ │ │ └── styles.scss │ │ ├── tsconfig.app.json │ │ ├── tsconfig.json │ │ └── tsconfig.spec.json │ ├── package-lock.json │ ├── package.json │ └── server │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── src │ │ ├── index.ts │ │ └── memory.ts │ │ └── tsconfig.json ├── js-coffee-shop │ ├── .idx │ │ └── dev.nix │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── input.json │ └── tsconfig.json ├── js-menu │ ├── .gitignore │ ├── .idx │ │ └── dev.nix │ ├── README.md │ ├── data │ │ ├── menu.jpeg │ │ └── menu.json │ ├── package-lock.json │ ├── package.json │ ├── src │ │ ├── 01 │ │ │ ├── example.json │ │ │ └── prompts.ts │ │ ├── 02 │ │ │ ├── example.json │ │ │ ├── flows.ts │ │ │ ├── prompts.ts │ │ │ └── tools.ts │ │ ├── 03 │ │ │ ├── chats.ts │ │ │ ├── example.json │ │ │ ├── flows.ts │ │ │ └── prompts.ts │ │ ├── 04 │ │ │ ├── example.indexMenuItems.json │ │ │ ├── example.menuQuestion.json │ │ │ ├── flows.ts │ │ │ └── prompts.ts │ │ ├── 05 │ │ │ ├── example.visualMenuQuestion.json │ │ │ ├── flows.ts │ │ │ └── prompts.ts │ │ ├── genkit.ts │ │ ├── index.ts │ │ └── types.ts │ └── tsconfig.json ├── js-prompts │ ├── .idx │ │ └── dev.nix │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── js-schoolAgent │ ├── .idx │ │ └── dev.nix │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── prompts │ │ └── myPrompt.prompt │ ├── src │ │ ├── attendanceAgent.ts │ │ ├── data.ts │ │ ├── genkit.ts │ │ ├── gradesAgent.ts │ │ ├── routingAgent.ts │ │ ├── terminal.ts │ │ ├── tools.ts │ │ ├── types.ts │ │ └── util.ts │ └── tsconfig.json └── package.json ├── scripts ├── copyright.ts ├── release_main.sh └── release_next.sh ├── taplo.toml └── tests ├── README.md ├── flow_server_tests.yaml ├── package.json ├── pnpm-lock.yaml ├── specs ├── generate.yaml └── reflection_api.yaml ├── src ├── dev_ui_test.ts ├── flow_server_test.ts ├── reflection_api_test.ts └── utils.ts ├── test_js_app ├── package.json ├── src │ └── index.ts └── tsconfig.json └── tsconfig.json /.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 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | py/ @pavelgj 2 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | ** Node version 27 | - run `python3 --version` at paste here 28 | 29 | **Additional context** 30 | Add any other context about the problem here. 31 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /docs/resources/genkit-logo-dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/docs/resources/genkit-logo-dark.png -------------------------------------------------------------------------------- /docs/resources/genkit-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/docs/resources/genkit-logo.png -------------------------------------------------------------------------------- /docs/resources/readme-ui-traces-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/docs/resources/readme-ui-traces-screenshot.png -------------------------------------------------------------------------------- /genkit-tools/cli/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | plugins/ 3 | common/ 4 | ui/ 5 | jest.config.ts 6 | tsconfig.json -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /genkit-tools/cli/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.base.json", 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "outDir": "dist" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /genkit-tools/common/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jest.config.ts 3 | tsconfig.cjs.json 4 | tsconfig.esm.json 5 | tsconfig.json -------------------------------------------------------------------------------- /genkit-tools/common/src/manager/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 { RuntimeManager } from './manager'; 18 | export * from './types'; 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /genkit-tools/common/src/utils/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 './analytics'; 18 | export * from './configstore'; 19 | export * from './eval'; 20 | export * from './logger'; 21 | export * from './package'; 22 | export * from './prompt'; 23 | export * from './trace'; 24 | export * from './utils'; 25 | -------------------------------------------------------------------------------- /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 { readFileSync } from 'fs'; 18 | import { join } from 'path'; 19 | 20 | const packagePath = join(__dirname, '../../../package.json'); 21 | export const toolsPackage = JSON.parse(readFileSync(packagePath, 'utf8')); 22 | -------------------------------------------------------------------------------- /genkit-tools/common/tsconfig.cjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib/cjs", 5 | "module": "commonjs" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /genkit-tools/common/tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib/esm", 5 | "module": "esnext" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /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 | }, 11 | "include": ["src"] 12 | } 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /genkit-tools/telemetry-server/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.cjs.json 3 | tsconfig.esm.json 4 | tsconfig.json -------------------------------------------------------------------------------- /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 [Genkit documentation](https://genkit.dev/docs/get-started). 6 | 7 | License: Apache 2.0 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 | -------------------------------------------------------------------------------- /genkit-tools/telemetry-server/tsconfig.esm.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./lib/esm", 5 | "module": "esnext" 6 | } 7 | } 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /go/internal/cmd/copy/testdata/multiple.txt: -------------------------------------------------------------------------------- 1 | In this test, there are more than one sink with the same name in the 2 | destination, and more than one source with that name in the source file. 3 | -- source -- 4 | //copy:start dest one 5 | a 6 | b 7 | c 8 | //copy:stop 9 | d 10 | //copy:start dest two 11 | e 12 | //copy:stop 13 | //copy:start dest one 14 | f 15 | g 16 | //copy:stop 17 | h 18 | -- dest -- 19 | //copy:sink one 20 | //copy:sink two 21 | //copy:sink one 22 | -- want -- 23 | //copy:sink one from source 24 | // DO NOT MODIFY below vvvv 25 | a 26 | b 27 | c 28 | f 29 | g 30 | // DO NOT MODIFY above ^^^^ 31 | //copy:endsink one 32 | //copy:sink two from source 33 | // DO NOT MODIFY below vvvv 34 | e 35 | // DO NOT MODIFY above ^^^^ 36 | //copy:endsink two 37 | //copy:sink one from source 38 | // DO NOT MODIFY below vvvv 39 | a 40 | b 41 | c 42 | f 43 | g 44 | // DO NOT MODIFY above ^^^^ 45 | //copy:endsink one 46 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /go/internal/doc-snippets/doc.go: -------------------------------------------------------------------------------- 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 | // Package snippets contains snippets that are incorporated into 18 | // documentation (see https://genkit.dev/go/docs/get-started-go). 19 | package snippets 20 | -------------------------------------------------------------------------------- /go/samples/menu/testdata/menu.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/go/samples/menu/testdata/menu.jpeg -------------------------------------------------------------------------------- /go/samples/prompts-dir/prompts/example.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.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 | -------------------------------------------------------------------------------- /go/samples/prompts/prompts/countries.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-2.0-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 | -------------------------------------------------------------------------------- /go/samples/prompts/prompts/media.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-2.5-flash-preview-04-17 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 | -------------------------------------------------------------------------------- /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/ai/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /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 [Genkit documentation](https://genkit.dev/docs/get-started). 6 | 7 | License: Apache 2.0 8 | -------------------------------------------------------------------------------- /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/ai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /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/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/core/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /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 [Genkit documentation](https://genkit.dev/docs/get-started). 6 | 7 | License: Apache 2.0 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex01.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.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/doc-snippets/src/dotprompt/prompts/ex02.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-1.5-flash 3 | --- 4 | You are the world's most welcoming AI assistant. Greet the user and offer your assistance. -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex03.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.5-flash 3 | config: 4 | temperature: 1.4 5 | topK: 50 6 | topP: 0.4 7 | maxOutputTokens: 400 8 | stopSequences: 9 | - "" 10 | - "" 11 | --- -------------------------------------------------------------------------------- /js/doc-snippets/src/dotprompt/prompts/ex04.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.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/doc-snippets/src/dotprompt/prompts/ex05.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.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/ex06.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-1.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/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/doc-snippets/src/dotprompt/prompts/ex08.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-1.5-flash 3 | input: 4 | schema: 5 | photoUrl: string 6 | --- 7 | Describe this image in a detailed paragraph: 8 | 9 | {{media url=photoUrl}} -------------------------------------------------------------------------------- /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/genkit/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/genkit/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 * from './common.js'; 18 | export { GenkitBeta, genkit, type GenkitBetaOptions } from './genkit-beta.js'; 19 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/middleware.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 | augmentWithContext, 19 | downloadRequestMedia, 20 | simulateSystemPrompt, 21 | validateSupport, 22 | type AugmentWithContextOptions, 23 | } from '@genkit-ai/ai/model/middleware'; 24 | -------------------------------------------------------------------------------- /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/genkit/src/schema.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 | ValidationError, 19 | parseSchema, 20 | toJsonSchema, 21 | validateSchema, 22 | type JSONSchema, 23 | type ProvidedSchema, 24 | type ValidationErrorDetail, 25 | type ValidationResponse, 26 | } from '@genkit-ai/core/schema'; 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | toToolDefinition, 21 | type ToolAction, 22 | type ToolArgument, 23 | type ToolConfig, 24 | } from '@genkit-ai/ai/tool'; 25 | -------------------------------------------------------------------------------- /js/genkit/tests/prompts/badSchemaRef.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.5-flash 3 | input: 4 | schema: badSchemaRef1 5 | output: 6 | schema: badSchemaRef2 7 | --- 8 | 9 | doesn't matter -------------------------------------------------------------------------------- /js/genkit/tests/prompts/chat_preamble.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | config: 3 | version: 'abc' 4 | --- 5 | hi {{ name }} from template 6 | -------------------------------------------------------------------------------- /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/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-1.5-flash 3 | input: 4 | schema: myInputSchema 5 | output: 6 | schema: myOutputSchema 7 | --- 8 | 9 | Write a poem about {{foo}}. -------------------------------------------------------------------------------- /js/genkit/tests/prompts/sub/test.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | config: 3 | temperature: 12 4 | --- 5 | Hello from the sub folder prompt file -------------------------------------------------------------------------------- /js/genkit/tests/prompts/test.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | config: 3 | temperature: 11 4 | --- 5 | Hello from the prompt file -------------------------------------------------------------------------------- /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/genkit/tests/prompts/toolPrompt.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | description: prompt in a file 3 | tools: 4 | - agentA 5 | --- 6 | {{ role "system" }} {{ @state.name }} toolPrompt prompt -------------------------------------------------------------------------------- /js/genkit/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "include": ["src"], 4 | "compilerOptions": { 5 | "lib": ["es2022", "DOM"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /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/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/plugins/checks/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/checks/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /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/checks/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/chroma/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /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 [Genkit documentation](https://genkit.dev/docs/get-started). 6 | 7 | License: Apache 2.0 8 | -------------------------------------------------------------------------------- /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/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/chroma/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /js/plugins/compat-oai/jest.config.js: -------------------------------------------------------------------------------- 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 | /** @type {import('ts-jest').JestConfigWithTsJest} */ 18 | module.exports = { 19 | preset: 'ts-jest', 20 | testEnvironment: 'node', 21 | testPathIgnorePatterns: ['/node_modules/', '/lib/'], 22 | }; 23 | -------------------------------------------------------------------------------- /js/plugins/compat-oai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /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/compat-oai/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/dev-local-vectorstore/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/dev-local-vectorstore/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /js/plugins/dev-local-vectorstore/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/evaluators/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /js/plugins/evaluators/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /js/plugins/evaluators/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /js/plugins/evaluators/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 | shims: false, 23 | }); 24 | -------------------------------------------------------------------------------- /js/plugins/evaluators/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/express/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/express/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /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/express/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/firebase/README.md: -------------------------------------------------------------------------------- 1 | # Firebase plugin for Genkit 2 | 3 | ## Installing the plugin 4 | 5 | ```bash 6 | npm i --save @genkit-ai/firebase 7 | ``` 8 | 9 | ## Using the plugin 10 | 11 | ```ts 12 | import { genkit } from 'genkit'; 13 | import { enableFirebaseTelemetry } from '@genkit-ai/firebase'; 14 | 15 | enableFirebaseTelemetry(); 16 | 17 | const ai = genkit({ 18 | plugins: [ 19 | // ... 20 | ], 21 | }); 22 | ``` 23 | 24 | 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. 25 | 26 | Usage information and reference details can be found in [Genkit documentation](https://genkit.dev/docs/get-started). 27 | 28 | License: Apache 2.0 29 | -------------------------------------------------------------------------------- /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/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/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/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/google-cloud/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jest.config.ts 3 | tsconfig.json 4 | tsup.config.ts -------------------------------------------------------------------------------- /js/plugins/google-cloud/README.md: -------------------------------------------------------------------------------- 1 | # Google Cloud plugin for Genkit 2 | 3 | The Google Cloud plugin is a utility plugin to export telemetry and logs to Cloud Observability. This functionality is exposed through the Firebase plugin for customer use. 4 | 5 | Visit the [Getting started](https://genkit.dev/docs/observability/getting-started) docs to set up Genkit Monitoring. 6 | 7 | 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. 8 | 9 | Usage information and reference details can be found in [Genkit documentation](https://genkit.dev/docs/get-started). 10 | 11 | License: Apache 2.0 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/google-cloud/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/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-1.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/plugins/googleai/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /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/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/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 [Genkit documentation](https://genkit.dev/docs/get-started). 6 | 7 | License: Apache 2.0 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /js/plugins/langchain/typedoc.json: -------------------------------------------------------------------------------- 1 | { 2 | "entryPoints": ["src/index.ts"] 3 | } 4 | -------------------------------------------------------------------------------- /js/plugins/mcp/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | tsconfig.json 3 | tsup.config.ts -------------------------------------------------------------------------------- /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 | "genkitx-mcp": "file:../../" 20 | }, 21 | "devDependencies": { 22 | "@modelcontextprotocol/server-puppeteer": "^0.5.1", 23 | "tsx": "^4.19.2" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /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 | "genkitx-mcp": "file:../.." 16 | }, 17 | "type": "module" 18 | } 19 | -------------------------------------------------------------------------------- /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/plugins/mcp/tests/mcp_test.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 | // no tests... :( 18 | -------------------------------------------------------------------------------- /js/plugins/mcp/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /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/next/.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | jest.config.ts 3 | tsconfig.json 4 | tsup.config.ts -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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/ollama/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "include": ["src"] 4 | } 5 | -------------------------------------------------------------------------------- /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/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/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/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/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/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, gemini, gemini15Flash } from '@genkit-ai/vertexai'; 14 | 15 | const ai = genkit({ 16 | plugins: [vertexAI()], 17 | model: gemini15Flash, 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/get-started). 29 | 30 | License: Apache 2.0 31 | -------------------------------------------------------------------------------- /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/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/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/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 | -------------------------------------------------------------------------------- /js/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 | - 'plugins/*' 18 | - 'testapps/*' 19 | - '!testapps/bleigh-scratch' 20 | - '!testapps/firebase-functions-sample1' 21 | - '!testapps/firebase-functions-sample1/functions' 22 | - 'third_party/*' 23 | - '!./scripts' 24 | -------------------------------------------------------------------------------- /js/testapps/basic-gemini/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 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "dependencies": { 16 | "genkit": "workspace:*", 17 | "@genkit-ai/firebase": "workspace:*", 18 | "@genkit-ai/google-cloud": "workspace:*", 19 | "@genkit-ai/googleai": "workspace:*", 20 | "@genkit-ai/vertexai": "workspace:*", 21 | "express": "^4.20.0" 22 | }, 23 | "devDependencies": { 24 | "typescript": "^5.6.2" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /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/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/compat-oai/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "compat-oai-example", 3 | "version": "0.22.0", 4 | "description": "", 5 | "main": "lib/index.js", 6 | "private": true, 7 | "scripts": { 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 | "genkit:start": "cross-env GENKIT_ENV=dev genkit start -- tsx --watch src/index.ts", 13 | "dev": "export GENKIT_RUNTIME_ID=$(openssl rand -hex 8) && node lib/index.js 2>&1" 14 | }, 15 | "keywords": [], 16 | "author": "", 17 | "license": "ISC", 18 | "dependencies": { 19 | "@genkit-ai/express": "^1.1.0", 20 | "genkit": "workspace:*", 21 | "@genkit-ai/compat-oai": "workspace:*", 22 | "tsx": "^4.19.3" 23 | }, 24 | "devDependencies": { 25 | "cross-env": "^7.0.3", 26 | "dotenv": "^16.4.5", 27 | "typescript": "^5.6.2" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /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/context-caching/.gitignore: -------------------------------------------------------------------------------- 1 | data -------------------------------------------------------------------------------- /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/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/.gitignore: -------------------------------------------------------------------------------- 1 | data -------------------------------------------------------------------------------- /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/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/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/googleai": "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/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 | -------------------------------------------------------------------------------- /js/testapps/dev-ui-gallery/prompts/hello.first-last-name.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.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/testapps/dev-ui-gallery/prompts/hello.json-output.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.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/testapps/dev-ui-gallery/prompts/hello.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.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/dev-ui-gallery/prompts/hello.system.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.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 | -------------------------------------------------------------------------------- /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/testapps/dev-ui-gallery/prompts/tools/weather.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.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 | -------------------------------------------------------------------------------- /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/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-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 | -------------------------------------------------------------------------------- /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/googleai": "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/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/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/docs-menu-rag/docs/GenkitGrubPub.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/js/testapps/docs-menu-rag/docs/GenkitGrubPub.pdf -------------------------------------------------------------------------------- /js/testapps/docs-menu-rag/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "scripts": { 4 | "start": "node lib/index.js", 5 | "compile": "tsc", 6 | "build": "pnpm build:clean && pnpm compile", 7 | "build:clean": "rimraf ./lib", 8 | "build:watch": "tsc --watch", 9 | "build-and-run": "pnpm build && node lib/index.js" 10 | }, 11 | "name": "rag", 12 | "version": "1.0.0", 13 | "description": "", 14 | "keywords": [], 15 | "author": "", 16 | "license": "ISC", 17 | "dependencies": { 18 | "genkit": "workspace:*", 19 | "@genkit-ai/dev-local-vectorstore": "workspace:*", 20 | "@genkit-ai/firebase": "workspace:*", 21 | "@genkit-ai/vertexai": "workspace:*", 22 | "llm-chunk": "^0.0.1", 23 | "pdf-parse": "^1.1.1" 24 | }, 25 | "devDependencies": { 26 | "rimraf": "^6.0.1", 27 | "@types/pdf-parse": "^1.1.4", 28 | "typescript": "^5.3.3" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /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/esm/.gitignore: -------------------------------------------------------------------------------- 1 | .genkit -------------------------------------------------------------------------------- /js/testapps/esm/docs/flume-java.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/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/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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /js/testapps/evals/docs/cat-handbook.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/js/testapps/evals/docs/cat-handbook.pdf -------------------------------------------------------------------------------- /js/testapps/evals/docs/cat-wiki.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/js/testapps/evals/docs/cat-wiki.pdf -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/express/prompts/TellJoke.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | modelProvider: google-vertex 3 | modelName: gemini-pro 4 | --- 5 | Tell a joke about {subject} -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/firebase-functions-sample1/functions/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "functions", 3 | "scripts": { 4 | "build": "tsc", 5 | "build:watch": "tsc --watch", 6 | "serve": "npm run build && firebase emulators:start --only functions", 7 | "shell": "npm run build && firebase functions:shell", 8 | "start": "npm run shell", 9 | "deploy": "firebase deploy --only functions", 10 | "logs": "firebase functions:log" 11 | }, 12 | "engines": { 13 | "node": "18" 14 | }, 15 | "main": "lib/index.js", 16 | "dependencies": { 17 | "genkit": "^1.0.0-rc.14", 18 | "@genkit-ai/firebase": "^1.0.0-rc.14", 19 | "@genkit-ai/vertexai": "^1.0.0-rc.14", 20 | "firebase-admin": "^12.2", 21 | "firebase-functions": "^6.3.1" 22 | }, 23 | "devDependencies": { 24 | "firebase-functions-test": "^3.1.0", 25 | "typescript": "^4.9.0" 26 | }, 27 | "private": true 28 | } 29 | -------------------------------------------------------------------------------- /js/testapps/firebase-functions-sample1/functions/prompts/TellJoke.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | modelProvider: google-vertex 3 | modelName: gemini-pro 4 | --- 5 | Tell a joke about {subject} -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/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/prompts/TellJoke.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: googleai/gemini-1.5-flash 3 | input: 4 | schema: 5 | subject: string 6 | --- 7 | Tell a joke about {subject} -------------------------------------------------------------------------------- /js/testapps/flow-simple-ai/prompts/dotpromptContext.prompt: -------------------------------------------------------------------------------- 1 | --- 2 | model: vertexai/gemini-2.0-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/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/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/googleai": "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 | -------------------------------------------------------------------------------- /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/google-ai-code-execution/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "google-ai-code-execution", 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 | }, 12 | "keywords": [], 13 | "author": "", 14 | "license": "ISC", 15 | "dependencies": { 16 | "genkit": "workspace:*", 17 | "@genkit-ai/google-cloud": "workspace:*", 18 | "@genkit-ai/googleai": "workspace:*", 19 | "dotenv": "^16.4.5", 20 | "express": "^4.21.0" 21 | }, 22 | "devDependencies": { 23 | "typescript": "^5.5.3" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /js/testapps/google-ai-code-execution/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/langchain/genkit-getting-started.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/js/testapps/langchain/genkit-getting-started.pdf -------------------------------------------------------------------------------- /js/testapps/langchain/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/menu/data/menu.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/js/testapps/menu/data/menu.jpeg -------------------------------------------------------------------------------- /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/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/04/example.menuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like something cheesy!" 3 | } 4 | -------------------------------------------------------------------------------- /js/testapps/menu/src/05/example.visualMenuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "What kind of burger buns do you have?" 3 | } 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /js/testapps/model-tester/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "model-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": "workspace:*", 19 | "@genkit-ai/googleai": "workspace:*", 20 | "@genkit-ai/vertexai": "workspace:*", 21 | "@google/generative-ai": "^0.15.0", 22 | "colorette": "^2.0.20", 23 | "genkitx-ollama": "workspace:*", 24 | "genkitx-openai": "^0.10.1" 25 | }, 26 | "devDependencies": { 27 | "rimraf": "^6.0.1", 28 | "typescript": "^5.3.3" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /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/multimodal/docs/BirthdayPets.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/js/testapps/multimodal/docs/BirthdayPets.pdf -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /js/testapps/next/src/genkit/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 { gemini15Flash, googleAI } from '@genkit-ai/googleai'; 18 | import { genkit } from 'genkit'; 19 | 20 | export const ai = genkit({ 21 | plugins: [googleAI()], 22 | model: gemini15Flash, 23 | }); 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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"}} -------------------------------------------------------------------------------- /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/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/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 | -------------------------------------------------------------------------------- /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/testapps/rag/.gitignore: -------------------------------------------------------------------------------- 1 | .genkit -------------------------------------------------------------------------------- /js/testapps/rag/docs/flume-java.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/js/testapps/rag/docs/flume-java.pdf -------------------------------------------------------------------------------- /js/testapps/rag/prompts/myPrompt.prompt: -------------------------------------------------------------------------------- 1 | {{ role "system" }} your name is {{ @state.userName }}, always introduce yourself) -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /js/testapps/tools-config-test1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tools-config-test1", 3 | "version": "1.0.0", 4 | "description": "", 5 | "scripts": { 6 | "build": "echo 'noop'" 7 | }, 8 | "keywords": [], 9 | "author": "", 10 | "license": "ISC", 11 | "devDependencies": { 12 | "typescript": "^5.3.3" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /js/testapps/vertexai-modelgarden/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "main": "lib/index.js", 3 | "scripts": { 4 | "start:anthropic": "node lib/anthropic.js", 5 | "start:mistral": "node lib/mistral.js", 6 | "build": "tsc", 7 | "build:watch": "tsc --watch", 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "name": "anthropic-models", 11 | "version": "1.0.0", 12 | "description": "", 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "dependencies": { 17 | "@genkit-ai/firebase": "workspace:*", 18 | "@genkit-ai/vertexai": "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/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 | -------------------------------------------------------------------------------- /js/testapps/vertexai-reranker/.env.example: -------------------------------------------------------------------------------- 1 | # .env.example 2 | 3 | PROJECT_ID=your_project_id_here 4 | LOCATION=your_location_here 5 | -------------------------------------------------------------------------------- /js/testapps/vertexai-reranker/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vertexai-reranker", 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 | }, 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "dependencies": { 17 | "genkit": "workspace:*", 18 | "@genkit-ai/dev-local-vectorstore": "workspace:*", 19 | "@genkit-ai/evaluator": "workspace:*", 20 | "@genkit-ai/firebase": "workspace:*", 21 | "@genkit-ai/vertexai": "workspace:*", 22 | "dotenv": "^16.4.5", 23 | "express": "^4.21.0", 24 | "google-auth-library": "^9.11.0" 25 | }, 26 | "devDependencies": { 27 | "rimraf": "^6.0.1", 28 | "typescript": "^5.5.2" 29 | } 30 | } 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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-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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /js/tsconfig.dev.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [".eslintrc.js"] 3 | } 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/.python-version: -------------------------------------------------------------------------------- 1 | 3.12 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/docs/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/docs/assets/favicon.png -------------------------------------------------------------------------------- /py/docs/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/docs/assets/logo.png -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/engdoc/assets/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/engdoc/assets/favicon.png -------------------------------------------------------------------------------- /py/engdoc/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/engdoc/assets/logo.png -------------------------------------------------------------------------------- /py/engdoc/contributing/git_workflow.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/engdoc/contributing/git_workflow.md -------------------------------------------------------------------------------- /py/engdoc/contributing/installation.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/engdoc/contributing/installation.md -------------------------------------------------------------------------------- /py/engdoc/contributing/troubleshooting.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/engdoc/contributing/troubleshooting.md -------------------------------------------------------------------------------- /py/engdoc/extending/tooling/index.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | -------------------------------------------------------------------------------- /py/engdoc/user_guide/developer_tools.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/engdoc/user_guide/developer_tools.md -------------------------------------------------------------------------------- /py/engdoc/user_guide/go/index.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | -------------------------------------------------------------------------------- /py/engdoc/user_guide/introduction.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/engdoc/user_guide/introduction.md -------------------------------------------------------------------------------- /py/engdoc/user_guide/python/getting_started.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ::: genkit.core.action.types.ActionKind 4 | -------------------------------------------------------------------------------- /py/engdoc/user_guide/typescript/index.md: -------------------------------------------------------------------------------- 1 | # Overview 2 | -------------------------------------------------------------------------------- /py/packages/genkit/src/genkit/aio/__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 | """Asynchronous utilities.""" 18 | 19 | from ._util import ensure_async 20 | from .channel import Channel 21 | 22 | __all__ = [ 23 | Channel.__name__, 24 | ensure_async.__name__, 25 | ] 26 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/packages/genkit/src/genkit/plugins/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/packages/genkit/src/genkit/plugins/.gitignore -------------------------------------------------------------------------------- /py/packages/genkit/src/genkit/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/packages/genkit/src/genkit/py.typed -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/plugins/compat-oai/src/genkit/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/plugins/compat-oai/src/genkit/py.typed -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /py/plugins/dev-local-vectorstore/tests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/plugins/dev-local-vectorstore/tests/.gitkeep -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/plugins/evaluators/src/genkit/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/plugins/evaluators/src/genkit/py.typed -------------------------------------------------------------------------------- /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/plugins/firebase/src/genkit/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/plugins/firebase/src/genkit/py.typed -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/plugins/flask/src/genkit/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/plugins/flask/src/genkit/py.typed -------------------------------------------------------------------------------- /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-cloud/src/genkit/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/plugins/google-cloud/src/genkit/py.typed -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/plugins/google-genai/src/genkit/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/plugins/google-genai/src/genkit/py.typed -------------------------------------------------------------------------------- /py/plugins/ollama/src/genkit/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/plugins/ollama/src/genkit/py.typed -------------------------------------------------------------------------------- /py/plugins/ollama/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/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/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/vertex-ai/src/genkit/plugins/vertex_ai/model_garden/__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 .model_garden import model_garden_name 18 | from .modelgarden_plugin import VertexAIModelGarden 19 | 20 | __all__ = [model_garden_name, VertexAIModelGarden] 21 | -------------------------------------------------------------------------------- /py/plugins/vertex-ai/src/genkit/py.typed: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/plugins/vertex-ai/src/genkit/py.typed -------------------------------------------------------------------------------- /py/samples/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/samples/.gitignore -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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= \ 15 | --query-scope=COLLECTION \ 16 | --field-config=vector-config='{"dimension":"3","flat": "{}"}',field-path= 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 | ``` -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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-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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/samples/google-genai-image/image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/samples/google-genai-image/image.jpg -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/samples/menu/data/menu.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/py/samples/menu/data/menu.jpeg -------------------------------------------------------------------------------- /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_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 | -------------------------------------------------------------------------------- /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_02/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like to try something spicy. What do you recommend?" 3 | } 4 | -------------------------------------------------------------------------------- /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_03/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "sessionId": "session123", 3 | "question": "Do you have anything healthy on this menu?" 4 | } 5 | -------------------------------------------------------------------------------- /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_04/example.menuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like something cheesy!" 3 | } 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/samples/menu/src/case_05/example.visualMenuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "What kind of burger buns do you have?" 3 | } 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /py/samples/model-garden/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | authors = [{ name = "Google" }] 3 | classifiers = [ 4 | "Development Status :: 3 - Alpha", 5 | "Environment :: Console", 6 | "Environment :: Web Environment", 7 | "Intended Audience :: Developers", 8 | "Operating System :: OS Independent", 9 | "License :: OSI Approved :: Apache Software License", 10 | "Programming Language :: Python", 11 | "Programming Language :: Python :: 3.12", 12 | "Programming Language :: Python :: 3.13", 13 | "Programming Language :: Python :: 3 :: Only", 14 | "Topic :: Scientific/Engineering :: Artificial Intelligence", 15 | "Topic :: Software Development :: Libraries", 16 | ] 17 | dependencies = [ 18 | "genkit", 19 | "pydantic>=2.10.5", 20 | ] 21 | description = "Model Garden sample" 22 | license = { text = "Apache-2.0" } 23 | name = "model-garden-example" 24 | readme = "README.md" 25 | requires-python = ">=3.10" 26 | version = "0.1.0" 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /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/idx-template.nix: -------------------------------------------------------------------------------- 1 | {pkgs, sample ? "js-character-generator", ...}: { 2 | packages = [ 3 | pkgs.nodejs 4 | ]; 5 | bootstrap = '' 6 | mkdir "$out" 7 | cp -rf ${./.}/${sample}/. "$out" 8 | chmod -R u+w "$out" 9 | ''; 10 | } -------------------------------------------------------------------------------- /samples/js-angular/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /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-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-angular/genkit-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/samples/js-angular/genkit-app/public/favicon.ico -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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-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-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 | -------------------------------------------------------------------------------- /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/googleai": "^1.0.4", 19 | "@genkit-ai/express": "^1.0.4", 20 | "express": "^4.21.0", 21 | "partial-json": "^0.1.7" 22 | }, 23 | "devDependencies": { 24 | "genkit-cli": "^1.0.4", 25 | "typescript": "^5.4.5", 26 | "tsx": "^4.19.2" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /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/googleai'; 18 | import { genkit } from 'genkit'; 19 | 20 | export const ai = genkit({ 21 | plugins: [googleAI()], 22 | }); 23 | -------------------------------------------------------------------------------- /samples/js-angular/server/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 { startFlowServer } from '@genkit-ai/express'; 18 | import { chatbotFlow } from './chatbot.js'; 19 | import { streamCharacters } from './jsonStreaming.js'; 20 | 21 | startFlowServer({ 22 | flows: [chatbotFlow, streamCharacters], 23 | }); 24 | -------------------------------------------------------------------------------- /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-character-generator/.gitignore: -------------------------------------------------------------------------------- 1 | test/ 2 | node_modules/ 3 | .genkit/ 4 | *.js -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /samples/js-character-generator/idx-template.nix: -------------------------------------------------------------------------------- 1 | {pkgs, language ? "js", tos ? "false", ... }: { 2 | packages = [ 3 | pkgs.nodejs 4 | ]; 5 | bootstrap = '' 6 | mkdir "$out" 7 | mkdir "$out"/.idx 8 | cp -r ${./.idx}/. "$out/.idx/" 9 | cp -f ${./package.json} "$out/package.json" 10 | cp -f ${./package-lock.json} "$out/package-lock.json" 11 | cp -f ${./index.ts} "$out/index.ts" 12 | cp -f ${./.gitignore} "$out/.gitignore" 13 | cp ${./README_IDX.md} "$out"/README.md 14 | chmod -R u+w "$out" 15 | ''; 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/googleai": "^1.0.4" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /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/.gitignore: -------------------------------------------------------------------------------- 1 | lib -------------------------------------------------------------------------------- /samples/js-chatbot/README.md: -------------------------------------------------------------------------------- 1 | # Chatbot 2 | 3 | This is a simple chatbot. You can pick which model to use. 4 | 5 | Prerequisite 6 | 7 | - Google Cloud project with Vertex AI API enabled (https://console.cloud.google.com/apis/api/aiplatform.googleapis.com) 8 | - gcloud CLI installed (https://cloud.google.com/sdk/docs/install-sdk) 9 | - to use Llama 3.1 405b enable it in the Vertex AI [Model Garden](https://console.cloud.google.com/vertex-ai/publishers/meta/model-garden/llama3-405b-instruct-maas) 10 | 11 | The sample is using Vertex AI, so you'll need to auth (you can skip this if running on IDX) 12 | 13 | ```bash 14 | gcloud auth login 15 | gcloud auth application-default login --project YOUR_PROJECT 16 | ``` 17 | 18 | Install deps and run the chatbot app 19 | 20 | ```bash 21 | npm run setup 22 | npm start 23 | ``` 24 | 25 | Point your browser to http://localhost:4200/ 26 | 27 | Inspect runs in http://localhost:4000/ 28 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /samples/js-chatbot/genkit-app/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/samples/js-chatbot/genkit-app/public/favicon.ico -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /samples/js-chatbot/genkit-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "strict": true, 6 | "noImplicitOverride": true, 7 | "noPropertyAccessFromIndexSignature": true, 8 | "noImplicitReturns": true, 9 | "noFallthroughCasesInSwitch": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "sourceMap": true, 13 | "declaration": false, 14 | "experimentalDecorators": true, 15 | "moduleResolution": "bundler", 16 | "importHelpers": true, 17 | "target": "ES2022", 18 | "module": "ES2022", 19 | "useDefineForClassFields": false, 20 | "lib": ["ES2022", "dom"] 21 | }, 22 | "angularCompilerOptions": { 23 | "enableI18nLegacyMessageIdFormat": false, 24 | "strictInjectionParameters": true, 25 | "strictInputAccessModifiers": true, 26 | "strictTemplates": true 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /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-chatbot/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "start": "concurrently npm:start:server npm:start:ng", 4 | "build": "cd server && npm run build && cd ../ && cd genkit-app && npm run build", 5 | "setup": "npm i && cd server && npm i && cd ../genkit-app && npm i", 6 | "start:server:idx": "echo -e '\\033[1mChoose a Cloud Project with the Vertex APIs enabled\\033[0m in the popup\nSee https://console.cloud.google.com/apis/api/aiplatform.googleapis.com/metrics' && npm run start:server", 7 | "start:server": "cd server && npm run genkit:dev", 8 | "start:ng": "cd genkit-app && npm start" 9 | }, 10 | "name": "js-chatbot", 11 | "version": "0.1.0", 12 | "description": "This is a simple chatbot app build with Genkit and Angular", 13 | "keywords": [], 14 | "author": "", 15 | "license": "ISC", 16 | "devDependencies": { 17 | "concurrently": "^8.2.2", 18 | "genkit-cli": "1.0.0-rc.17" 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /samples/js-coffee-shop/src/input.json: -------------------------------------------------------------------------------- 1 | { 2 | "start": { 3 | "customerName": "sam", 4 | "currentTime": "12:30AM", 5 | "previousOrders": ["Americano"] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /samples/js-menu/.gitignore: -------------------------------------------------------------------------------- 1 | __db_menu-items.json -------------------------------------------------------------------------------- /samples/js-menu/data/menu.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/firebase/genkit/6333040785676bf5e451f45d7aa8a927c745a7db/samples/js-menu/data/menu.jpeg -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /samples/js-menu/src/02/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like to try something spicy. What do you recommend?" 3 | } 4 | -------------------------------------------------------------------------------- /samples/js-menu/src/03/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "sessionId": "session123", 3 | "question": "Do you have anything healthy on this menu?" 4 | } 5 | -------------------------------------------------------------------------------- /samples/js-menu/src/04/example.menuQuestion.json: -------------------------------------------------------------------------------- 1 | { 2 | "question": "I'd like something cheesy!" 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-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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /samples/js-schoolAgent/prompts/myPrompt.prompt: -------------------------------------------------------------------------------- 1 | {{ role "system" }} your name is {{ @state.userName }}, always introduce yourself) -------------------------------------------------------------------------------- /samples/js-schoolAgent/src/types.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 interface AgentState { 18 | parentId: number; 19 | parentName: string; 20 | students: { 21 | id: number; 22 | name: string; 23 | grade: number; 24 | activities: string[]; 25 | }[]; 26 | } 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /taplo.toml: -------------------------------------------------------------------------------- 1 | [formatting] 2 | align_entries = true 3 | array_trailing_comma = true 4 | reorder_keys = true 5 | trailing_newline = true 6 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | --------------------------------------------------------------------------------