effect-io-ai

Package: @effect/ai
Module: Toolkit

Toolkit.ToolsByName

A utility type which can transforms either a record or an array of tools into a record where keys are tool names and values are the tool instances.

Signature

type ToolsByName<Tools> = Tools extends Record<string, Tool.Any> ?
  { readonly [Name in keyof Tools]: Tools[Name] }
  : Tools extends ReadonlyArray<Tool.Any> ? { readonly [Tool in Tools[number] as Tool["name"]]: Tool }
  : never

Source

Since v1.0.0