diff --git a/js/core/src/schema.ts b/js/core/src/schema.ts index 01f451a82f..f3fa32bb30 100644 --- a/js/core/src/schema.ts +++ b/js/core/src/schema.ts @@ -63,7 +63,7 @@ export class ValidationError extends GenkitError { } /** - * Convertes a Zod schema into a JSON schema, utilizing an in-memory cache for known objects. + * Converts a Zod schema into a JSON schema, utilizing an in-memory cache for known objects. * @param options Provide a json schema and/or zod schema. JSON schema has priority. * @returns A JSON schema. */ @@ -123,7 +123,7 @@ export function validateSchema( } /** - * Parses raw data object agaisnt the provided schema. + * Parses raw data object against the provided schema. */ export function parseSchema( data: unknown, diff --git a/js/genkit/src/client/client.ts b/js/genkit/src/client/client.ts index 78cee8b5a8..729642abe1 100644 --- a/js/genkit/src/client/client.ts +++ b/js/genkit/src/client/client.ts @@ -117,7 +117,7 @@ async function __flowRunEnvelope({ if (decodedValue) { buffer += decodedValue; } - // If buffer includes the delimiter that means we are still recieving chunks. + // If buffer includes the delimiter that means we are still receiving chunks. while (buffer.includes(__flowStreamDelimiter)) { const chunk = JSON.parse( buffer @@ -133,7 +133,7 @@ async function __flowRunEnvelope({ `${chunk.error.status}: ${chunk.error.message}\n${chunk.error.details}` ); } else { - throw new Error('unkown chunk format: ' + JSON.stringify(chunk)); + throw new Error('unknown chunk format: ' + JSON.stringify(chunk)); } buffer = buffer.substring( buffer.indexOf(__flowStreamDelimiter) + __flowStreamDelimiter.length diff --git a/js/genkit/src/client/index.ts b/js/genkit/src/client/index.ts index 82bbc06aa5..af096748a1 100644 --- a/js/genkit/src/client/index.ts +++ b/js/genkit/src/client/index.ts @@ -17,7 +17,7 @@ */ /** - * A simple, browser-safe client library for remotely runnning/streaming deployed Genkit flows. + * A simple, browser-safe client library for remotely running/streaming deployed Genkit flows. * * ```ts * import { runFlow, streamFlow } from 'genkit/beta/client'; diff --git a/js/genkit/src/genkit-beta.ts b/js/genkit/src/genkit-beta.ts index 36a2e8fdc6..a784954f53 100644 --- a/js/genkit/src/genkit-beta.ts +++ b/js/genkit/src/genkit-beta.ts @@ -86,7 +86,7 @@ export class GenkitBeta extends Genkit { chat(options?: ChatOptions): Chat; /** - * Create a chat session with the provided preabmle. + * Create a chat session with the provided preamble. * * ```ts * const triageAgent = ai.definePrompt({ @@ -272,7 +272,7 @@ export class GenkitBeta extends Genkit { } /** - * Defines a resource. Resources can then be accessed from a genreate call. + * Defines a resource. Resources can then be accessed from a generate call. * * ```ts * ai.defineResource({ diff --git a/js/genkit/src/genkit.ts b/js/genkit/src/genkit.ts index 0f40fab8d0..def7a03a1c 100644 --- a/js/genkit/src/genkit.ts +++ b/js/genkit/src/genkit.ts @@ -547,14 +547,14 @@ export class Genkit implements HasRegistry { } /** - * create a handlebards helper (https://handlebarsjs.com/guide/block-helpers.html) to be used in dotpormpt templates. + * create a handlebars helper (https://handlebarsjs.com/guide/block-helpers.html) to be used in dotprompt templates. */ defineHelper(name: string, fn: Handlebars.HelperDelegate): void { defineHelper(this.registry, name, fn); } /** - * Creates a handlebars partial (https://handlebarsjs.com/guide/partials.html) to be used in dotpormpt templates. + * Creates a handlebars partial (https://handlebarsjs.com/guide/partials.html) to be used in dotprompt templates. */ definePartial(name: string, source: string): void { definePartial(this.registry, name, source); @@ -1017,7 +1017,7 @@ function registerActionV2( } else { throw new GenkitError({ status: 'INVALID_ARGUMENT', - message: 'Unkown action type returned from plugin ' + plugin.name, + message: 'Unknown action type returned from plugin ' + plugin.name, }); } } diff --git a/js/genkit/tests/prompts_test.ts b/js/genkit/tests/prompts_test.ts index 607d0c8312..7db00cd165 100644 --- a/js/genkit/tests/prompts_test.ts +++ b/js/genkit/tests/prompts_test.ts @@ -99,7 +99,7 @@ describe('definePrompt', () => { const lookedUpPrompt = ai.prompt('hi'); // This is a known limitation -- prompt lookup is async under the hood, // so we can't actually get the metadata... - assert.deepStrictEqual(lookedUpPrompt.ref, { name: 'hi' }); // ideally metadatashould be: { foo: 'bar' } + assert.deepStrictEqual(lookedUpPrompt.ref, { name: 'hi' }); // ideally metadata should be: { foo: 'bar' } }); it('should apply middleware to a prompt call', async () => { @@ -692,7 +692,7 @@ describe('definePrompt', () => { defineEchoModel(ai); }); - it('renderes dotprompt messages', async () => { + it('renders dotprompt messages', async () => { const hi = ai.definePrompt({ name: 'hi', input: { diff --git a/js/genkit/tests/session_test.ts b/js/genkit/tests/session_test.ts index b1d95573d0..b8786db6a1 100644 --- a/js/genkit/tests/session_test.ts +++ b/js/genkit/tests/session_test.ts @@ -370,8 +370,8 @@ describe('session', () => { const session = ai.createSession(); const chat = session.chat(agent); - const respose = await chat.send('hi'); - assert.deepStrictEqual(respose.messages, [ + const response = await chat.send('hi'); + assert.deepStrictEqual(response.messages, [ { role: 'system', content: [{ text: 'hello from template' }], @@ -405,8 +405,8 @@ describe('session', () => { name: 'Genkit', }, }); - const respose = await chat.send('hi'); - assert.deepStrictEqual(respose.messages, [ + const response = await chat.send('hi'); + assert.deepStrictEqual(response.messages, [ { role: 'system', content: [{ text: 'hello Genkit from template' }], @@ -481,8 +481,8 @@ describe('session', () => { }, }); const chat = session.chat(agent); - const respose = await chat.send('hi'); - assert.deepStrictEqual(respose.messages, [ + const response = await chat.send('hi'); + assert.deepStrictEqual(response.messages, [ { role: 'system', content: [{ text: 'foo=bar' }], diff --git a/js/plugins/compat-oai/src/model.ts b/js/plugins/compat-oai/src/model.ts index 09fde93026..f2cfd76a32 100644 --- a/js/plugins/compat-oai/src/model.ts +++ b/js/plugins/compat-oai/src/model.ts @@ -244,7 +244,7 @@ export function fromOpenAIToolCall( } const f = toolCall.function; - // Only parse arugments when it is a JSON object and the finish reason is tool_calls to avoid parsing errors + // Only parse arguments when it is a JSON object and the finish reason is tool_calls to avoid parsing errors if (choice.finish_reason === 'tool_calls') { return { toolRequest: { diff --git a/js/plugins/compat-oai/tests/compat_oai_test.ts b/js/plugins/compat-oai/tests/compat_oai_test.ts index 46e58a6fc9..258be3d06b 100644 --- a/js/plugins/compat-oai/tests/compat_oai_test.ts +++ b/js/plugins/compat-oai/tests/compat_oai_test.ts @@ -1317,7 +1317,7 @@ describe('openAIModelRunner', () => { completions: { stream: jest.fn( () => - // Simluate OpenAI SDK request streaming + // Simulate OpenAI SDK request streaming new (class { isFirstRequest = true; [Symbol.asyncIterator]() { diff --git a/js/plugins/google-genai/src/vertexai/types.ts b/js/plugins/google-genai/src/vertexai/types.ts index 4221adacf6..d0b8a1ea9c 100644 --- a/js/plugins/google-genai/src/vertexai/types.ts +++ b/js/plugins/google-genai/src/vertexai/types.ts @@ -361,7 +361,7 @@ export declare interface LyriaPredictResponse { export declare interface LyriaPrediction { bytesBase64Encoded: string; // Base64 encoded Wav string - mimeType: string; // autio/wav + mimeType: string; // audio/wav } export declare interface LyriaInstance { diff --git a/js/testapps/flow-simple-ai/src/index.ts b/js/testapps/flow-simple-ai/src/index.ts index c0a100f987..45ffc25680 100644 --- a/js/testapps/flow-simple-ai/src/index.ts +++ b/js/testapps/flow-simple-ai/src/index.ts @@ -846,7 +846,7 @@ ai.defineFlow('testArray', async (input, { sendChunk }) => { ai.defineFlow('formatEnum', async (input, { sendChunk }) => { const { output } = await ai.generate({ - prompt: `classify the denger level of sky diving`, + prompt: `classify the danger level of sky diving`, output: { format: 'enum', schema: z.enum(['safe', 'dangerous', 'medium']), @@ -858,7 +858,7 @@ ai.defineFlow('formatEnum', async (input, { sendChunk }) => { ai.defineFlow('formatJsonl', async (input, { sendChunk }) => { const { output } = await ai.generate({ - prompt: `generate 5 randon persons`, + prompt: `generate 5 random persons`, output: { format: 'jsonl', schema: z.array( diff --git a/py/packages/genkit/src/genkit/blocks/generate.py b/py/packages/genkit/src/genkit/blocks/generate.py index 975e3fbdb9..754af90d4e 100644 --- a/py/packages/genkit/src/genkit/blocks/generate.py +++ b/py/packages/genkit/src/genkit/blocks/generate.py @@ -59,7 +59,7 @@ def define_generate_action(registry: Registry): """Registers generate action in the provided registry.""" - async def genereate_action_fn(input: GenerateActionOptions, ctx: ActionRunContext) -> GenerateResponse: + async def generate_action_fn(input: GenerateActionOptions, ctx: ActionRunContext) -> GenerateResponse: return await generate_action( registry=registry, raw_request=input, @@ -70,7 +70,7 @@ async def genereate_action_fn(input: GenerateActionOptions, ctx: ActionRunContex registry.register_action( kind=ActionKind.UTIL, name='generate', - fn=genereate_action_fn, + fn=generate_action_fn, ) @@ -717,7 +717,7 @@ async def _resolve_resume_options( if len(tool_responses) != len(tool_requests): raise GenkitError( status='FAILED_PRECONDITION', - message=f'Ecxpected {len(tool_requests)} responses, but resolved to {len(tool_responses)}', + message=f'Expected {len(tool_requests)} responses, but resolved to {len(tool_responses)}', ) tool_message = Message( diff --git a/samples/js-schoolAgent/src/tools.ts b/samples/js-schoolAgent/src/tools.ts index 57b1d06ad3..2b89d7c52a 100644 --- a/samples/js-schoolAgent/src/tools.ts +++ b/samples/js-schoolAgent/src/tools.ts @@ -97,7 +97,7 @@ export const reportTardy = ai.defineTool( ), excused: z .boolean() - .describe('whether the absense is excused by the parent'), + .describe('whether the absence is excused by the parent'), }), }, async (input) => {