Merge pull request #4049 from janhq/fix/openai-o1-model-parameters
fix: correct OpenAI o1 model parameters
This commit is contained in:
commit
10e1201083
@ -45,7 +45,9 @@ export function requestInference(
|
|||||||
subscriber.complete()
|
subscriber.complete()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (model.parameters?.stream === false) {
|
// There could be overriden stream parameter in the model
|
||||||
|
// that is set in request body (transformed payload)
|
||||||
|
if (requestBody?.stream === false || model.parameters?.stream === false) {
|
||||||
const data = await response.json()
|
const data = await response.json()
|
||||||
if (transformResponse) {
|
if (transformResponse) {
|
||||||
subscriber.next(transformResponse(data))
|
subscriber.next(transformResponse(data))
|
||||||
|
|||||||
@ -69,12 +69,13 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
|
|||||||
|
|
||||||
super.onLoad()
|
super.onLoad()
|
||||||
|
|
||||||
await this.queue.add(() => this.clean())
|
this.queue.add(() => this.clean())
|
||||||
this.queue.add(() => this.healthz())
|
|
||||||
this.queue.add(() => this.setDefaultEngine(systemInfo))
|
|
||||||
// Run the process watchdog
|
// Run the process watchdog
|
||||||
const systemInfo = await systemInformation()
|
const systemInfo = await systemInformation()
|
||||||
await executeOnMain(NODE, 'run', systemInfo)
|
this.queue.add(() => executeOnMain(NODE, 'run', systemInfo))
|
||||||
|
this.queue.add(() => this.healthz())
|
||||||
|
this.queue.add(() => this.setDefaultEngine(systemInfo))
|
||||||
this.subscribeToEvents()
|
this.subscribeToEvents()
|
||||||
|
|
||||||
window.addEventListener('beforeunload', () => {
|
window.addEventListener('beforeunload', () => {
|
||||||
|
|||||||
@ -97,11 +97,9 @@
|
|||||||
"format": "api",
|
"format": "api",
|
||||||
"settings": {},
|
"settings": {},
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"max_tokens": 4096,
|
"temperature": 1,
|
||||||
"temperature": 0.7,
|
"top_p": 1,
|
||||||
"top_p": 0.95,
|
"max_tokens": 32768,
|
||||||
"stream": true,
|
|
||||||
"stop": [],
|
|
||||||
"frequency_penalty": 0,
|
"frequency_penalty": 0,
|
||||||
"presence_penalty": 0
|
"presence_penalty": 0
|
||||||
},
|
},
|
||||||
@ -125,11 +123,9 @@
|
|||||||
"format": "api",
|
"format": "api",
|
||||||
"settings": {},
|
"settings": {},
|
||||||
"parameters": {
|
"parameters": {
|
||||||
"max_tokens": 4096,
|
"temperature": 1,
|
||||||
"temperature": 0.7,
|
"top_p": 1,
|
||||||
"top_p": 0.95,
|
"max_tokens": 65536,
|
||||||
"stream": true,
|
|
||||||
"stop": [],
|
|
||||||
"frequency_penalty": 0,
|
"frequency_penalty": 0,
|
||||||
"presence_penalty": 0
|
"presence_penalty": 0
|
||||||
},
|
},
|
||||||
|
|||||||
@ -76,11 +76,11 @@ export default class JanInferenceOpenAIExtension extends RemoteOAIEngine {
|
|||||||
transformPayload = (payload: OpenAIPayloadType): OpenAIPayloadType => {
|
transformPayload = (payload: OpenAIPayloadType): OpenAIPayloadType => {
|
||||||
// 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, temperature, top_p, stop, ...params } = payload
|
const { max_tokens, stop, ...params } = payload
|
||||||
return {
|
return {
|
||||||
...params,
|
...params,
|
||||||
max_completion_tokens: max_tokens,
|
max_completion_tokens: max_tokens,
|
||||||
stream: false // o1 only support stream = false
|
stream: false, // o1 only support stream = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Pass through for non-preview models
|
// Pass through for non-preview models
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@janhq/model-extension",
|
"name": "@janhq/model-extension",
|
||||||
"productName": "Model Management",
|
"productName": "Model Management",
|
||||||
"version": "1.0.34",
|
"version": "1.0.35",
|
||||||
"description": "Model Management Extension provides model exploration and seamless downloads",
|
"description": "Model Management Extension provides model exploration and seamless downloads",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"author": "Jan <service@jan.ai>",
|
"author": "Jan <service@jan.ai>",
|
||||||
|
|||||||
@ -143,7 +143,10 @@ export default class JanModelExtension extends ModelExtension {
|
|||||||
* There is no model to import
|
* There is no model to import
|
||||||
* just return fetched models
|
* just return fetched models
|
||||||
*/
|
*/
|
||||||
if (!toImportModels.length) return fetchedModels
|
if (!toImportModels.length)
|
||||||
|
return fetchedModels.concat(
|
||||||
|
legacyModels.filter((e) => e.settings?.vision_model)
|
||||||
|
)
|
||||||
|
|
||||||
console.log('To import models:', toImportModels.length)
|
console.log('To import models:', toImportModels.length)
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user