Skip to content
Merged
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
49 changes: 48 additions & 1 deletion sdks/typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Evaluates vocabulary complexity using the Qual Text Complexity rubric (SAP).

**Supported Grades:** 3-12

**Uses:** Google Gemini 2.5 Pro + OpenAI GPT-4o
**Uses:** OpenAI GPT-4o (background knowledge) + Google Gemini 2.5 Pro (grades 3–4) / OpenAI GPT-4.1 (grades 5–12)

**Constructor:**
```typescript
Expand Down Expand Up @@ -74,6 +74,53 @@ await evaluator.evaluate(text: string, grade: string)
}
```

---

### 2. Sentence Structure Evaluator

Evaluates sentence structure complexity based on grammatical features.

**Supported Grades:** K-12

**Uses:** OpenAI GPT-4o

**Constructor:**
```typescript
const evaluator = new SentenceStructureEvaluator({
openaiApiKey: string; // Required - OpenAI API key
maxRetries?: number; // Optional - Max retry attempts (default: 2)
telemetry?: boolean | TelemetryOptions; // Optional (default: true)
logger?: Logger; // Optional - Custom logger
logLevel?: LogLevel; // Optional - Logging verbosity (default: WARN)
});
```

**API:**
```typescript
await evaluator.evaluate(text: string, grade: string)
```

**Returns:**
```typescript
{
score: 'Slightly Complex' | 'Moderately Complex' | 'Very Complex' | 'Exceedingly Complex';
reasoning: string;
metadata: {
promptVersion: string;
model: string;
timestamp: Date;
processingTimeMs: number;
};
_internal: {
sentenceAnalysis: SentenceAnalysis;
features: SentenceFeatures;
complexity: ComplexityClassification;
};
}
```

---

## Error Handling

The SDK provides specific error types to help you handle different scenarios:
Expand Down
6 changes: 3 additions & 3 deletions sdks/typescript/docs/telemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ If you prefer not to send any telemetry, you can disable it entirely — see [Di
"timestamp": "2026-02-05T19:30:00.000Z",
"sdk_version": "0.1.0",
"evaluator_type": "vocabulary",
"grade": "5",
"grade": "3",
"status": "success",
"latency_ms": 3500,
"text_length_chars": 456,
"provider": "google:gemini-2.5-pro+openai:gpt-4o",
"provider": "openai:gpt-4o-2024-11-20 + google:gemini-2.5-pro",
"token_usage": {
"input_tokens": 650,
"output_tokens": 350
Expand Down Expand Up @@ -72,7 +72,7 @@ If you prefer not to send any telemetry, you can disable it entirely — see [Di
| `latency_ms` | Total evaluation time in milliseconds |
| `text_length_chars` | Length of input text in characters |
| `provider` | LLM provider(s) used (e.g., "openai:gpt-4o", "google:gemini-2.5-pro+openai:gpt-4o") |
| `token_usage` | Total tokens consumed (input, output, total) |
| `token_usage` | Total tokens consumed (input, output) |
| `input_text` | The text being evaluated (only included if `recordInputs: true`) |
| `metadata.stage_details` | Per-stage breakdown for multi-stage evaluators (optional) |

Expand Down
6 changes: 6 additions & 0 deletions sdks/typescript/src/evaluators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,9 @@ export {
evaluateVocabulary,
type VocabularyEvaluatorConfig,
} from './vocabulary.js';

export {
SentenceStructureEvaluator,
evaluateSentenceStructure,
type SentenceStructureEvaluatorConfig,
} from './sentence-structure.js';
Loading