🤖 refactor: Remove Default Model Params for All Endpoints (#3682)

* refactor: use parseCompactConvo in buildOptions, and generate no default values for the API to avoid weird model behavior with defaults

* refactor: OTHER - always show cursor when markdown component is empty (preferable to not)

* refactor(OpenAISettings): use config object for setting defaults app-wide

* refactor: Use removeNullishValues in buildOptions for ALL  endpoints

* fix: add missing conversationId to title methods for transactions; refactor(GoogleClient): model options, set no default, add todo note for recording token usage

* fix: at minimum set a model default, as is required by API (edge case)
This commit is contained in:
Danny Avila 2024-08-18 06:00:03 -04:00 committed by GitHub
parent d3a20357e9
commit 683702d555
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 169 additions and 141 deletions

View file

@ -82,7 +82,7 @@ export const ImageVisionTool: FunctionTool = {
};
export const isImageVisionTool = (tool: FunctionTool | FunctionToolCall) =>
tool.type === 'function' && tool.function?.name === ImageVisionTool?.function?.name;
tool.type === 'function' && tool.function?.name === ImageVisionTool.function?.name;
export const openAISettings = {
model: {
@ -123,6 +123,9 @@ export const openAISettings = {
},
imageDetail: {
default: ImageDetail.auto,
min: 0,
max: 2,
step: 1,
},
};
@ -840,22 +843,22 @@ export const compactOpenAISchema = tConversationSchema
})
.transform((obj: Partial<TConversation>) => {
const newObj: Partial<TConversation> = { ...obj };
if (newObj.temperature === 1) {
if (newObj.temperature === openAISettings.temperature.default) {
delete newObj.temperature;
}
if (newObj.top_p === 1) {
if (newObj.top_p === openAISettings.top_p.default) {
delete newObj.top_p;
}
if (newObj.presence_penalty === 0) {
if (newObj.presence_penalty === openAISettings.presence_penalty.default) {
delete newObj.presence_penalty;
}
if (newObj.frequency_penalty === 0) {
if (newObj.frequency_penalty === openAISettings.frequency_penalty.default) {
delete newObj.frequency_penalty;
}
if (newObj.resendFiles === true) {
if (newObj.resendFiles === openAISettings.resendFiles.default) {
delete newObj.resendFiles;
}
if (newObj.imageDetail === ImageDetail.auto) {
if (newObj.imageDetail === openAISettings.imageDetail.default) {
delete newObj.imageDetail;
}