Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/core/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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<T = unknown>(
data: unknown,
Expand Down
4 changes: 2 additions & 2 deletions js/genkit/src/client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion js/genkit/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions js/genkit/src/genkit-beta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export class GenkitBeta extends Genkit {
chat<I>(options?: ChatOptions<I>): Chat;

/**
* Create a chat session with the provided preabmle.
* Create a chat session with the provided preamble.
*
* ```ts
* const triageAgent = ai.definePrompt({
Expand Down Expand Up @@ -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({
Expand Down
6 changes: 3 additions & 3 deletions js/genkit/src/genkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions js/genkit/tests/prompts_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down Expand Up @@ -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: {
Expand Down
12 changes: 6 additions & 6 deletions js/genkit/tests/session_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' }],
Expand Down Expand Up @@ -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' }],
Expand Down Expand Up @@ -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' }],
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/compat-oai/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/compat-oai/tests/compat_oai_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]() {
Expand Down
2 changes: 1 addition & 1 deletion js/plugins/google-genai/src/vertexai/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions js/testapps/flow-simple-ai/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']),
Expand All @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions py/packages/genkit/src/genkit/blocks/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
)


Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion samples/js-schoolAgent/src/tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
Loading