Skip to content

Commit 638a5a1

Browse files
committed
chore: update README.md
1 parent a0a0c75 commit 638a5a1

2 files changed

Lines changed: 50 additions & 85 deletions

File tree

‎LICENSE‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2026 Interfaze
3+
Copyright (c) 2026 JigsawStack
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎README.md‎

Lines changed: 49 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,61 @@
11
# interfaze
22

3-
The official [Interfaze](https://interfaze.ai) SDK for Python — a thin, typed wrapper over the
4-
OpenAI SDK. Same `chat.completions` surface, plus typed access to everything Interfaze adds
5-
(`precontext`, `reasoning`, `vcache`, `task`/`guard` helpers). Sync and async.
3+
The official [Interfaze](https://interfaze.ai) SDK for Python.
4+
5+
- **Familiar chat surface** - `chat.completions`, streaming, tools, and structured output.
6+
- **Typed Interfaze extras** - `precontext` (internal tool output), `reasoning`, and `vcache` (semantic-cache hit) on every response.
7+
- **One-line task helpers** - OCR, web search, scraping, speech-to-text, translation, object/GUI detection, forecasting.
8+
- **Multimodal inputs** - images, PDFs, audio, video, and CSV, by URL or base64.
9+
- **Sync and async**, fully typed.
10+
11+
## Learn more
12+
13+
- [interfaze.ai](https://interfaze.ai) - dashboard and API keys.
14+
- [TypeScript / JavaScript SDK](https://github.com/InterfazeAI/interfaze-js).
15+
16+
## Capabilities
17+
18+
| Category | Capabilities |
19+
| ---------------- | ----------------------------------------------------------- |
20+
| **Chat & text** | Chat completions, structured output, tools, reasoning |
21+
| **Vision & OCR** | `tasks.ocr` - text and structured data from images and PDFs |
22+
| **Web** | `tasks.web_search`, `tasks.scrape` |
23+
| **Audio** | `tasks.transcribe` - speech-to-text |
24+
| **Detection** | `tasks.object_detection`, `tasks.gui_detection` |
25+
| **Translation** | `tasks.translate` |
26+
| **Forecasting** | `tasks.forecast` - time-series prediction |
627

728
## Install
829

930
```bash
1031
pip install interfaze
11-
export INTERFAZE_API_KEY="sk_..."
1232
```
1333

14-
## Quickstart
34+
## Setup
35+
36+
Get an API key from the [Interfaze dashboard](https://interfaze.ai), then:
1537

1638
```python
1739
from interfaze import Interfaze
1840

19-
interfaze = Interfaze() # reads INTERFAZE_API_KEY
41+
interfaze = Interfaze(api_key="sk_...") # or set INTERFAZE_API_KEY and call Interfaze()
42+
```
2043

44+
Async is identical via `AsyncInterfaze` (every call becomes `await`-able).
45+
46+
## Usage
47+
48+
Chat completion:
49+
50+
```python
2151
res = interfaze.chat.completions.create(
2252
messages=[{"role": "user", "content": "Write a haiku about deterministic AI."}],
2353
)
2454
print(res.choices[0].message.content)
2555
print("cache hit:", res.vcache) # typed Interfaze extra
2656
```
2757

28-
Async:
29-
30-
```python
31-
from interfaze import AsyncInterfaze
32-
33-
interfaze = AsyncInterfaze()
34-
res = await interfaze.chat.completions.create(messages=[{"role": "user", "content": "Hello"}])
35-
```
36-
37-
## Task helpers
58+
Task helpers - each returns the extracted result directly (a `dict`/`list`/`str`, not a completion):
3859

3960
```python
4061
interfaze.tasks.ocr("https://example.com/receipt.jpg")
@@ -47,21 +68,7 @@ interfaze.tasks.gui_detection("https://example.com/screenshot.png")
4768
interfaze.tasks.forecast("https://example.com/series.csv", periods=30)
4869
```
4970

50-
Or force a task on a raw completion:
51-
52-
```python
53-
from interfaze import inputs
54-
55-
res = interfaze.chat.completions.create(
56-
task="ocr",
57-
messages=[{"role": "user", "content": [
58-
{"type": "text", "text": "Extract the total"},
59-
inputs.file("https://example.com/receipt.jpg"),
60-
]}],
61-
)
62-
```
63-
64-
## Structured output
71+
Structured output:
6572

6673
```python
6774
from interfaze import response_format
@@ -76,10 +83,8 @@ res = interfaze.chat.completions.create(
7683
)
7784
```
7885

79-
## Streaming
80-
81-
`.stream()` yields OpenAI-style events (`content.delta`, `content.done`, tool-call events, …) with
82-
Interfaze's inline `<think>`/`<precontext>` side-channels stripped from the content events:
86+
Streaming - `.stream()` yields typed events, with the inline `<think>`/`<precontext>` side-channels
87+
stripped from the content events:
8388

8489
```python
8590
stream = interfaze.chat.completions.stream(
@@ -89,11 +94,10 @@ for event in stream:
8994
if event.type == "content.delta":
9095
print(event.delta, end="")
9196
final = stream.get_final_completion()
92-
print(final.reasoning, final.precontext)
9397
```
9498

95-
> Just want clean tokens? `stream.text_deltas()` yields visible text only. Plain
96-
> `create(stream=True)` returns the raw chunk iterator (side-channel tags **not** stripped).
99+
> `stream.text_deltas()` yields clean visible text only; `create(stream=True)` returns the raw
100+
> chunk iterator (side-channel tags not stripped).
97101
98102
## Inputs
99103

@@ -107,69 +111,30 @@ inputs.data_url(raw_bytes, "image/png") # base64 data URI
107111
inputs.from_path("./doc.pdf") # read a local file
108112
```
109113

110-
URLs and base64 work; raw `bytes` do **not** (must be base64-encoded — this SDK does it for you via
111-
`data_url`/`from_path`). `image/gif` and `image/avif` are rejected client-side.
114+
URLs and base64 both work; `image/gif` and `image/avif` are rejected client-side.
112115

113116
## Interfaze extras
114117

115-
- `res.precontext` — raw outputs of internal tools that ran (OCR/web/scrape/STT/forecast/…).
116-
- `res.reasoning` — reasoning text (with `reasoning_effort="high"` and no schema).
117-
- `res.vcache` — whether the semantic cache was hit.
118-
- `reasoning_effort` accepts `"on"`/`"off"`/`"auto"` in addition to `minimal|low|medium|high`.
118+
- `res.precontext` - raw outputs of any internal tools that ran (OCR/web/scrape/STT/forecast/…).
119+
- `res.reasoning` - reasoning text (with `reasoning_effort="high"` and no schema).
120+
- `res.vcache` - whether the semantic cache was hit.
121+
- `reasoning_effort` also accepts `"on"`/`"off"`/`"auto"`.
119122
- Guardrails: `create(guard=["S1", "S12_IMAGE"], …)`.
120123
- Control options: `Interfaze(show_additional_info=..., bypass_moe=..., bypass_cache=..., admin_key=...)`.
121-
- Custom params: pass `extra_body={...}` / `extra_headers={...}` straight through to the request.
122124

123125
## LangChain
124126

125-
`pip install interfaze[langchain]` adds a chat model that points at Interfaze and surfaces the
126-
extras the stock `ChatOpenAI` drops:
127+
`pip install interfaze[langchain]` adds a chat model pointed at Interfaze that keeps the extras a stock `ChatOpenAI` drops:
127128

128129
```python
129130
from interfaze.langchain import ChatInterfaze
130131

131132
llm = ChatInterfaze() # reads INTERFAZE_API_KEY
132133
res = llm.invoke("Summarize the latest AI news")
133-
print(res.content)
134134
print(res.response_metadata.get("precontext"), res.response_metadata.get("vcache"))
135135
```
136136

137-
`precontext`/`reasoning`/`vcache` land on `response_metadata`; `{"type": "video", ...}` content
138-
blocks are accepted; inline `<think>`/`<precontext>` tags are stripped. Send request-side
139-
precontext with `ChatInterfaze(precontext=[...])`.
140-
141-
## Good to know
142-
143-
- Interfaze implements `chat.completions` and `models`; other OpenAI endpoints are not exposed.
144-
- `temperature` ≤ 1, `max_tokens` ≤ 32000, `top_p` ≤ 1 (above → 400). Both `max_tokens` and
145-
`max_completion_tokens` bound output (`max_tokens` wins if both are set).
146-
- `n`, `seed`, `stop`, penalties, `logprobs`, `tool_choice`, `top_k` are ignored by Interfaze.
147-
- Requests default to a 900s timeout (large OCR/document/vision jobs are slow); override with
148-
`Interfaze(timeout=...)`.
149-
- For very large/long documents, **stream** (`.stream()` / `create(stream=True)`): streamed
150-
connections are kept alive server-side, whereas a long buffered request can be dropped by an
151-
intermediary mid-job.
152-
- The underlying OpenAI client is available at `interfaze.openai`.
153-
154-
## Compatibility notes
155-
156-
Drop-in for the OpenAI **chat completions** flow (`create`, response types, errors,
157-
`create(stream=True)`, `models`), with a few behaviors worth knowing when migrating:
158-
159-
- **`.stream()` yields OpenAI-style events**, drop-in with OpenAI's streaming helper — iterate
160-
`event.type` (`"content.delta"` with `.delta`, `"content.done"`,
161-
`"tool_calls.function.arguments.delta"`/`.done`, …), same as `client.chat.completions.stream()`
162-
on the OpenAI SDK. `create(stream=True)` still gives the raw `ChatCompletionChunk` iterator, and
163-
`stream.text_deltas()` gives just the clean visible text if you don't need events.
164-
- **Returned text is lightly post-processed.** `json_object` content is unwrapped from its
165-
```` ```json ```` fence, and streamed `<think>`/`<precontext>` side-channels are pulled into
166-
`reasoning`/`precontext`, so `message.content` may not be byte-identical to the raw wire response.
167-
- **`inputs.*` accept https URLs** (Interfaze fetches them server-side). Those parts are valid for
168-
Interfaze but **not** portable to OpenAI/Azure, which require base64 in `file`/`input_audio` parts.
169-
- **Escape hatch:** anything not on the wrapper — `chat.completions.parse()`, `.with_raw_response`,
170-
`.with_streaming_response` — is on the underlying client at `interfaze.openai`.
171-
- **`tasks.*` return the extracted result** (a `dict`/`list`/`str`), not a `ChatCompletion` — e.g.
172-
`tasks.ocr(...)` returns the OCR dict directly.
137+
`precontext`/`reasoning`/`vcache` land on `response_metadata`, `{"type": "video", ...}` content blocks are accepted, and inline side-channel tags are stripped.
173138

174139
## License
175140

0 commit comments

Comments
 (0)