-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Jan provider support #932
Conversation
@@ -1233,9 +1237,8 @@ that allows you to run an LLM locally. | |||
|
|||
The provider is `llamafile` and the model name is ignored. | |||
|
|||
## Jan, LLaMA.cpp | |||
## LLaMA.cpp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The section on Jan is out of place and does not fit with the flow of the document. It should be moved to a more appropriate location or removed if it is not necessary.
generated by pr-docs-review-commit
structure
AnalysisThe provided 1. Code Duplication
2. Magic Strings
3. Inconsistent Handling of Fallback Actions
4. Commented-out Code
Suggested ImprovementsExtract Duplication into a Utility FunctionTo address the code duplication and maintainability issues: // utils.ts
export const pickModel = async (
generateConfig: () => Promise<{ model?: string; provider?: string }>
): Promise<string | undefined> => {
const res = await generateConfig();
if (res === undefined) return undefined;
const configure = "Configure...";
vscode.window.showWarningMessage(
`${TOOL_NAME} - model connection not configured.`,
configure
);
if (configure) {
vscode.env.openExternal(vscode.Uri.parse(DOCS_CONFIGURATION_URL));
}
return res.model;
}; Then update the // main.ts or wherever these are defined
export async function pick_chat_model(
state: State,
model: string
): Promise<string | undefined> {
return pickModel(() => generateChatModelConfiguration(state, model));
}
export async function pick_language_model(
state: State,
modelId: string
): Promise<string | undefined> {
return pickModel(() =>
generateLanguageModelConfiguration(state, modelId)
);
} Use Constants for Repeated ValuesTo address the Magic Strings issue: // utils.ts
export const CONFIGURE_ACTION = "Configure...";
export async function showWarningForNoConfiguredModel() {
vscode.window.showWarningMessage(
`${TOOL_NAME} - model connection not configured.`,
CONFIGURE_ACTION
);
} Then update the // main.ts or wherever these are defined
export async function pick_chat_model(
state: State,
model: string
): Promise<string | undefined> {
return pickModel(() => generateChatModelConfiguration(state, model));
}
export async function pick_language_model(
state: State,
modelId: string
): Promise<string | undefined> {
return pickModel(() =>
generateLanguageModelConfiguration(state, modelId)
);
} Simplify Handling of Fallback ActionsTo address the inconsistency in handling fallback actions: // utils.ts or wherever these are defined
export async function handleNoModelConfigured() {
vscode.window.showWarningMessage(
`${TOOL_NAME} - model connection not configured.`,
CONFIGURE_ACTION
);
if (CONFIGURE_ACTION) {
vscode.env.openExternal(vscode.Uri.parse(DOCS_CONFIGURATION_URL));
}
} Then update the // main.ts or wherever these are defined
export async function pick_chat_model(
state: State,
model: string
): Promise<string | undefined> {
return pickModel(() => generateChatModelConfiguration(state, model));
}
export async function pick_language_model(
state: State,
modelId: string
): Promise<string | undefined> {
return pickModel(() =>
generateLanguageModelConfiguration(state, modelId)
);
} Summary of Changes
These changes improve the overall readability, maintainability, and functionality of the code, reducing the risk of inconsistencies and making it easier to manage future changes.
|
Introduce support for the Jan provider, enabling connection to the Jan local server and updating relevant configurations and documentation. Clean up unused code related to other providers.
Here's a high-level summary of the changes in the
GIT_DIFF
:🔄 Removed functions for selecting language models, such as
pickChatModel
andpickLanguageModel
. This was likely done to simplify the API by removing redundant or complex logic.🦺 Updated the public types in "packages/core/src/prompt_template.d.ts" to reflect changes in how language models are configured and used. This ensures that developers still have access to necessary information about available models.
🔧 Made some adjustments to how models are picked and connected, optimizing the process for future integrations or performance enhancements.