Home
The Python AI SDK is heavily inspired (ie. a port) of the awesome AI SDK built by Vercel .
I have been a big fan of the Vercel AI SDK and have always wanted to use it as part of my Python projects and decided to recreate it in Python.
If you have any feedback or feature requests, just reach out on Github .
Getting started
To get started, simply follow the steps:
Install the package
You can install the Python AI SDK using pip:
pip install ai-sdk-py
Making your first LLM call
Once the package is installed, you can make your first LLM call using the generate_text
function:
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)
Adding tracing
The Python AI SDK supports tracing which means you can save all your LLM calls for future analysis.
For this, the AI SDK relies on the Opik library. To get started, the only thing you need to do is configure the Opik library:
opik.configure()
Last updated on