Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelgj committed Dec 15, 2024
1 parent 70270af commit 98022e5
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 61 deletions.
4 changes: 2 additions & 2 deletions js/core/src/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface FlowAuthPolicy<I extends z.ZodTypeAny = z.ZodTypeAny> {
/**
* For express-based flows, req.auth should contain the value to bepassed into
* the flow context.
*
*
* @hidden
*/
export interface __RequestWithAuth extends express.Request {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions js/core/src/logging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ class Logger {

/**
* Genkit logger.
*
*
* ```ts
* import { logger } from 'genkit/logging';
*
*
* logger.setLogLevel('debug');
* ```
*/
Expand Down
2 changes: 1 addition & 1 deletion js/core/src/reflection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion js/core/src/tracing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function maybeFlushMetrics(): Promise<void> {

/**
* Flushes all configured span processors.
*
*
* @hidden
*/
export async function flushTracing() {
Expand Down
30 changes: 14 additions & 16 deletions js/genkit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

2 changes: 1 addition & 1 deletion js/genkit/src/genkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 2 additions & 6 deletions js/plugins/dev-local-vectorstore/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ async function getClosestDocuments<
/**
* Configures a local vectorstore retriever
*/
function configureDevLocalRetriever<
EmbedderCustomOptions extends z.ZodTypeAny,
>(
function configureDevLocalRetriever<EmbedderCustomOptions extends z.ZodTypeAny>(
ai: Genkit,
params: {
indexName: string;
Expand Down Expand Up @@ -203,9 +201,7 @@ function configureDevLocalRetriever<
/**
* Configures a local vectorstore indexer.
*/
function configureDevLocalIndexer<
EmbedderCustomOptions extends z.ZodTypeAny,
>(
function configureDevLocalIndexer<EmbedderCustomOptions extends z.ZodTypeAny>(
ai: Genkit,
params: {
indexName: string;
Expand Down
4 changes: 1 addition & 3 deletions js/plugins/google-cloud/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
15 changes: 4 additions & 11 deletions js/plugins/googleai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/googleai/src/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions js/plugins/ollama/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface DefineOllamaEmbeddingParams {
export interface OllamaPluginParams {
/**
* Array of models to be defined.
*
*
* ```ts
* const ai = genkit({
* plugins: [
Expand All @@ -68,7 +68,7 @@ export interface OllamaPluginParams {

/**
* Array of embedding models to be defined.
*
*
* ```ts
* const ai = genkit({
* plugins: [
Expand All @@ -89,7 +89,7 @@ export interface OllamaPluginParams {

/**
* Optional request headers, which can be either static or dynamically generated.
*
*
* ```ts
* const ai = genkit({
* plugins: [
Expand Down
7 changes: 5 additions & 2 deletions js/plugins/pinecone/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand All @@ -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).
Expand Down
15 changes: 4 additions & 11 deletions js/plugins/vertexai/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion js/typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"plugins/express",
"plugins/mcp",
"plugins/ollama",
"plugins/pinecone",
"plugins/pinecone"
],
"name": "Genkit JS API reference",
"out": "api-refs-js",
Expand Down

0 comments on commit 98022e5

Please sign in to comment.