feat(constants): add default temperature and max tokens
This commit is contained in:
@@ -50,3 +50,5 @@ export const DEFAULT_BASE_URL: string =
|
|||||||
|
|
||||||
export const LLM_MAX_RETRIES = 2
|
export const LLM_MAX_RETRIES = 2
|
||||||
export const MAX_STEPS = 20
|
export const MAX_STEPS = 20
|
||||||
|
export const DEFAULT_TEMPERATURE = 0.7 // higher randomness helps auto-recovery
|
||||||
|
export const DEFAULT_MAX_TOKENS = 4096
|
||||||
|
|||||||
@@ -1,7 +1,14 @@
|
|||||||
import type { DomConfig } from '@/dom'
|
import type { DomConfig } from '@/dom'
|
||||||
import type { SupportedLanguage } from '@/i18n'
|
import type { SupportedLanguage } from '@/i18n'
|
||||||
|
|
||||||
import { DEFAULT_API_KEY, DEFAULT_BASE_URL, DEFAULT_MODEL_NAME, LLM_MAX_RETRIES } from './constants'
|
import {
|
||||||
|
DEFAULT_API_KEY,
|
||||||
|
DEFAULT_BASE_URL,
|
||||||
|
DEFAULT_MAX_TOKENS,
|
||||||
|
DEFAULT_MODEL_NAME,
|
||||||
|
DEFAULT_TEMPERATURE,
|
||||||
|
LLM_MAX_RETRIES,
|
||||||
|
} from './constants'
|
||||||
|
|
||||||
export interface LLMConfig {
|
export interface LLMConfig {
|
||||||
baseURL?: string
|
baseURL?: string
|
||||||
@@ -24,8 +31,8 @@ export function parseLLMConfig(config: LLMConfig): Required<LLMConfig> {
|
|||||||
baseURL: config.baseURL ?? DEFAULT_BASE_URL,
|
baseURL: config.baseURL ?? DEFAULT_BASE_URL,
|
||||||
apiKey: config.apiKey ?? DEFAULT_API_KEY,
|
apiKey: config.apiKey ?? DEFAULT_API_KEY,
|
||||||
modelName: config.modelName ?? DEFAULT_MODEL_NAME,
|
modelName: config.modelName ?? DEFAULT_MODEL_NAME,
|
||||||
temperature: config.temperature ?? 0.7, // higher randomness helps auto-recovery
|
temperature: config.temperature ?? DEFAULT_TEMPERATURE,
|
||||||
maxTokens: config.maxTokens ?? 4096,
|
maxTokens: config.maxTokens ?? DEFAULT_MAX_TOKENS,
|
||||||
maxRetries: config.maxRetries ?? LLM_MAX_RETRIES,
|
maxRetries: config.maxRetries ?? LLM_MAX_RETRIES,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user