Skip to content

Commit

Permalink
Merge pull request #56 from FormulaMonks/chore/upgrade-openai
Browse files Browse the repository at this point in the history
Fix mime type for JPEG & bump OpenAI SDK version
  • Loading branch information
jemc authored Oct 1, 2024
2 parents e1cf349 + 91f9c3e commit b12320d
Show file tree
Hide file tree
Showing 4 changed files with 3,492 additions and 4,226 deletions.
2 changes: 1 addition & 1 deletion examples/basic/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@formula-monks/kurt-open-ai": "workspace:*",
"@formula-monks/kurt-vertex-ai": "workspace:*",
"@google-cloud/vertexai": "1.1.0",
"openai": "^4.51.0",
"openai": "4.66.1",
"zod": "^3.23.8"
}
}
2 changes: 1 addition & 1 deletion packages/kurt-open-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"dependencies": {
"@formula-monks/kurt": "^1.4.0",
"openai": "^4.51.0",
"openai": "4.66.1",
"zod": "^3.23.8",
"zod-to-json-schema": "^3.23.3"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/kurt-open-ai/src/KurtOpenAI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ function toOpenAIMessages(messages: KurtMessage[]): OpenAIMessage[] {

// OpenAI only supports the following MIME types, according to these docs:
// https://platform.openai.com/docs/guides/vision
if (!mimeType.match(/^image\/(jpg|png|webp|gif)$/))
if (!mimeType.match(/^image\/(jpeg|png|webp|gif)$/))
throw new Error(`Unsupported image MIME type: ${mimeType}`) // TODO: Use a subclass of KurtError

const url = `data:${mimeType};base64,${base64Data}`
Expand Down
Loading

0 comments on commit b12320d

Please sign in to comment.