Overview
The AI SDK was heavily inspired by the AI SDK built by the Vercel team. This SDK is a partial port of that JavaScript SDK to Python.
Installation
pip install ai-sdk-py
Usage
The AI SDK is designed to make it easy to work with different AI providers whether that is to generate text
or structured outputs. All you need to do is import the library and call the generate_text
function to get
started:
from ai_sdk import generate_text
from ai_sdk.openai import openai
response = generate_text(
model=openai("gpt-4o"),
prompt="Hello, world!"
)
print(response.text)
You can learn more about using the AI SDK in our guides:
You can also find a full list of all the providers we support in the Providers section.
If you would like us to support a new provider, please reach out to us on Github .
Last updated on