Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
alvesvaren committed Nov 23, 2023
1 parent 4008eba commit a5eea5e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/poor-yaks-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"zod-to-openai-tool": patch
---

Update documentation to match v0.8.0 changes
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Easily create tools from zod schemas to use with OpenAI Assistants and Chat Comp
```ts
import { tool, createTools } from "zod-to-openai-tool";

const { tools, processActions } = createTools({
const { tools, processAssistantActions } = createTools({
getWeather: tool()
.input(z.object({ city: z.string() }))
.describe("Get the weather in a city")
Expand All @@ -21,7 +21,7 @@ const assistant = await openai.beta.assistants.create({

// Then, when the assistant uses the tools and responds with `requires_action`:
const actions = run.required_action.submit_tool_outputs.tool_calls;
const tool_outputs = processActions(actions);
const tool_outputs = processAssistantActions(actions);
await openai.beta.threads.runs.submitToolOutputs(thread.id, run.id, {
tool_outputs,
});
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export function tool<T = void>(): Tool<T> {
* @returns An object containing the tools and a function to process actions.
* @example
* ```ts
* const { tools, processActions } = createTools({
* const { tools, processAssistantActions, processChatActions } = createTools({
* getWeather, // These are created with `tool()`
* exponential,
* });
Expand All @@ -103,7 +103,7 @@ export function tool<T = void>(): Tool<T> {

export function createTools<T>(
tools: { [K in keyof T]: InternalTool },
onError?: (error: any) => any,
onError?: (error: unknown) => any,
) {
type _Tool = (typeof tools)[keyof T];

Expand Down Expand Up @@ -172,7 +172,7 @@ export function createTools<T>(
* @see https://platform.openai.com/docs/assistants/tools - for more information on the OpenAI API tools.
* @example
* ```ts
* const tools = combineTools(
* const { tools, processAssistantActions } = combineTools(
* createTools({
* getWeather,
* exponential,
Expand Down

0 comments on commit a5eea5e

Please sign in to comment.