Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/providers/ollama/chatComplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,15 @@ export const OllamaChatCompleteConfig: ProviderConfig = {
tools: {
param: 'tools',
},
think: {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would mean
think -> gets mapped to -> thinking
you probably are trying to do the opposite
you should do

  thinking: {
    param: 'think',
    transform: (params: Params) => {
      if (params.thinking?.type === 'disabled') {
        return false;
      }
      return true;
    },
  },

param: 'thinking',
transform: (params: Params) => {
if (params.thinking?.type === 'disabled') {
return false;
}
return true;
},
},
Comment on lines +77 to +85
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Type Safety

Issue: The transform function references params.thinking but there's no guarantee that the Params interface includes a thinking property. This could lead to TypeScript compilation errors or runtime issues if the Params type doesn't match the expected structure.

Fix: Ensure the Params interface includes a thinking property with the correct type definition, or add proper type guards to handle cases where thinking might not exist.

Impact: Prevents TypeScript compilation errors and ensures type safety at compile time

Suggested change
think: {
param: 'thinking',
transform: (params: Params) => {
if (params.thinking?.type === 'disabled') {
return false;
}
return true;
},
},
think: {
param: 'thinking',
transform: (params: Params) => {
if (params.thinking?.type === 'disabled') {
return false;
}
return true;
},
},

};

export interface OllamaChatCompleteResponse extends ChatCompletionResponse {
Expand Down