diff --git a/README.md b/README.md index 4dd83f72..434c184b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Building natural language interfaces has traditionally been difficult. These app TypeChat replaces _prompt engineering_ with _schema engineering_. -Simply define types that represent the intents supported in your natural language application. That could be as simple as an interface for categorizing sentiment or more complex examples like types for a shopping cart or music application. For example, to add additional intents to a schema, a developer can add additional types into a discriminated union. To make schemas hierarchicial, a developer can use a "meta-schema" to choose one or more sub-schemas based on user input. +Simply define types that represent the intents supported in your natural language application. That could be as simple as an interface for categorizing sentiment or more complex examples like types for a shopping cart or music application. For example, to add additional intents to a schema, a developer can add additional types into a discriminated union. To make schemas hierarchical, a developer can use a "meta-schema" to choose one or more sub-schemas based on user input. After defining your types, TypeChat takes care of the rest by: diff --git a/examples/music/src/service.ts b/examples/music/src/service.ts index a6d6ba75..c46d91bc 100644 --- a/examples/music/src/service.ts +++ b/examples/music/src/service.ts @@ -71,7 +71,7 @@ export class SpotifyService { return authData.data; } catch (e) { - // TODO: REVIEW: should we really be returing the response + // TODO: REVIEW: should we really be returning the response // data in an error condition? if (e instanceof axios.AxiosError) { // TODO: REVIEW: the type returned here may not be Promise diff --git a/site/src/docs/faq.md b/site/src/docs/faq.md index 994923c2..65c7991b 100644 --- a/site/src/docs/faq.md +++ b/site/src/docs/faq.md @@ -39,7 +39,7 @@ Once receiving an AI response, TypeChat uses the TypeScript compiler API under t ### How reliable is TypeChat? -TypeChat is _very_ reliable. Large language models have proven they do well when constrained with umambiguous, formal descriptions of possible outputs. They also perform better the more training they have received. TypeScript is the type system for the world's most popular programming language, and JSON is the interchange format for the most popular programming language. As a result, the model has extreme familiarity with both, increasing accuracy. TypeChat purposely creates the prompt compact, and TypeScript can be as much as 5x more concise than a JSON Schema equivalent. Most of the time, the model responds well to the prompt from TypeChat, and sends back a valid instance. TypeChat adds validation, and (if that fails) self-reparing logic to obtain a valid response from the model using diagnostics from the TypeScript compiler. Finally, TypeChat keeps the user in the loop for final confirmation of intent, serving as a final safety mechanism. +TypeChat is _very_ reliable. Large language models have proven they do well when constrained with unambiguous, formal descriptions of possible outputs. They also perform better the more training they have received. TypeScript is the type system for the world's most popular programming language, and JSON is the interchange format for the most popular programming language. As a result, the model has extreme familiarity with both, increasing accuracy. TypeChat purposely creates the prompt compact, and TypeScript can be as much as 5x more concise than a JSON Schema equivalent. Most of the time, the model responds well to the prompt from TypeChat, and sends back a valid instance. TypeChat adds validation, and (if that fails) self-repairing logic to obtain a valid response from the model using diagnostics from the TypeScript compiler. Finally, TypeChat keeps the user in the loop for final confirmation of intent, serving as a final safety mechanism. ### What languages does TypeChat support? diff --git a/site/src/docs/introduction.md b/site/src/docs/introduction.md index 12261f9c..e3a17c33 100644 --- a/site/src/docs/introduction.md +++ b/site/src/docs/introduction.md @@ -83,7 +83,7 @@ Examples responses are great, but we wondered if there was another approach. In our case, we asked whether we could simply guide a model with TypeScript types. > **User:** -> Provide 3 suggestions for specific places to go to in Seattle on a rainy day. Respond strictly with JSON. The JSON should be compatible with the TypeScript type `Response` from the folllowing: +> Provide 3 suggestions for specific places to go to in Seattle on a rainy day. Respond strictly with JSON. The JSON should be compatible with the TypeScript type `Response` from the following: > > ```ts > interface Response { diff --git a/site/src/docs/techniques.md b/site/src/docs/techniques.md index 3ea2bb99..e32d5b5c 100644 --- a/site/src/docs/techniques.md +++ b/site/src/docs/techniques.md @@ -25,4 +25,4 @@ To maximize success with TypeChat, we recommend the following best practices whe The last point merits further elaboration. We've found that when Response Models attempt to fit user requests into narrow schema with no wiggle room, the LLMs are likely to hallucinate answers for user requests that are outside the domain. For example, if you ask your coffee shop bot for "two tall trees", given no other option it may well turn that into two tall lattes (without letting you know it did so). -However, when you include an _escape hatch_ in the form of an "unknown" category in your schema, the LLMs happily route non-domain requests into that bucket. Not only does this greatly suppress hallucinations, it also gives you a convenient way of letting the user know which parts of a request weren't undestood. The examples in the TypeChat repo all use this technique. \ No newline at end of file +However, when you include an _escape hatch_ in the form of an "unknown" category in your schema, the LLMs happily route non-domain requests into that bucket. Not only does this greatly suppress hallucinations, it also gives you a convenient way of letting the user know which parts of a request weren't understood. The examples in the TypeChat repo all use this technique. \ No newline at end of file diff --git a/src/program.ts b/src/program.ts index 1f92b204..c1e9974b 100644 --- a/src/program.ts +++ b/src/program.ts @@ -7,7 +7,7 @@ export type Program = { "@steps": FunctionCall[]; } -// A function call specifices a function name and a list of argument expressions. Arguments may contain +// A function call specifies a function name and a list of argument expressions. Arguments may contain // nested function calls and result references. export type FunctionCall = { // Name of the function diff --git a/src/validate.ts b/src/validate.ts index 08b11530..266138b1 100644 --- a/src/validate.ts +++ b/src/validate.ts @@ -39,7 +39,7 @@ export interface TypeChatJsonValidator { createModuleTextFromJson(jsonObject: object): Result; /** * Parses and validates the given JSON string according to the associated TypeScript schema. Returns a - * `Success` object containing the parsed JSON object if valudation was successful. Otherwise, returns + * `Success` object containing the parsed JSON object if validation was successful. Otherwise, returns * an `Error` object with a `message` property that contains the TypeScript compiler diagnostics. * @param jsonText The JSON string to validate. * @returns The parsed JSON object or the TypeScript compiler diagnostic messages.