Skip to content

Commit 419062d

Browse files
committed
style: Fix markdown lint errors across all documentation
Wrap long lines to stay under 80 characters, add blank lines around lists and headings, fix ordered list prefixes, add language specifiers to code blocks, and convert emphasis headers to proper headings. Signed-off-by: Eden Reich <eden.reich@gmail.com>
1 parent e01feff commit 419062d

File tree

16 files changed

+240
-88
lines changed

16 files changed

+240
-88
lines changed

CLAUDE.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with
4+
code in this repository.
5+
6+
## Project Overview
7+
8+
TypeScript SDK for the [Inference Gateway][ig] - a unified API for multiple
9+
LLM providers (OpenAI, Anthropic, Groq, Cohere, Ollama, Cloudflare, DeepSeek,
10+
Google, Mistral).
11+
12+
[ig]: https://github.com/edenreich/inference-gateway
13+
14+
## Commands
15+
16+
```bash
17+
# Build
18+
npm run build
19+
20+
# Test
21+
npm run test
22+
23+
# Run a single test
24+
npx jest tests/client.test.ts -t "test name pattern"
25+
26+
# Lint
27+
npm run lint
28+
29+
# Format
30+
npm run format
31+
32+
# Generate types from OpenAPI spec (downloads spec first)
33+
task oas-download && task generate-types
34+
```
35+
36+
## Architecture
37+
38+
### Source Structure
39+
40+
- `src/index.ts` - Package entry point, re-exports client and types
41+
- `src/client.ts` - Main `InferenceGatewayClient` class with all API methods
42+
- `src/types/generated/index.ts` - Auto-generated TypeScript types from OpenAPI
43+
spec (do not edit manually)
44+
45+
### Client Architecture
46+
47+
The SDK centers around `InferenceGatewayClient` which provides:
48+
49+
- `listModels(provider?)` - List available models
50+
- `listTools()` - List MCP tools (when EXPOSE_MCP enabled)
51+
- `createChatCompletion(request, provider?)` - Non-streaming completions
52+
- `streamChatCompletion(request, callbacks, provider?, abortSignal?)` -
53+
Streaming completions with SSE
54+
- `proxy(provider, path, options)` - Direct provider proxy
55+
- `healthCheck()` - Gateway health check
56+
- `withOptions(options)` - Create new client with merged options
57+
58+
### Streaming Implementation
59+
60+
`StreamProcessor` class handles SSE parsing with callbacks for:
61+
62+
- `onContent` - Text content chunks
63+
- `onReasoning` - Reasoning content (DeepSeek, Groq models)
64+
- `onTool` - Client-provided tool calls
65+
- `onMCPTool` - MCP tool calls (tools not in client's tool list)
66+
- `onUsageMetrics` - Token usage statistics
67+
68+
### Type Generation
69+
70+
Types in `src/types/generated/index.ts` are auto-generated from the OpenAPI
71+
spec using `openapi-typescript`. Regenerate with `task generate-types` after
72+
downloading the latest spec.
73+
74+
### Path Aliases
75+
76+
- `@/*` maps to `./src/*`
77+
- `@tests/*` maps to `./tests/*`
78+
79+
## Testing
80+
81+
Tests use Jest with ts-jest. Tests mock the fetch function to simulate API
82+
responses including streaming SSE events. Test file: `tests/client.test.ts`.
83+
84+
## Commit Message Convention
85+
86+
Use conventional commits: `feat:`, `fix:`, `refactor:`, `docs:`, `style:`,
87+
`test:`, `chore:`, `ci:`, `perf:`

CONTRIBUTING.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Contributing to the Inference Gateway Typescript SDK
22

3-
Thank you for your interest in contributing to the Inference Gateway Typescript SDK! This document provides guidelines and steps for contributing.
3+
Thank you for your interest in contributing to the Inference Gateway Typescript
4+
SDK! This document provides guidelines and steps for contributing.
45

56
## Table of Contents
67

@@ -16,16 +17,17 @@ Thank you for your interest in contributing to the Inference Gateway Typescript
1617

1718
1. Prerequisites:
1819

19-
- docker
20+
- docker
2021

21-
2. Clone and setup:
22+
1. Clone and setup:
2223

2324
```sh
2425
git clone https://github.com/inference-gateway/typescript-sdk
2526
code typescript-sdk
2627
```
2728

28-
3. Click on the `Reopen in Container` button in the bottom right corner of the window.
29+
1. Click on the `Reopen in Container` button in the bottom right corner of
30+
the window.
2931

3032
## Development Process
3133

@@ -35,15 +37,15 @@ code typescript-sdk
3537
git checkout -b my-feature
3638
```
3739

38-
2. Make changes and test:
40+
1. Make changes and test:
3941

4042
```sh
4143
task test
4244
```
4345

44-
3. Add tests for new features or fix tests for refactoring and bug fixes.
46+
1. Add tests for new features or fix tests for refactoring and bug fixes.
4547

46-
4. Run linter:
48+
1. Run linter:
4749

4850
```sh
4951
task lint
@@ -66,11 +68,12 @@ Types:
6668
- docs: documentation
6769
- style: formatting, missing semi colons, etc; no code change
6870
- test: adding missing tests
69-
- chore: updating build tasks, package manager configs, etc; no production code change
71+
- chore: updating build tasks, package manager configs, etc; no production
72+
code change
7073
- ci: changes to CI configuration files and scripts
7174
- perf: code change that improves performance
7275

73-
2. Ensure your PR:
76+
1. Ensure your PR:
7477

7578
- Passes all tests
7679
- Updates documentation as needed
@@ -80,9 +83,9 @@ Types:
8083
## Release Process
8184

8285
1. Merging to main triggers CI checks
83-
2. Manual release workflow can be triggered from Actions
84-
3. Version is determined by commit messages
85-
4. Changelog is automatically generated
86+
1. Manual release workflow can be triggered from Actions
87+
1. Version is determined by commit messages
88+
1. Changelog is automatically generated
8689

8790
## Getting Help
8891

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ try {
6262

6363
### Listing MCP Tools
6464

65-
To list available Model Context Protocol (MCP) tools (only available when EXPOSE_MCP is enabled):
65+
To list available Model Context Protocol (MCP) tools (only available when
66+
EXPOSE_MCP is enabled):
6667

6768
```typescript
6869
import { InferenceGatewayClient } from '@inference-gateway/sdk';
@@ -300,7 +301,8 @@ For more examples, check the [examples directory](./examples).
300301

301302
## Contributing
302303

303-
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for information about how to get involved. We welcome issues, questions, and pull requests.
304+
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for information
305+
about how to get involved. We welcome issues, questions, and pull requests.
304306

305307
## License
306308

Taskfile.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ tasks:
1111
desc: Lint the SDK
1212
cmds:
1313
- npm run lint
14+
- markdownlint . --ignore **/node_modules/** --ignore CHANGELOG.md
1415

1516
build:
1617
desc: Build the SDK

examples/QUICKSTART.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ This guide will help you run all TypeScript SDK examples quickly.
1717
```
1818

1919
2. Add your API keys to `.env`:
20+
2021
```bash
2122
# Choose one or more providers
2223
GROQ_API_KEY=your_groq_key_here

examples/README.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ This directory contains examples that demonstrate how to use the Typescript SDK.
44

55
## Pre-requisites
66

7-
You should have docker installed or use the dev container in VS Code which has all the tools you might need.
7+
You should have docker installed or use the dev container in VS Code which has
8+
all the tools you might need.
89

910
## Quick Start
1011

@@ -25,9 +26,13 @@ You should have docker installed or use the dev container in VS Code which has a
2526

2627
4. Review the different examples in the specific directories:
2728

28-
- [List](./list): Demonstrates listing models, MCP tools, health checks, and provider proxy functionality.
29-
- [Chat](./chat): Shows chat completions, streaming responses, multi-turn conversations, and function calling.
30-
- [MCP](./mcp): Illustrates Model Context Protocol integration with file operations, web scraping, and multi-tool conversations using Docker Compose.
29+
- [List](./list): Demonstrates listing models, MCP tools, health checks,
30+
and provider proxy functionality.
31+
- [Chat](./chat): Shows chat completions, streaming responses, multi-turn
32+
conversations, and function calling.
33+
- [MCP](./mcp): Illustrates Model Context Protocol integration with file
34+
operations, web scraping, and multi-tool conversations using Docker
35+
Compose.
3136

3237
## Examples Overview
3338

@@ -57,7 +62,8 @@ You should have docker installed or use the dev container in VS Code which has a
5762
- Function/tool calling with AI models
5863
- Temperature comparison examples
5964

60-
**Best for**: Building chat applications and understanding different interaction patterns
65+
**Best for**: Building chat applications and understanding different
66+
interaction patterns
6167

6268
### [MCP Example](./mcp)
6369

examples/chat/README.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Chat Example
22

3-
This example demonstrates how to use the Inference Gateway SDK for chat applications. It includes creating chat completions, streaming responses, multi-turn conversations, and function calling using the TypeScript SDK.
3+
This example demonstrates how to use the Inference Gateway SDK for chat
4+
applications. It includes creating chat completions, streaming responses,
5+
multi-turn conversations, and function calling using the TypeScript SDK.
46

57
## Features Demonstrated
68

@@ -11,7 +13,9 @@ This example demonstrates how to use the Inference Gateway SDK for chat applicat
1113

1214
## Getting Started
1315

14-
1. Ensure you have the Inference Gateway running locally or have access to an instance. If not, please read the [Quick Start](../README.md#quick-start) section in the main README.
16+
1. Ensure you have the Inference Gateway running locally or have access to an
17+
instance. If not, please read the [Quick Start](../README.md#quick-start)
18+
section in the main README.
1519

1620
2. Install the SDK if you haven't already:
1721

@@ -62,7 +66,8 @@ This example works with any provider supported by the Inference Gateway:
6266

6367
## Notes
6468

65-
- The function calling example simulates weather API calls - in a real application, you would implement actual function execution
69+
- The function calling example simulates weather API calls - in a real
70+
application, you would implement actual function execution
6671
- Streaming responses provide real-time output, perfect for interactive applications
6772
- Multi-turn conversations maintain context across multiple exchanges
6873
- Temperature and max_tokens parameters can be adjusted for different use cases

examples/list/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# List Example
22

3-
This example demonstrates how to use the Inference Gateway SDK for listing models and MCP tools. It includes making requests to the SDK and handling responses using the TypeScript SDK.
3+
This example demonstrates how to use the Inference Gateway SDK for listing
4+
models and MCP tools. It includes making requests to the SDK and handling
5+
responses using the TypeScript SDK.
46

57
## Features Demonstrated
68

@@ -11,7 +13,9 @@ This example demonstrates how to use the Inference Gateway SDK for listing model
1113

1214
## Getting Started
1315

14-
1. Ensure you have the Inference Gateway running locally or have access to an instance. If not, please read the [Quick Start](../README.md#quick-start) section in the main README.
16+
1. Ensure you have the Inference Gateway running locally or have access to an
17+
instance. If not, please read the [Quick Start](../README.md#quick-start)
18+
section in the main README.
1519

1620
2. Install the SDK if you haven't already:
1721

0 commit comments

Comments
 (0)