-
Notifications
You must be signed in to change notification settings - Fork 7
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
LLM settings from url #121
Conversation
fe27649
to
9d1e902
Compare
|
||
def formatter(item): | ||
if isinstance(item, Exception): | ||
item = {'state': 'error', 'error': str(item)} | ||
return json.dumps(item) | ||
|
||
def run(callback): | ||
return run_query(session_id, query, history, Settings(**settings), callback) |
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 Settings
class have various validators that can raise exceptions. This causes the request to fail with a uninformative (for the user) error, so make sure that a proper error instance is streamed back
streaming=True, | ||
callbacks=callbacks, | ||
max_tokens=settings.max_response_tokens, | ||
model=settings.completions |
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 model setting wasn't being used
@@ -30,3 +44,78 @@ export const A: React.FC<{ | |||
<a className={className}>{children}</a> | |||
); | |||
}; | |||
|
|||
const between = |
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.
these are just moved over from the playground.tsx
file
SETTINGS_PARSERS | ||
); | ||
|
||
type ChatSettingsParams = { |
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 following lines are just moved over from playground.tsx
web/src/components/settings.tsx
Outdated
}; | ||
export const ENCODERS = ["cl100k_base"]; | ||
|
||
/** Update the given `obj` so that it has `val` at the given path. |
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.
a bit of magic starts here - the idea is for each settings field to have a defined parser that will also return a default value if provided with an undefined value. Most of the magic is to handle the prompts, which are nested.
I considered just having separate keys for the prompt parts, but that would require a lot of messing around in other places, so I just kept the complexity here
web/src/pages/playground.tsx
Outdated
const setMode = (mode: [Mode, boolean]) => { | ||
if (mode[1]) { | ||
localStorage.setItem("chat_mode", mode[0]); | ||
updateSettings((settings) => ({ ...settings, mode: mode[0] })); | ||
} | ||
}; | ||
|
||
const changeSetting = (path: string[], value: any) => { | ||
router.replace( |
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.
this will add any changes in the various widgets to the URL, so it'll be a lot easier to save/share parameters
ping |
No description provided.