janhq / jan

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer. Multiple engine support (llama.cpp, TensorRT-LLM)
https://jan.ai/
GNU Affero General Public License v3.0
23.74k stars 1.38k forks source link

fix: correct OpenAI o1 model parameters #4049

Closed louis-jan closed 6 days ago

louis-jan commented 6 days ago

Describe Your Changes

Screenshot 2024-11-19 at 22 08 41 Screenshot 2024-11-19 at 22 08 45 Screenshot 2024-11-19 at 22 09 11

Fixes Issues

Changes made

This git diff summarizes a set of code changes across multiple files. Here's a concise breakdown:

  1. sse.ts (Helper for SSE requests):

    • Added a check for an overridden stream parameter in the request body. If stream is false either in the request body or model parameters, it adjusts accordingly.
  2. models.json (Model Configuration File):

    • Removed the stream, stop, and some other parameters from the model configurations.
    • Updated max_tokens values to significantly higher numbers (32768 and 65536).
    • Adjusted temperature to 1 and top_p to 1.
  3. index.ts (inference-openai-extension):

    • Simplified the transformPayload function by removing unused destructured variables temperature, top_p, and stop.
    • Kept stream: false for handling specific models that only support non-streaming requests.
  4. package.json (Model Extension):

    • Incremented the package version from 1.0.34 to 1.0.35.
  5. inference-cortex-extension/src/index.ts:

    • Reordered queue operations during the onLoad method of the JanInferenceCortexExtension class:
      • The call to this.clean() remains, but the surrounding queue structure is slightly rearranged.
      • The call to executeOnMain is now added to the queue using this.queue.add().
      • The calls to this.healthz() and this.setDefaultEngine(systemInfo) are also added to the queue afterward.
  6. model-extension/src/index.ts:

    • Modified the return logic for an empty toImportModels array in the JanModelExtension class:
      • Instead of immediately returning fetchedModels, the logic now concatenates legacyModels that have the vision_model setting with fetchedModels.

These changes include modifications to model configurations and payload transformation logic for specific model handling, package version bump.

github-actions[bot] commented 6 days ago

Barecheck - Code coverage report

Total: 69.28% Your code coverage diff: 0.00% ▴
Uncovered files and lines
FileLines
core/src/browser/extensions/engines/helpers/sse.ts37-38, 74-75, 82, 88, 95