Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
Wauplin committed Feb 12, 2024
1 parent 43d2708 commit 18d9bee
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
content: string;
}
interface Response {
interface Response {
generated_text: string;
}
Expand Down Expand Up @@ -90,7 +90,7 @@
model.id,
requestBody,
apiToken,
body => parseOutput(body, chat),
(body) => parseOutput(body, chat),
withModelLoading,
includeCredentials,
isOnLoadCall
Expand Down Expand Up @@ -124,10 +124,13 @@
}
function isValidOutput(arg: any): arg is Response {
return typeof(arg?.generated_text) === "string";
return typeof arg?.generated_text === "string";
}
function parseOutput(body: unknown, chat: Message[]): {
function parseOutput(
body: unknown,
chat: Message[]
): {
chat: Message[];
output: Output;
} {
Expand All @@ -143,9 +146,7 @@
return { chat: chatWithOutput, output };
}
throw new TypeError(
"Invalid output: output must be of type <generated_text: string>"
);
throw new TypeError("Invalid output: output must be of type <generated_text: string>");
}
function applyWidgetExample(sample: WidgetExampleTextInput, opts: ExampleRunOpts = {}) {
Expand Down

0 comments on commit 18d9bee

Please sign in to comment.