Skip to content

Getting started with the Python SDK

Installation

The latest version requires Python 3.11.11

  1. Install the Forra SDK using uv:
    uv pip install forrasdk
    

Setup

Replicate this on your local machine

When developing locally, the SDK looks for a forra_context.json file in the directory where you run your script and loads the JSON in the context.

{
    "FORRA_API_URL": "...",
    "FORRA_API_ACCESS_TOKEN": "...",
}

Usage

from forrasdk import ForraAPI

# The SDK will automatically load configuration from forra_context.json
forra_api = ForraAPI()

response = forra_api.chat.completion("Hello world")
print(response.messages[-1].content)

Links: