Skip to main content Link Search Menu Expand Document (external link)

OpenAiTool.ts overview

Since v1.0.0


Exports Grouped by Category


Tools

CodeInterpreter

Signature

declare const CodeInterpreter: (args: {
  readonly container: string | { readonly type: "auto"; readonly file_ids?: ReadonlyArray<string> | undefined }
}) => Tool.ProviderDefined<
  "OpenAiCodeInterpreter",
  {
    readonly args: Schema.Struct<{
      container: Schema.Union<
        [
          typeof Schema.String,
          Schema.Struct<{
            type: Schema.Literal<["auto"]>
            file_ids: Schema.optional<Schema.Array$<typeof Schema.String>>
          }>
        ]
      >
    }>
    readonly parameters: Schema.Struct<{
      code: Schema.NullOr<typeof Schema.String>
      container_id: typeof Schema.String
    }>
    readonly success: Schema.NullOr<
      Schema.Array$<
        Schema.Union<[typeof Generated.CodeInterpreterOutputLogs, typeof Generated.CodeInterpreterOutputImage]>
      >
    >
    readonly failure: typeof Schema.Never
  },
  false
>

Source

Since v1.0.0

FileSearch

Signature

declare const FileSearch: (args: {
  readonly vector_store_ids: ReadonlyArray<string>
  readonly max_num_results?: number | null | undefined
  readonly ranking_options?:
    | {
        readonly ranker?: "auto" | "default-2024-11-15" | null | undefined
        readonly score_threshold?: number | null | undefined
      }
    | null
    | undefined
  readonly filters?:
    | {
        readonly key: string
        readonly value: string | number | boolean
        readonly type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte"
      }
    | {
        readonly type: "and" | "or"
        readonly filters: ReadonlyArray<{
          readonly key: string
          readonly value: string | number | boolean
          readonly type: "eq" | "ne" | "gt" | "gte" | "lt" | "lte"
        }>
      }
    | null
    | undefined
}) => Tool.ProviderDefined<
  "OpenAiFileSearch",
  {
    readonly args: Schema.Struct<{
      readonly vector_store_ids: Schema.Array$<typeof Schema.String>
      readonly max_num_results: Schema.optionalWith<typeof Schema.Int, { nullable: true }>
      readonly ranking_options: Schema.optionalWith<typeof Generated.RankingOptions, { nullable: true }>
      readonly filters: Schema.optionalWith<typeof Generated.Filters, { nullable: true }>
    }>
    readonly parameters: Schema.Struct<{}>
    readonly success: Schema.SchemaClass<
      {
        readonly status: "in_progress" | "searching" | "completed" | "incomplete" | "failed"
        readonly queries: ReadonlyArray<string>
        readonly results?:
          | ReadonlyArray<{
              readonly file_id?: string | undefined
              readonly text?: string | undefined
              readonly filename?: string | undefined
              readonly attributes?: { readonly [x: string]: unknown } | undefined
              readonly score?: number | undefined
            }>
          | undefined
      },
      {
        readonly status: "in_progress" | "searching" | "completed" | "incomplete" | "failed"
        readonly queries: ReadonlyArray<string>
        readonly results?:
          | ReadonlyArray<{
              readonly file_id?: string | null | undefined
              readonly text?: string | null | undefined
              readonly filename?: string | null | undefined
              readonly attributes?: { readonly [x: string]: unknown } | null | undefined
              readonly score?: number | null | undefined
            }>
          | null
          | undefined
      },
      never
    >
    readonly failure: typeof Schema.Never
  },
  false
>

Source

Since v1.0.0

WebSearch

Signature

declare const WebSearch: (args: {
  readonly filters?: { readonly allowed_domains?: ReadonlyArray<string> | null | undefined } | null | undefined
  readonly user_location?:
    | {
        readonly type?: "approximate" | null | undefined
        readonly country?: string | null | undefined
        readonly region?: string | null | undefined
        readonly city?: string | null | undefined
        readonly timezone?: string | null | undefined
      }
    | null
    | undefined
  readonly search_context_size?: "low" | "medium" | "high" | null | undefined
}) => Tool.ProviderDefined<
  "OpenAiWebSearch",
  {
    readonly args: Schema.Struct<{
      readonly filters: Schema.optionalWith<
        Schema.Struct<{
          allowed_domains: Schema.optionalWith<
            Schema.Array$<typeof Schema.String>,
            { nullable: true; default: () => readonly [] }
          >
        }>,
        { nullable: true }
      >
      readonly user_location: Schema.optionalWith<typeof Generated.WebSearchApproximateLocation, { nullable: true }>
      readonly search_context_size: Schema.optionalWith<
        typeof Generated.WebSearchToolSearchContextSize,
        { nullable: true; default: () => "medium" }
      >
    }>
    readonly parameters: Schema.Struct<{
      action: Schema.Union<
        [
          typeof Generated.WebSearchActionSearch,
          typeof Generated.WebSearchActionOpenPage,
          typeof Generated.WebSearchActionFind
        ]
      >
    }>
    readonly success: Schema.Struct<{ status: typeof Generated.WebSearchToolCallStatus }>
    readonly failure: typeof Schema.Never
  },
  false
>

Source

Since v1.0.0

WebSearchPreview

Signature

declare const WebSearchPreview: (args: {
  readonly user_location?:
    | {
        readonly type: "approximate"
        readonly country?: string | null | undefined
        readonly region?: string | null | undefined
        readonly city?: string | null | undefined
        readonly timezone?: string | null | undefined
      }
    | null
    | undefined
  readonly search_context_size?: "low" | "medium" | "high" | null | undefined
}) => Tool.ProviderDefined<
  "OpenAiWebSearchPreview",
  {
    readonly args: Schema.Struct<{
      readonly user_location: Schema.optionalWith<typeof Generated.ApproximateLocation, { nullable: true }>
      readonly search_context_size: Schema.optionalWith<
        typeof Generated.WebSearchPreviewToolSearchContextSize,
        { nullable: true }
      >
    }>
    readonly parameters: Schema.Struct<{
      action: Schema.Union<
        [
          typeof Generated.WebSearchActionSearch,
          typeof Generated.WebSearchActionOpenPage,
          typeof Generated.WebSearchActionFind
        ]
      >
    }>
    readonly success: Schema.Struct<{ status: typeof Generated.WebSearchToolCallStatus }>
    readonly failure: typeof Schema.Never
  },
  false
>

Source

Since v1.0.0