Skip to content

Commit 422b47d

Browse files
committed
readme and usage
1 parent 12d673e commit 422b47d

File tree

4 files changed

+105
-2
lines changed

4 files changed

+105
-2
lines changed

README.md

Lines changed: 72 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,84 @@ vectorize-iris large-document.pdf \
307307

308308
## Configuration
309309

310-
Set your API credentials:
310+
### CLI Configuration
311311

312+
The CLI offers multiple ways to configure your credentials:
313+
314+
#### Interactive Configuration (Recommended)
315+
316+
The easiest way to get started - opens your browser for authentication:
317+
318+
```bash
319+
vectorize-iris configure
320+
```
321+
322+
**What happens:**
323+
1. Opens your browser to the Vectorize platform
324+
2. Click "Authorize" to grant access
325+
3. Credentials are automatically saved to `~/.vectorize-iris/credentials`
326+
4. Done! You're ready to extract
327+
328+
#### Manual Configuration
329+
330+
If you prefer not to use the browser, prompt for credentials manually:
331+
332+
```bash
333+
vectorize-iris configure --manual
334+
```
335+
336+
You'll be asked to enter:
337+
- API Token
338+
- Organization ID
339+
340+
Get these from [platform.vectorize.io](https://platform.vectorize.io) → Account → Org Settings → Access Tokens
341+
342+
#### Non-Interactive Configuration
343+
344+
For scripts and automation, pass credentials directly:
345+
346+
```bash
347+
vectorize-iris configure --api-token "your-token" --org-id "your-org-id"
348+
```
349+
350+
#### Environment Variables
351+
352+
Alternatively, set credentials via environment variables (works for all clients):
353+
354+
```bash
355+
export VECTORIZE_TOKEN="your-token"
356+
export VECTORIZE_ORG_ID="your-org-id"
357+
```
358+
359+
### Python & Node.js Configuration
360+
361+
For Python and Node.js clients, use environment variables or pass credentials programmatically:
362+
363+
**Environment variables:**
312364
```bash
313365
export VECTORIZE_TOKEN="your-token"
314366
export VECTORIZE_ORG_ID="your-org-id"
315367
```
316368

317-
Get your credentials at [Vectorize Console](https://vectorize.io).
369+
**Python:**
370+
```python
371+
from vectorize_iris import VectorizeIrisClient
372+
373+
client = VectorizeIrisClient(
374+
api_token="your-token",
375+
org_id="your-org-id"
376+
)
377+
```
378+
379+
**Node.js:**
380+
```typescript
381+
import { extractTextFromFile } from '@vectorize-io/iris';
382+
383+
const result = await extractTextFromFile('document.pdf', {
384+
apiToken: 'your-token',
385+
orgId: 'your-org-id'
386+
});
387+
```
318388

319389
## Documentation
320390

nodejs-api/src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export interface StartExtractionResponse {
4141
extractionId: string;
4242
}
4343

44+
export interface UsageInfo {
45+
irisPages: number;
46+
}
47+
4448
export interface ExtractionResultData {
4549
success: boolean;
4650
chunks?: string[];
@@ -49,6 +53,7 @@ export interface ExtractionResultData {
4953
metadataSchema?: string;
5054
chunksMetadata?: (string | null)[]; // JSON strings, may contain nulls
5155
chunksSchema?: (string | null)[]; // May contain nulls
56+
usage?: UsageInfo;
5257
error?: string;
5358
}
5459

python-api/vectorize_iris/models.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,13 @@ class StartExtractionResponse(BaseModel):
6565
extraction_id: str = Field(..., alias="extractionId", description="Unique identifier for the extraction job")
6666

6767

68+
class UsageInfo(BaseModel):
69+
"""Usage information for the extraction"""
70+
model_config = ConfigDict(populate_by_name=True)
71+
72+
iris_pages: int = Field(..., alias="irisPages", description="Number of pages processed by Iris")
73+
74+
6875
class ExtractionResultData(BaseModel):
6976
"""Data contained in extraction result"""
7077
model_config = ConfigDict(populate_by_name=True, extra='allow')
@@ -84,6 +91,7 @@ class ExtractionResultData(BaseModel):
8491
alias="chunksSchema",
8592
description="Schema IDs used for each chunk's metadata"
8693
)
94+
usage: Optional[UsageInfo] = Field(default=None, description="Usage information")
8795
error: Optional[str] = Field(default=None, description="Error message if extraction failed")
8896

8997

rust-cli/src/main.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ enum OutputFormat {
114114

115115
// Request/Response Models
116116

117+
#[derive(Deserialize, Serialize)]
118+
struct UsageInfo {
119+
#[serde(rename = "irisPages")]
120+
iris_pages: u32,
121+
}
122+
117123
#[derive(Serialize)]
118124
struct StartUploadRequest {
119125
name: String,
@@ -179,6 +185,8 @@ struct ExtractionResultData {
179185
#[serde(skip_serializing_if = "Option::is_none", rename = "chunksSchema")]
180186
chunks_schema: Option<Vec<Option<String>>>,
181187
#[serde(skip_serializing_if = "Option::is_none")]
188+
usage: Option<UsageInfo>,
189+
#[serde(skip_serializing_if = "Option::is_none")]
182190
error: Option<String>,
183191
}
184192

@@ -864,6 +872,18 @@ fn format_output(data: &ExtractionResultData, format: &OutputFormat, has_schemas
864872
print_wrapped_text(text, 0);
865873
}
866874

875+
// Show usage information if available
876+
if let Some(usage) = &data.usage {
877+
println!();
878+
println!("{}", style("─".repeat(60)).dim());
879+
println!("{} {}", CHART, style("Usage Information").cyan().bold());
880+
println!();
881+
println!(" {} Iris Pages: {}",
882+
style("📄").dim(),
883+
style(usage.iris_pages).cyan().bold()
884+
);
885+
}
886+
867887
println!();
868888
println!("{}", style("─".repeat(60)).dim());
869889
println!("{} {}", SPARKLE, style("Extraction complete!").green().bold());

0 commit comments

Comments
 (0)