Skip to content

Release 0.0.1

Choose a tag to compare

@kamilmysliwiec kamilmysliwiec released this 05 Nov 08:00
· 101 commits to master since this release
f8c8e5a

The first release of @nestjs/ai: language models for Nest applications, built on the AI SDK (ai 7).

  • Models: registered by name in AiModule.forRoot({ models }), from any @ai-sdk/* provider package, and called through AiService. generateText(), generateObject() with a schema, and streamText(). @InjectModel() injects one for your own AI SDK calls.
  • Reliable calls: timeouts, retries that honor retry-after, and fallback models, on @nestjs/resilience policies or presets of your own. Budgets and usage events carry each call's tokens and cost.
  • Agent functions: provider methods with @AgentFunction() are the tools a model may call. Guards, interceptors, pipes and exception filters run on every call, with the execution context type 'ai', and AiExecutionContext reads the call in them. One method can also be an MCP tool, with @nestjs/mcp's @Tool().
  • Streaming: answers stream to the AI SDK's useChat() on Express, Fastify and the Node adapter, with keep-alive comments while a function runs.
  • Durable runs: @nestjs/ai/workflows runs agents on @nestjs/workflows. A run survives restarts, can wait for a person's approval, and gives each function call an idempotency key.
  • Testing: @nestjs/ai/testing's FakeModel answers with text, tool calls, objects or errors, without a network.
  • Auth packages: with @nestjs/authentication 0.1.4 and @nestjs/authorization 0.1.2 or later, their global guard, @CurrentUser() and @Can() policies work on agent function calls.

Docs: https://docs.nestjs.com/ai/overview