Merge pull request #4246 from janhq/fix/openai-vision-models
chore: fix openai vision models
This commit is contained in:
commit
5d9332f23c
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@janhq/inference-openai-extension",
|
"name": "@janhq/inference-openai-extension",
|
||||||
"productName": "OpenAI Inference Engine",
|
"productName": "OpenAI Inference Engine",
|
||||||
"version": "1.0.4",
|
"version": "1.0.5",
|
||||||
"description": "This extension enables OpenAI chat completion API calls",
|
"description": "This extension enables OpenAI chat completion API calls",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "dist/module.js",
|
"module": "dist/module.js",
|
||||||
|
|||||||
@ -67,7 +67,9 @@
|
|||||||
"version": "1.1",
|
"version": "1.1",
|
||||||
"description": "OpenAI GPT 4o is a new flagship model with fast speed and high quality",
|
"description": "OpenAI GPT 4o is a new flagship model with fast speed and high quality",
|
||||||
"format": "api",
|
"format": "api",
|
||||||
"settings": {},
|
"settings": {
|
||||||
|
"vision_model": true
|
||||||
|
},
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"max_tokens": 4096,
|
"max_tokens": 4096,
|
||||||
"temperature": 0.7,
|
"temperature": 0.7,
|
||||||
|
|||||||
@ -74,6 +74,11 @@ export default class JanInferenceOpenAIExtension extends RemoteOAIEngine {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
transformPayload = (payload: OpenAIPayloadType): OpenAIPayloadType => {
|
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
|
// Transform the payload for preview models
|
||||||
if (this.previewModels.includes(payload.model)) {
|
if (this.previewModels.includes(payload.model)) {
|
||||||
const { max_tokens, stop, ...params } = payload
|
const { max_tokens, stop, ...params } = payload
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user