cot-reasoning/README.md
Lilith 3ab8fb51fe feat(cot-reasoning): initial implementation of CoT reasoning service
Multi-stage Chain-of-Thought reasoning service with:
- FastAPI service using lilith-ml-service-base
- Pipeline orchestration via lilith-pipeline-framework
- LLM client using lilith-ollama-provider
- TypeScript client package @lilith/cot-client
- Service-addresses integration for port resolution (8110)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-12 09:17:59 -08:00

99 lines
2 KiB
Markdown

# CoT Reasoning Service
Chain-of-Thought reasoning service with multi-stage pipeline orchestration.
## Overview
This service provides configurable multi-stage reasoning pipelines for LLM-based analysis tasks. It abstracts the CoT pattern into a reusable service that can be consumed by other applications.
## Architecture
```
cot-reasoning/
├── service/src/ # Python FastAPI service
│ ├── api/main.py # FastAPI endpoints
│ ├── config.py # Configuration (uses service-addresses)
│ ├── reasoning/ # CoT engine and stages
│ └── llm/ # LLM client adapter
├── packages/client/ # @lilith/cot-client TypeScript package
└── pyproject.toml # Python package definition
```
## Port
Port `8110` is allocated in `lilith-platform/infrastructure/ports.yaml` under `ml.cot-reasoning`.
The service uses `lilith-service-addresses` for runtime port resolution.
## Installation
### Python Service
```bash
pip install cot-reasoning
```
### TypeScript Client
```bash
npm install @lilith/cot-client
```
## Usage
### Python Service
```bash
# Start the service
python -m service
```
### TypeScript Client
```typescript
import { CoTClient } from '@lilith/cot-client';
// Auto-discovers port from service-addresses
const client = await CoTClient.create();
const result = await client.reason({
input: 'femboy, catgirl, lawyer',
stages: ['cultural_analysis'],
});
console.log(result.result);
console.log(result.reasoning_trace);
```
## API Endpoints
### POST /reason
Execute reasoning pipeline on input.
```json
{
"input": "text to analyze",
"stages": ["stage1", "stage2"],
"context": {}
}
```
### GET /stages
List available reasoning stages.
### GET /health
Health check endpoint.
## Dependencies
- `lilith-ml-service-base` - FastAPI scaffolding
- `lilith-ollama-provider` - LLM client
- `lilith-pipeline-framework` - Pipeline orchestration
- `lilith-service-addresses` - Port resolution
## License
MIT