Skip to content

Commit

Permalink
feat: added vercel insights
Browse files Browse the repository at this point in the history
  • Loading branch information
0xcadams committed Jul 29, 2023
1 parent f51f604 commit def1645
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const categoryDescription = hopfield
.template()
.enum("The category of the message.");

// easily define functions for LLMs to call (converted into JSON schema)
// define functions for LLMs to call, with Zod validations
const classifyMessage = hopfield.function({
name: "classifyMessage",
description: "Triage an incoming support message.",
Expand All @@ -65,7 +65,7 @@ const classifyMessage = hopfield.function({
}),
});

// create a client with the function we defined
// create a client with function calling
const chat = hopfield.chat().functions([classifyMessage]);

const incomingUserMessage = "How do I reset my password?";
Expand All @@ -78,12 +78,12 @@ const messages: hop.inferMessageInput<typeof chat>[] = [
},
];

// use the built-in LLM API calls, or just use the input/output Zod validations
// use the built-in LLM API calls (or just use the input/output Zod validations)
const parsed = await chat.get({
messages,
});

// type-strong responses with `__type` helpers
// get type-strong responses with `__type` helpers
if (parsed.choices[0].__type === "function_call") {
// automatically validate the arguments returned from the LLM
// we use the Zod schema you passed, for maximum flexibility in validation
Expand Down
1 change: 1 addition & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default withTwoslash(
},
],
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
['script', { defer: '', src: '/_vercel/insights/script.js' }],
],
lang: 'en-US',
lastUpdated: true,
Expand Down

0 comments on commit def1645

Please sign in to comment.