Usage
TS Tool Usage
Agentic clients like WeatherClient
can be used as normal TS classes:
LLM Tool Usage
Or you can use these clients as LLM-based tools where the LLM decides when and how to invoke the underlying functions for you.
This works across all of the major AI SDKs via adapters. Here’s an example using Vercel’s AI SDK:
You can use our standard library of thoroughly tested AI functions with your favorite AI SDK – without having to write any glue code!
Multiple Tool Usage via AIFunctionLike
Here’s a slightly more complex example which uses multiple clients and selects a subset of their functions using the AIFunctionSet.pick
method:
Here we’ve exposed 2 functions to the LLM, search_news_stories
(which comes from the PerigonClient.searchStories
method) and serper_google_search
(which implicitly comes from the SerperClient.search
method).
All of the SDK adapters like createDexterFunctions
accept very flexible AIFunctionLike
objects, which include:
AIFunctionSet
- Sets of AI functions (likeperigon.functions.pick('search_news_stories')
orperigon.functions
orserper.functions
)AIFunctionsProvider
- Client classes which expose anAIFunctionSet
via the.functions
property (likeperigon
orserper
)AIFunction
- Individual functions (likeperigon.functions.get('search_news_stories')
orserper.functions.get('serper_google_search')
or AI functions created directly via thecreateAIFunction
utility function)
You can pass as many of these AIFunctionLike
objects as you’d like and you can manipulate them as AIFunctionSet
sets via .pick
, .omit
, .get
, .map
, etc.