From 98022e541592a39d2af2a26c0eee48b405e52ce3 Mon Sep 17 00:00:00 2001 From: Pavel Jbanov Date: Sun, 15 Dec 2024 13:57:36 -0500 Subject: [PATCH] format --- js/core/src/flow.ts | 4 +-- js/core/src/logging.ts | 4 +-- js/core/src/reflection.ts | 2 +- js/core/src/tracing.ts | 2 +- js/genkit/README.md | 30 +++++++++---------- js/genkit/src/genkit.ts | 2 +- js/plugins/dev-local-vectorstore/src/index.ts | 8 ++--- js/plugins/google-cloud/README.md | 4 +-- js/plugins/googleai/README.md | 15 +++------- js/plugins/googleai/src/gemini.ts | 2 +- js/plugins/ollama/src/types.ts | 6 ++-- js/plugins/pinecone/README.md | 7 +++-- js/plugins/vertexai/README.md | 15 +++------- js/typedoc.json | 2 +- 14 files changed, 42 insertions(+), 61 deletions(-) diff --git a/js/core/src/flow.ts b/js/core/src/flow.ts index 6a861a1f2..21b3f056a 100644 --- a/js/core/src/flow.ts +++ b/js/core/src/flow.ts @@ -47,7 +47,7 @@ export interface FlowAuthPolicy { /** * For express-based flows, req.auth should contain the value to bepassed into * the flow context. - * + * * @hidden */ export interface __RequestWithAuth extends express.Request { @@ -402,7 +402,7 @@ export interface FlowServerOptions { * Flow server exposes registered flows as HTTP endpoints. * * This is for use in production environments. - * + * * @hidden */ export class FlowServer { diff --git a/js/core/src/logging.ts b/js/core/src/logging.ts index dd0d4f150..284fc5614 100644 --- a/js/core/src/logging.ts +++ b/js/core/src/logging.ts @@ -83,10 +83,10 @@ class Logger { /** * Genkit logger. - * + * * ```ts * import { logger } from 'genkit/logging'; - * + * * logger.setLogLevel('debug'); * ``` */ diff --git a/js/core/src/reflection.ts b/js/core/src/reflection.ts index 66e809081..d8d2c4fba 100644 --- a/js/core/src/reflection.ts +++ b/js/core/src/reflection.ts @@ -52,7 +52,7 @@ export interface ReflectionServerOptions { * Reflection server exposes an API for inspecting and interacting with Genkit in development. * * This is for use in development environments. - * + * * @hidden */ export class ReflectionServer { diff --git a/js/core/src/tracing.ts b/js/core/src/tracing.ts index d0b168a2a..85e096f1e 100644 --- a/js/core/src/tracing.ts +++ b/js/core/src/tracing.ts @@ -119,7 +119,7 @@ function maybeFlushMetrics(): Promise { /** * Flushes all configured span processors. - * + * * @hidden */ export async function flushTracing() { diff --git a/js/genkit/README.md b/js/genkit/README.md index b55e8f74e..1a7d47f35 100644 --- a/js/genkit/README.md +++ b/js/genkit/README.md @@ -9,15 +9,15 @@ This guide assumes that you're familiar with building applications with Node.js. To complete this quickstart, make sure that your development environment meets the following requirements: -* Node.js v20+ -* npm +- Node.js v20+ +- npm ## Install Genkit dependencies Install the following Genkit dependencies to use Genkit in your project: -* `genkit` provides Genkit core capabilities. -* `@genkit-ai/googleai` provides access to the Google AI Gemini models. Check out other plugins: https://www.npmjs.com/search?q=keywords:genkit-plugin +- `genkit` provides Genkit core capabilities. +- `@genkit-ai/googleai` provides access to the Google AI Gemini models. Check out other plugins: https://www.npmjs.com/search?q=keywords:genkit-plugin ```posix-terminal npm install genkit @genkit-ai/googleai @@ -51,17 +51,15 @@ Now that you’re set up to make model requests with Genkit, learn how to use mo Genkit capabilities to build your AI-powered apps and workflows. To get started with additional Genkit capabilities, see the following guides: -* [Developer tools](/docs/genkit/devtools): Learn how to set up and use - Genkit’s CLI and developer UI to help you locally test and debug your app. -* [Generating content](/docs/genkit/models): Learn how to use Genkit’s unified - generation API to generate text and structured data from any supported - model. -* [Creating flows](/docs/genkit/flows): Learn how to use special Genkit - functions, called flows, that provide end-to-end observability for workflows - and rich debugging from Genkit tooling. -* [Managing prompts](/docs/genkit/dotprompt): Learn how Genkit helps you manage - your prompts and configuration together as code. - +- [Developer tools](/docs/genkit/devtools): Learn how to set up and use + Genkit’s CLI and developer UI to help you locally test and debug your app. +- [Generating content](/docs/genkit/models): Learn how to use Genkit’s unified + generation API to generate text and structured data from any supported + model. +- [Creating flows](/docs/genkit/flows): Learn how to use special Genkit + functions, called flows, that provide end-to-end observability for workflows + and rich debugging from Genkit tooling. +- [Managing prompts](/docs/genkit/dotprompt): Learn how Genkit helps you manage + your prompts and configuration together as code. License: Apache 2.0 - diff --git a/js/genkit/src/genkit.ts b/js/genkit/src/genkit.ts index ab4202836..1601e7539 100644 --- a/js/genkit/src/genkit.ts +++ b/js/genkit/src/genkit.ts @@ -167,7 +167,7 @@ export type PromptMetadata< * `Genkit` encapsulates a single Genkit instance including the {@link Registry}, {@link ReflectionServer}, {@link FlowServer}, and configuration. * * Do not instantiate this class directly. Use {@link genkit}. - * + * * Registry keeps track of actions, flows, tools, and many other components. Reflection server exposes an API to inspect the registry and trigger executions of actions in the registry. Flow server exposes flows as HTTP endpoints for production use. * * There may be multiple Genkit instances in a single codebase. diff --git a/js/plugins/dev-local-vectorstore/src/index.ts b/js/plugins/dev-local-vectorstore/src/index.ts index eb4ef4324..1331c09e8 100644 --- a/js/plugins/dev-local-vectorstore/src/index.ts +++ b/js/plugins/dev-local-vectorstore/src/index.ts @@ -164,9 +164,7 @@ async function getClosestDocuments< /** * Configures a local vectorstore retriever */ -function configureDevLocalRetriever< - EmbedderCustomOptions extends z.ZodTypeAny, ->( +function configureDevLocalRetriever( ai: Genkit, params: { indexName: string; @@ -203,9 +201,7 @@ function configureDevLocalRetriever< /** * Configures a local vectorstore indexer. */ -function configureDevLocalIndexer< - EmbedderCustomOptions extends z.ZodTypeAny, ->( +function configureDevLocalIndexer( ai: Genkit, params: { indexName: string; diff --git a/js/plugins/google-cloud/README.md b/js/plugins/google-cloud/README.md index 079d722cf..e8b4c25f4 100644 --- a/js/plugins/google-cloud/README.md +++ b/js/plugins/google-cloud/README.md @@ -10,9 +10,7 @@ npm i --save @genkit-ai/google-cloud ```ts import { genkit } from 'genkit'; -import { - enableGoogleCloudTelemetry, -} from '@genkit-ai/google-cloud'; +import { enableGoogleCloudTelemetry } from '@genkit-ai/google-cloud'; enableGoogleCloudTelemetry(); diff --git a/js/plugins/googleai/README.md b/js/plugins/googleai/README.md index 432bf2622..da7054d03 100644 --- a/js/plugins/googleai/README.md +++ b/js/plugins/googleai/README.md @@ -6,30 +6,23 @@ npm i --save @genkit-ai/googleai ``` - ## Using the plugin ```ts import { genkit } from 'genkit'; -import { - googleAI, - gemini, -} from '@genkit-ai/googleai'; +import { googleAI, gemini } from '@genkit-ai/googleai'; const ai = genkit({ - plugins: [ - googleAI(), - ], + plugins: [googleAI()], model: gemini('gemini-1.5-flash'), }); -(async () => { +async () => { const { text } = ai.generate('hi Gemini!'); console.log(text); -}); +}; ``` - 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. Usage information and reference details can be found in [Genkit documentation](https://firebase.google.com/docs/genkit). diff --git a/js/plugins/googleai/src/gemini.ts b/js/plugins/googleai/src/gemini.ts index f51e01609..ebd65adfe 100644 --- a/js/plugins/googleai/src/gemini.ts +++ b/js/plugins/googleai/src/gemini.ts @@ -228,7 +228,7 @@ export type GeminiVersionString = /** * Returns a reference to a model that can be used in generate calls. - * + * * ```js * await ai.generate({ * prompt: 'hi', diff --git a/js/plugins/ollama/src/types.ts b/js/plugins/ollama/src/types.ts index f73da544d..8148b3a0c 100644 --- a/js/plugins/ollama/src/types.ts +++ b/js/plugins/ollama/src/types.ts @@ -52,7 +52,7 @@ export interface DefineOllamaEmbeddingParams { export interface OllamaPluginParams { /** * Array of models to be defined. - * + * * ```ts * const ai = genkit({ * plugins: [ @@ -68,7 +68,7 @@ export interface OllamaPluginParams { /** * Array of embedding models to be defined. - * + * * ```ts * const ai = genkit({ * plugins: [ @@ -89,7 +89,7 @@ export interface OllamaPluginParams { /** * Optional request headers, which can be either static or dynamically generated. - * + * * ```ts * const ai = genkit({ * plugins: [ diff --git a/js/plugins/pinecone/README.md b/js/plugins/pinecone/README.md index 596633832..e238834b5 100644 --- a/js/plugins/pinecone/README.md +++ b/js/plugins/pinecone/README.md @@ -10,7 +10,11 @@ npm i --save genkitx-pinecone ```ts import { genkit } from 'genkit'; -import { pinecone, pineconeRetrieverRef, pineconeIndexerRef } from 'genkitx-pinecone'; +import { + pinecone, + pineconeRetrieverRef, + pineconeIndexerRef, +} from 'genkitx-pinecone'; const ai = genkit({ plugins: [ @@ -37,7 +41,6 @@ export const bobFactsRetriever = pineconeRetrieverRef({ let docs = await ai.retrieve({ retriever: pineconeRetrieverRef, query }); ``` - 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. Usage information and reference details can be found in [Genkit documentation](https://firebase.google.com/docs/genkit). diff --git a/js/plugins/vertexai/README.md b/js/plugins/vertexai/README.md index 79008935e..05a08ab01 100644 --- a/js/plugins/vertexai/README.md +++ b/js/plugins/vertexai/README.md @@ -6,28 +6,21 @@ npm i --save @genkit-ai/vertexai ``` - ## Using the plugin ```ts import { genkit } from 'genkit'; -import { - vertexAI, - gemini, - gemini15Flash, -} from '@genkit-ai/vertexai'; +import { vertexAI, gemini, gemini15Flash } from '@genkit-ai/vertexai'; const ai = genkit({ - plugins: [ - vertexAI(), - ], + plugins: [vertexAI()], model: gemini15Flash, }); -(async () => { +async () => { const { text } = ai.generate('hi Gemini!'); console.log(text); -}); +}; ``` 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. diff --git a/js/typedoc.json b/js/typedoc.json index e11465349..fd0a6704a 100644 --- a/js/typedoc.json +++ b/js/typedoc.json @@ -12,7 +12,7 @@ "plugins/express", "plugins/mcp", "plugins/ollama", - "plugins/pinecone", + "plugins/pinecone" ], "name": "Genkit JS API reference", "out": "api-refs-js",