Skip to content

Commit

Permalink
Merge pull request #4246 from janhq/fix/openai-vision-models
Browse files Browse the repository at this point in the history
chore: fix openai vision models
  • Loading branch information
louis-jan authored Dec 9, 2024
2 parents 893d6ff + 20a652e commit 5d9332f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extensions/inference-openai-extension/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@janhq/inference-openai-extension",
"productName": "OpenAI Inference Engine",
"version": "1.0.4",
"version": "1.0.5",
"description": "This extension enables OpenAI chat completion API calls",
"main": "dist/index.js",
"module": "dist/module.js",
Expand Down
4 changes: 3 additions & 1 deletion extensions/inference-openai-extension/resources/models.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@
"version": "1.1",
"description": "OpenAI GPT 4o is a new flagship model with fast speed and high quality",
"format": "api",
"settings": {},
"settings": {
"vision_model": true
},
"parameters": {
"max_tokens": 4096,
"temperature": 0.7,
Expand Down
5 changes: 5 additions & 0 deletions extensions/inference-openai-extension/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export default class JanInferenceOpenAIExtension extends RemoteOAIEngine {
* @returns
*/
transformPayload = (payload: OpenAIPayloadType): OpenAIPayloadType => {
// Remove empty stop words
if (payload.stop?.length === 0) {
const { stop, ...params } = payload
payload = params
}
// Transform the payload for preview models
if (this.previewModels.includes(payload.model)) {
const { max_tokens, stop, ...params } = payload
Expand Down

0 comments on commit 5d9332f

Please sign in to comment.