refactor: unify LLM configuration types
This commit is contained in:
@@ -4,16 +4,16 @@
|
|||||||
* @note Use OpenAILenientClient instead.
|
* @note Use OpenAILenientClient instead.
|
||||||
*/
|
*/
|
||||||
import { InvokeError, InvokeErrorType } from './errors'
|
import { InvokeError, InvokeErrorType } from './errors'
|
||||||
import type { InvokeResult, LLMClient, Message, OpenAIClientConfig, Tool } from './types'
|
import type { InvokeResult, LLMClient, LLMConfig, Message, Tool } from './types'
|
||||||
import { modelPatch, zodToOpenAITool } from './utils'
|
import { modelPatch, zodToOpenAITool } from './utils'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated Use OpenAILenientClient instead.
|
* @deprecated Use OpenAILenientClient instead.
|
||||||
*/
|
*/
|
||||||
export class OpenAIClient implements LLMClient {
|
export class OpenAIClient implements LLMClient {
|
||||||
config: OpenAIClientConfig
|
config: LLMConfig
|
||||||
|
|
||||||
constructor(config: OpenAIClientConfig) {
|
constructor(config: LLMConfig) {
|
||||||
this.config = config
|
this.config = config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,20 +2,13 @@
|
|||||||
* OpenAI Client implementation
|
* OpenAI Client implementation
|
||||||
*/
|
*/
|
||||||
import { InvokeError, InvokeErrorType } from './errors'
|
import { InvokeError, InvokeErrorType } from './errors'
|
||||||
import type {
|
import type { InvokeResult, LLMClient, LLMConfig, MacroToolInput, Message, Tool } from './types'
|
||||||
InvokeResult,
|
|
||||||
LLMClient,
|
|
||||||
MacroToolInput,
|
|
||||||
Message,
|
|
||||||
OpenAIClientConfig,
|
|
||||||
Tool,
|
|
||||||
} from './types'
|
|
||||||
import { lenientParseMacroToolCall, modelPatch, zodToOpenAITool } from './utils'
|
import { lenientParseMacroToolCall, modelPatch, zodToOpenAITool } from './utils'
|
||||||
|
|
||||||
export class OpenAIClient implements LLMClient {
|
export class OpenAIClient implements LLMClient {
|
||||||
config: OpenAIClientConfig
|
config: LLMConfig
|
||||||
|
|
||||||
constructor(config: OpenAIClientConfig) {
|
constructor(config: LLMConfig) {
|
||||||
this.config = config
|
this.config = config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,19 +65,7 @@ export interface InvokeResult<TResult = unknown> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OpenAI Client config
|
* LLM configuration
|
||||||
*/
|
|
||||||
export interface OpenAIClientConfig {
|
|
||||||
model: string
|
|
||||||
apiKey: string
|
|
||||||
baseURL: string
|
|
||||||
temperature?: number
|
|
||||||
maxTokens?: number
|
|
||||||
maxRetries?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* LLM configuration for PageAgent
|
|
||||||
*/
|
*/
|
||||||
export interface LLMConfig {
|
export interface LLMConfig {
|
||||||
baseURL?: string
|
baseURL?: string
|
||||||
|
|||||||
Reference in New Issue
Block a user