|
7 | 7 | --- |
8 | 8 |
|
9 | 9 | Refactor the Effect AI SDK and associated provider packages |
| 10 | + |
| 11 | +This pull request contains a complete refactor of the base Effect AI SDK package |
| 12 | +as well as the associated provider integration packages to improve flexibility |
| 13 | +and enhance ergonomics. Major changes are outlined below. |
| 14 | + |
| 15 | +## Module Names |
| 16 | + |
| 17 | +All modules in the base Effect AI SDK have had the leading `Ai` prefix dropped |
| 18 | +from their name (except for the `AiError` module). |
| 19 | + |
| 20 | +For example, the `AiLanguageModel` module is now the `LanguageModel` module. |
| 21 | + |
| 22 | +In addition, the `AiInput` module has been renamed to the `Prompt` module. |
| 23 | + |
| 24 | +## Prompts |
| 25 | + |
| 26 | +The `Prompt` module has been completely redesigned with flexibility in mind. |
| 27 | + |
| 28 | +The `Prompt` module's primary `make` constructor, which is used by the methods on |
| 29 | +`LanguageModel`, now supports defining a prompt as an array of content parts, |
| 30 | +which should be familiar to those coming from other AI SDKs. |
| 31 | + |
| 32 | +In addition, the `system` option has been removed from all `LanguageModel` methods |
| 33 | +and must now be provided as part of the prompt. |
| 34 | + |
| 35 | +## Responses |
| 36 | + |
| 37 | +The `Response` module has also been completely redesigned to support a wider |
| 38 | +variety of response parts, particularly when streaming. |
| 39 | + |
| 40 | +The methods of `LanguageModel` no longer return different response types based |
| 41 | +upon whether or not a `Toolkit` was included in the request. Instead, the type |
| 42 | +of tool call parameters and tool call results is directly encoded into the |
| 43 | +response parts. |
| 44 | + |
| 45 | +In addition, when streaming text via the `LanguageModel.streamText` method, you |
| 46 | +now receive a stream of content parts instead of a stream of responses. |
| 47 | + |
| 48 | +## Tool Calls |
| 49 | + |
| 50 | +The `Tool` module has been enhanced to support provider-defined tools (e.g. |
| 51 | +web search, computer use, etc.). |
| 52 | + |
| 53 | +Large language model providers which support their own tools now have a separate |
| 54 | +module present in their provider integration packages which contain definitions |
| 55 | +for their tools. |
| 56 | + |
| 57 | +For example, the new `AnthropicTool` module in the `@effect/ai-anthropic` provider |
| 58 | +integration package contains provider-defined tool definitions for web search, |
| 59 | +computer use, code execution, and more. |
| 60 | + |
| 61 | +These provider-defined tools can be included alongside user-defined tools in |
| 62 | +existing `Toolkit`s. Provider-defined tools that require a user-space handler |
| 63 | +will be raise a type error in the associated `Toolkit` layer if no such handler |
| 64 | +is defined. |
| 65 | + |
| 66 | +## Provider Options / Provider Metadata |
| 67 | + |
| 68 | +To support provider-specific inputs and outputs when interacting with large |
| 69 | +language model providers, support has been added for adding provider-specific |
| 70 | +options to the parts of a `Prompt`, as well as receiving provider-specific |
| 71 | +metadata from the parts of a `Response`. |
0 commit comments