From 05d25e211d91e387e48063bb9f2bd9ec60a1a7b0 Mon Sep 17 00:00:00 2001 From: Travis Fischer Date: Fri, 21 Feb 2025 00:37:19 +0700 Subject: [PATCH] feat: remove unused types in @agentic/core --- legacy/packages/core/src/types.ts | 97 +------------------------------ 1 file changed, 2 insertions(+), 95 deletions(-) diff --git a/legacy/packages/core/src/types.ts b/legacy/packages/core/src/types.ts index bb3ecd57..e5a07cac 100644 --- a/legacy/packages/core/src/types.ts +++ b/legacy/packages/core/src/types.ts @@ -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 { AIFunctionSet } from './ai-function-set' import type { AIFunctionsProvider } from './fns' -import type { LegacyMsg, Msg } from './message' +import type { Msg } from './message' export type { Msg } from './message' 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` impl: (params: z.infer | any) => MaybePromise } - -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 - 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 - temperature?: number - top_logprobs?: number - top_p?: number - user?: string -} - -export type LegacyChatParams = Simplify< - Omit & { 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 & { - messages: any[] - response_format?: any - } -> - -/** An OpenAI-compatible chat completions API */ -export type ChatFn = ( - params: Simplify> -) => Promise<{ message: Msg | LegacyMsg }> - -export type AIChainResult = string | Record - -export type AIChain = ( - params?: - | string - | Simplify, 'model'>> -) => Promise - export type SafeParseResult = | { success: true