How to use
Before you start, ensure you’ve already obtained theFRIENDLI_TOKEN
from the Friendli Suite.
Instantiation
Instantiate your models using a Friendli provider instance. We provide usage examples for each type of endpoint. Choose the one that best suits your needs:Example: Generating text
Generate a response with thegenerateText
function:
Example: Using Enforcing Patterns (Regex)
Specify a specific pattern (e.g., CSV), character sets, or specific language characters (e.g., Korean Hangul characters) for your LLM’s output.Example: Using built-in tools
This feature is in Beta and available only on the Serverless Endpoints.
OpenAI Compatibility
You can also use@ai-sdk/openai
as the APIs are OpenAI-compatible.