Skip to content

Commit

Permalink
docs(js): a few random typedoc fixes (#2018)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelgj authored Feb 18, 2025
1 parent ba4bd15 commit bea0858
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 7 deletions.
8 changes: 7 additions & 1 deletion js/genkit/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ export function streamFlow<O = any, S = any>({
input,
headers,
}: {
/** URL of the deployed flow. */
url: string;
/** Flow input. */
input?: any;
/** A map of HTTP headers to be added to the HTTP call. */
headers?: Record<string, string>;
}): {
readonly output: Promise<O>;
Expand Down Expand Up @@ -139,7 +142,7 @@ async function __flowRunEnvelope({
* For example:
*
* ```js
* import { runFlow } from '@genkit-ai/core/flow-client';
* import { runFlow } from 'genkit/beta/client';
*
* const response = await runFlow({
* url: 'https://my-flow-deployed-url',
Expand All @@ -153,8 +156,11 @@ export async function runFlow<O = any>({
input,
headers,
}: {
/** URL of the deployed flow. */
url: string;
/** Flow input. */
input?: any;
/** A map of HTTP headers to be added to the HTTP call. */
headers?: Record<string, string>;
}): Promise<O> {
const response = await fetch(url, {
Expand Down
25 changes: 25 additions & 0 deletions js/genkit/src/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/**
* @license
*
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,4 +16,27 @@
* limitations under the License.
*/

/**
* A simple, browser-safe client library for remotely runnning/streaming deployed Genkit flows.
*
* ```ts
* import { runFlow, streamFlow } from 'genkit/beta/client';
*
* const response = await runFlow({
* url: 'https://my-flow-deployed-url',
* input: 'foo',
* });
*
* const response = streamFlow({
* url: 'https://my-flow-deployed-url',
* input: 'foo',
* });
* for await (const chunk of response.stream) {
* console.log(chunk);
* }
* console.log(await response.output);
* ```
*
* @module beta/client
*/
export { runFlow, streamFlow } from './client.js';
9 changes: 3 additions & 6 deletions js/genkit/src/genkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,7 @@ export class Genkit implements HasRegistry {
}

/**
* Defines and registers a non-streaming flow.
*
* @todo TODO: Improve this documentation (show snippets, etc).
* Defines and registers a flow function.
*/
defineFlow<
I extends z.ZodTypeAny = z.ZodTypeAny,
Expand Down Expand Up @@ -233,9 +231,8 @@ export class Genkit implements HasRegistry {
}

/**
* Looks up a prompt by `name` and optional `variant`.
*
* @todo TODO: Show an example of a name and variant.
* Looks up a prompt by `name` (and optionally `variant`). Can be used to lookup
* .prompt files or prompts previously defined with {@link Genkit.definePrompt}
*/
prompt<
I extends z.ZodTypeAny = z.ZodTypeAny,
Expand Down

0 comments on commit bea0858

Please sign in to comment.