Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,59 @@ This repo contains the example notebooks listed below. You can launch them in a
* [Ranking Model - Monitoring](https://github.com/fiddler-labs/fiddler-examples/blob/main/quickstart/latest/Fiddler_Quickstart_Ranking_Model.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/fiddler-labs/fiddler-examples/blob/main/quickstart/latest/Fiddler_Quickstart_Ranking_Model.ipynb)
* [Regression Model - Monitoring](https://github.com/fiddler-labs/fiddler-examples/blob/main/quickstart/latest/Fiddler_Quickstart_Regression_Model.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/fiddler-labs/fiddler-examples/blob/main/quickstart/latest/Fiddler_Quickstart_Regression_Model.ipynb)

## REST API Examples

The [`api-examples`](./api-examples) directory contains validation notebooks and reference implementations for working with the Fiddler REST API. These examples are ideal for language-agnostic integration and production deployments.

### Event Publishing

* **[Python Publishing Examples](https://github.com/fiddler-labs/fiddler-examples/blob/main/api-examples/publishing/python/validate-rest-api-examples.ipynb)** - Comprehensive REST API usage in Python
* Batch publishing (file upload + publish with Job tracking)
* Streaming publishing (direct events with queue submission)
* Event updates (PATCH operations)
* Production-ready publisher with exponential backoff retry logic

* **[TypeScript Publishing Examples](https://github.com/fiddler-labs/fiddler-examples/blob/main/api-examples/publishing/typescript/validate-typescript-rest-api-example.nnb)** - TypeScript REST API patterns
* Native `fetch` API implementation
* Type-safe interfaces for Fiddler API v3.0
* Production-ready publisher class with retry logic
* Comprehensive error handling

**Key Concepts:**
- Fiddler automatically selects processing mode based on data source (files → batch with Job tracking, JSON/lists → streaming with queue submission)
- Only PRODUCTION events can be updated (PRE_PRODUCTION events are immutable)
- All operations return HTTP 202 Accepted for consistency

See the [api-examples README](./api-examples/README.md) for setup instructions and additional details.



## REST API Examples

The [`api-examples`](./api-examples) directory contains validation notebooks and reference implementations for working with the Fiddler REST API. These examples are ideal for language-agnostic integration and production deployments.

### Event Publishing

* **[Python Publishing Examples](https://github.com/fiddler-labs/fiddler-examples/blob/main/api-examples/publishing/python/validate-rest-api-examples.ipynb)** - Comprehensive REST API usage in Python
* Batch publishing (file upload + publish with Job tracking)
* Streaming publishing (direct events with queue submission)
* Event updates (PATCH operations)
* Production-ready publisher with exponential backoff retry logic

* **[TypeScript Publishing Examples](https://github.com/fiddler-labs/fiddler-examples/blob/main/api-examples/publishing/typescript/validate-typescript-rest-api-example.nnb)** - TypeScript REST API patterns
* Native `fetch` API implementation
* Type-safe interfaces for Fiddler API v3.0
* Production-ready publisher class with retry logic
* Comprehensive error handling

**Key Concepts:**
- Fiddler automatically selects processing mode based on data source (files → batch with Job tracking, JSON/lists → streaming with queue submission)
- Only PRODUCTION events can be updated (PRE_PRODUCTION events are immutable)
- All operations return HTTP 202 Accepted for consistency

See the [api-examples README](./api-examples/README.md) for setup instructions and additional details.


## Fiddler Utils Package - Admin Automation Library

The [`fiddler_utils`](./fiddler_utils) package is an admin automation library designed to reduce code duplication across utility scripts and notebooks. While **not part of the official Fiddler SDK**, it is available for both Fiddler field engineers and customers to use and extend.
Expand Down
62 changes: 62 additions & 0 deletions api-examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Fiddler REST API Examples

This directory contains examples and validation notebooks for working with the Fiddler REST API.

## Directory Structure

- **publishing/** - Event publishing examples (batch, streaming, updates)
- `python/` - Python REST API examples using `requests` library
- `typescript/` - TypeScript REST API examples using native `fetch`

## About These Examples

These notebooks serve dual purposes:

1. **Validation** - Test and validate code examples from the official Fiddler documentation
2. **Reference** - Provide production-ready example code for REST API integration

Unlike the quick start guides in `/quickstart/`, these examples focus on:
- REST API usage patterns and best practices
- Language-agnostic integration (not requiring the Python SDK)
- Production-ready error handling and retry logic
- Comprehensive coverage of API operations

## Prerequisites

### Python Examples
```bash
pip install requests ipykernel
```

### TypeScript Examples
For TypeScript notebooks, install the tslab kernel:
```bash
npm install -g tslab
tslab install
```

## Getting Started

1. Set your environment variables:
```bash
export FIDDLER_API_KEY="your-api-key"
export FIDDLER_ENDPOINT="https://your-instance.fiddler.ai"
export MODEL_ID="your-model-uuid"
```

2. Choose your language and open the corresponding notebook
3. Run all cells to validate the examples

## Documentation

These examples validate code from the official Fiddler documentation:
- [Publishing via REST API](https://docs.fiddler.ai) - Quick-start guide
- [Advanced REST API Publishing](https://docs.fiddler.ai) - Production patterns

## Contributing

When adding new REST API examples:
1. Create language-specific subdirectories under the relevant topic (e.g., `publishing/python/`)
2. Include validation tests for documented code examples
3. Provide production-ready implementations with error handling
4. Update this README with links to the new examples
53 changes: 53 additions & 0 deletions api-examples/publishing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Event Publishing Examples

Examples for publishing inference events to Fiddler using the REST API.

## Available Examples

### Python (`python/`)
- **validate-rest-api-examples.ipynb** - Comprehensive Python examples covering:
- Batch publishing (file upload + publish)
- Streaming publishing (direct events)
- Event updates (PATCH operations)
- Production-ready publisher with exponential backoff retry logic

### TypeScript (`typescript/`)
- **validate-typescript-rest-api-example.nnb** - TypeScript examples demonstrating:
- File upload and batch publishing with Job tracking
- Streaming events with queue submission
- Event updates with immutability constraints
- Production-ready publisher class with retry logic

## Key Concepts

### Automatic Processing Mode Selection

Fiddler automatically selects processing mode based on data source:

- **Files (CSV, Parquet)** → Batch processing with Job tracking
- Returns `job_id` for monitoring via Jobs API
- Asynchronous background processing
- Best for large datasets

- **JSON Arrays / Python Lists** → Streaming with queue submission
- Returns `event_ids` confirming queue submission
- Lower latency, queue-based processing
- Best for real-time or small batches

### Environment Constraints

**CRITICAL**: Only PRODUCTION events can be updated. Non-production events (PRE_PRODUCTION) are immutable and cannot be modified via batch OR streaming processes once published.

## Documentation References

These examples validate code from:
- [Publishing via REST API (Quick Start)](https://docs.fiddler.ai/docs/python-client-guides/publishing-production-data/publishing-via-rest-api)
- [Advanced REST API Publishing](https://docs.fiddler.ai/docs/python-client-guides/publishing-production-data/publishing-via-rest-api-advanced)

## Running the Examples

1. Set environment variables (API key, endpoint, model ID)
2. Open the notebook for your preferred language
3. Run all cells to execute the validation tests

Each notebook is self-contained and demonstrates all publishing workflows end-to-end.
Loading