feat: remove unused types in @agentic/core

pull/689/head
Travis Fischer 2025-02-21 00:37:19 +07:00
rodzic f36dcaa5a0
commit ece4de12c4
1 zmienionych plików z 2 dodań i 95 usunięć

Wyświetl plik

@ -1,9 +1,9 @@
import type { Jsonifiable, SetOptional, Simplify } from 'type-fest' import type { Jsonifiable } from 'type-fest'
import type { z } from 'zod' import type { z } from 'zod'
import type { AIFunctionSet } from './ai-function-set' import type { AIFunctionSet } from './ai-function-set'
import type { AIFunctionsProvider } from './fns' import type { AIFunctionsProvider } from './fns'
import type { LegacyMsg, Msg } from './message' import type { Msg } from './message'
export type { Msg } from './message' export type { Msg } from './message'
export type { Schema } from './schema' export type { Schema } from './schema'
@ -91,99 +91,6 @@ export interface AIFunction<
// TODO: this `any` shouldn't be necessary, but it is for `createAIFunction` results to be assignable to `AIFunctionLike` // TODO: this `any` shouldn't be necessary, but it is for `createAIFunction` results to be assignable to `AIFunctionLike`
impl: (params: z.infer<InputSchema> | any) => MaybePromise<Output> impl: (params: z.infer<InputSchema> | any) => MaybePromise<Output>
} }
export interface ChatParams {
messages: Msg[]
model: string & {}
functions?: AIFunctionSpec[]
function_call?: 'none' | 'auto' | { name: string }
tools?: AIToolSpec[]
tool_choice?:
| 'none'
| 'auto'
| 'required'
| { type: 'function'; function: { name: string } }
parallel_tool_calls?: boolean
logit_bias?: Record<string, number>
logprobs?: boolean
max_tokens?: number
presence_penalty?: number
frequency_penalty?: number
response_format?:
| {
type: 'text'
}
| {
type: 'json_object'
}
| {
type: 'json_schema'
json_schema: ResponseFormatJSONSchema
}
seed?: number
stop?: string | null | Array<string>
temperature?: number
top_logprobs?: number
top_p?: number
user?: string
}
export type LegacyChatParams = Simplify<
Omit<ChatParams, 'messages'> & { messages: LegacyMsg[] }
>
export interface ResponseFormatJSONSchema {
/**
* The name of the response format. Must be a-z, A-Z, 0-9, or contain
* underscores and dashes, with a maximum length of 64.
*/
name: string
/**
* A description of what the response format is for, used by the model to
* determine how to respond in the format.
*/
description?: string
/**
* The schema for the response format, described as a JSON Schema object.
*/
schema?: JSONSchema
/**
* Whether to enable strict schema adherence when generating the output. If
* set to true, the model will always follow the exact schema defined in the
* `schema` field. Only a subset of JSON Schema is supported when `strict`
* is `true`. Currently only supported by OpenAI's
* [Structured Outputs](https://platform.openai.com/docs/guides/structured-outputs).
*/
strict?: boolean
}
/**
* OpenAI has changed some of their types, so instead of trying to support all
* possible types, for these params, just relax them for now.
*/
export type RelaxedChatParams = Simplify<
Omit<ChatParams, 'messages' | 'response_format'> & {
messages: any[]
response_format?: any
}
>
/** An OpenAI-compatible chat completions API */
export type ChatFn = (
params: Simplify<SetOptional<RelaxedChatParams, 'model'>>
) => Promise<{ message: Msg | LegacyMsg }>
export type AIChainResult = string | Record<string, any>
export type AIChain<Result extends AIChainResult = string> = (
params?:
| string
| Simplify<SetOptional<Omit<ChatParams, 'tools' | 'functions'>, 'model'>>
) => Promise<Result>
export type SafeParseResult<TData> = export type SafeParseResult<TData> =
| { | {
success: true success: true