Skip to content

Commit

Permalink
Fix errors (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
roodboi authored Feb 14, 2024
1 parent 6e36c86 commit ac43cf1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"format:write": "prettier --write \"**/*.{ts,tsx}\"",
"type-check": "tsc --noEmit",
"prepare": "husky install",
"prepare": "husky || true",
"clean": "rm -rf .turbo && rm -rf node_modules && rm -rf dist",
"changeset": "changeset",
"version-packages": "changeset version",
Expand Down
7 changes: 3 additions & 4 deletions src/dsl/validator.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { OAIClientExtended } from "@/instructor"
import type { ChatCompletionCreateParams } from "openai/resources/chat/completions.mjs"
import { RefinementCtx, z } from "zod"
import OpenAI from "openai"
import { RefinementCtx, z } from "zod"

type AsyncSuperRefineFunction = (data: string, ctx: RefinementCtx) => Promise<void>

export const LLMValidator = (
instructor: OAIClientExtended,
statement: string,
params: Omit<ChatCompletionCreateParams, "messages">
params: Omit<OpenAI.ChatCompletionCreateParams, "messages">
): AsyncSuperRefineFunction => {
const schema = z.object({
isValid: z.boolean(),
Expand Down Expand Up @@ -69,7 +68,7 @@ export const moderationValidator = (client: OAIClientExtended | OpenAI) => {
} catch (error) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
message: `Unexpected error during moderation: ${error instanceof Error ? error.message : 'Unknown error'}`
message: `Unexpected error during moderation: ${error instanceof Error ? error.message : "Unknown error"}`
})
}
}
Expand Down

0 comments on commit ac43cf1

Please sign in to comment.