-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update changes in settings to the chat and completion LLM
- Loading branch information
Showing
6 changed files
with
99 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,6 @@ | ||
import { IInlineCompletionProvider } from '@jupyterlab/completer'; | ||
import { LLM } from '@langchain/core/language_models/llms'; | ||
import { JSONValue } from '@lumino/coreutils'; | ||
|
||
export interface IBaseProvider extends IInlineCompletionProvider { | ||
configure(settings: { [property: string]: JSONValue }): void; | ||
} | ||
|
||
// https://stackoverflow.com/questions/54724875/can-we-check-whether-property-is-readonly-in-typescript | ||
export function isWritable<T extends LLM>(obj: T, key: keyof T) { | ||
const desc = | ||
Object.getOwnPropertyDescriptor(obj, key) || | ||
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(obj), key) || | ||
{}; | ||
return Boolean(desc.writable); | ||
client: LLM; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { BaseLanguageModel } from '@langchain/core/language_models/base'; | ||
|
||
/** | ||
* This function indicates whether a key is writable in an object. | ||
* https://stackoverflow.com/questions/54724875/can-we-check-whether-property-is-readonly-in-typescript | ||
* | ||
* @param obj - An object extending the BaseLanguageModel interface. | ||
* @param key - A string as a key of the object. | ||
* @returns a boolean whether the key is writable or not. | ||
*/ | ||
export function isWritable<T extends BaseLanguageModel>(obj: T, key: keyof T) { | ||
const desc = | ||
Object.getOwnPropertyDescriptor(obj, key) || | ||
Object.getOwnPropertyDescriptor(Object.getPrototypeOf(obj), key) || | ||
{}; | ||
return Boolean(desc.writable); | ||
} |