Standalone Python SDK for the ForkTex Intelligence API — chat, agent runs, embeddings, retrieval, ecosystem indexing
Project description
forktex-intelligence
Standalone Python SDK for the ForkTex Intelligence API.
forktex-intelligence is the high-level Python client for the ForkTex Intelligence platform: multi-provider LLM chat (streaming + structured), embeddings, vector search, content extraction (PDF / DOCX / HTML), and image / audio generation. It backs the forktex intelligence ask / run / scrape CLI commands and is also usable directly from any Python application.
Install
pip install forktex-intelligence
Requires Python 3.12+. Tested on 3.12, 3.13, 3.14.
Quick Start
Single-shot prompt
from forktex_intelligence import Intelligence
async with Intelligence(endpoint="https://intelligence.forktex.com/api", api_key="sk-...") as ai:
response = await ai.chat("Summarize the ForkTex stack in one sentence.")
print(response.text)
Structured response (Pydantic schema)
from pydantic import BaseModel
from forktex_intelligence import Intelligence
class Summary(BaseModel):
title: str
bullets: list[str]
async with Intelligence(endpoint="...", api_key="...") as ai:
result = await ai.extract_structured(
prompt="Summarize the ForkTex stack.",
schema=Summary,
)
print(result.parsed.title, result.parsed.bullets)
Streaming
from forktex_intelligence import Intelligence
async with Intelligence(endpoint="...", api_key="...") as ai:
async for chunk in ai.stream("Tell me a story."):
print(chunk, end="", flush=True)
Configuration
Pass endpoint and API key explicitly:
Intelligence(endpoint="https://intelligence.forktex.com/api", api_key="sk-...")
Or via an IntelligenceSettings object:
from forktex_intelligence import IntelligenceSettings, Intelligence
settings = IntelligenceSettings(endpoint="...", api_key="...")
async with Intelligence(settings=settings) as ai:
...
When used via the forktex CLI, settings are loaded from environment variables and .forktex/ config files automatically.
| Variable | Description | Default |
|---|---|---|
FORKTEX_INTELLIGENCE_ENDPOINT |
Intelligence API endpoint | https://intelligence.forktex.com/api |
FORKTEX_INTELLIGENCE_API_KEY |
Intelligence API key | (required) |
Local dev (point at your make local stack)
export FORKTEX_INTELLIGENCE_ENDPOINT=http://localhost:8001/api
export FORKTEX_INTELLIGENCE_API_KEY=dev-key
Or programmatically:
from forktex_intelligence import Intelligence
intel = Intelligence(endpoint="http://localhost:8001/api", api_key="dev-key")
What's in the package
| Module | Purpose |
|---|---|
forktex_intelligence.api |
High-level Intelligence client (chat, structured, stream) |
forktex_intelligence.client |
Low-level ForktexIntelligenceClient (raw HTTP, advanced use) |
forktex_intelligence.client.generated |
Wire-level Pydantic models (ChatMessage, ChatResponse, …) generated from the OpenAPI spec |
forktex_intelligence.streams |
SSE event types and parser |
forktex_intelligence.config |
IntelligenceSettings — endpoint, API key |
All response models come from the OpenAPI codegen pipeline — one source of truth shared between the server and every consumer.
Repository
This SDK lives inside the forktex/intelligence monorepo alongside the API server (api/). The SDK package is independently versioned and published to PyPI.
Development
The Makefile is generated by forktex fsd makefile sync from forktex.json — do not hand-edit.
make help # list every available target
make deps # editable install with the dev group
make format # ruff format
make lint # ruff check
make test # pytest tests/
make codegen-check # verify the generated client imports cleanly
make build # python3 -m build → dist/
make ci # format-check + lint + license-check + audit + test + build
make clean # remove caches and dist/
make ci is the single command that gates a publish: format-check, lint, dual-license header check, dependency CVE audit, full test suite, and python -m build + twine check.
License headers
Every source file carries the AGPL-3.0 + Commercial dual-license SPDX header, applied idempotently via:
make license-check # CI gate — fails if any source file is missing the header
make license-fix # add or refresh headers across src/, tests/, scripts/
make license-strip # remove headers (used before license-model changes)
License
Dual-licensed — AGPL-3.0-or-later for open-source use, commercial for everything else (proprietary products, SaaS without source release, redistribution in closed-source form). See LICENSE and NOTICE for the full terms.
Commercial licensing inquiries: info@forktex.com.
The 1.0.0 release on PyPI remains under MIT; from 0.2.3 onwards the package ships AGPL-3.0+Commercial.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file forktex_intelligence-0.2.3.tar.gz.
File metadata
- Download URL: forktex_intelligence-0.2.3.tar.gz
- Upload date:
- Size: 18.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4bd9500535ce9f12ff1aba03c66767f4238ad75ecdac60464d80dbb25d5447f3
|
|
| MD5 |
32be65f1df9a62b72109c5b4247d886c
|
|
| BLAKE2b-256 |
00bc842843303f2e7ead3142ecfdaf820d9edb1136ae86436c35ec6216d5a1fa
|
File details
Details for the file forktex_intelligence-0.2.3-py3-none-any.whl.
File metadata
- Download URL: forktex_intelligence-0.2.3-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d6e650b445d0502a9e60e913d16b8d517c78c348d7b270dc4191450ad0e903d2
|
|
| MD5 |
4b353e8211de9b1ad9028ca5360d35ab
|
|
| BLAKE2b-256 |
611f94ba8b3de9297843d125b459ad4bdc681eb62b213981015aea337378d02b
|