Skip to content
Closed
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: CI

# TODO: This workflow should be calling make targets instead of duplicating commands.
# See `make verify` for the local equivalent of these checks.

on:
push:
branches: [ main ]
Expand Down
7 changes: 7 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ Run the pipeline to update provider types:

This process is fully automated and generates only essential types to minimize code size.

## Development workflow

1. Write a failing test or repro
2. Make the change
3. Run tests (`cargo test`)
4. Before committing, run `make verify` (runs tests and lint)

## Development setup

**Git hooks installation**:
Expand Down
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all lingua-wasm typescript python test clean help generate-types generate-all-providers install-hooks install-wasm-tools setup
.PHONY: all lingua-wasm typescript python test clean help generate-types generate-all-providers install-hooks install-wasm-tools setup verify clippy fmt-check

all: typescript python ## Build all bindings

Expand Down Expand Up @@ -78,6 +78,15 @@ fmt: ## Format all code
@echo "Formatting TypeScript code..."
cd bindings/typescript && pnpm run lint

fmt-check: ## Check formatting without modifying
cargo fmt --all -- --check

clippy: ## Run clippy with warnings as errors (matches CI)
cargo clippy --all-targets --all-features -- -D warnings

verify: fmt-check clippy ## Run all CI checks locally (run before committing)
RUSTFLAGS="-D warnings" $(MAKE) test-rust

install-hooks: ## Install git pre-commit hooks
@echo "Installing git hooks..."
./scripts/install-hooks.sh
Expand Down
130 changes: 130 additions & 0 deletions bindings/typescript/wasm-web/lingua.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/* tslint:disable */
/* eslint-disable */
/**
* Convert array of Chat Completions messages to Lingua Messages
*/
export function chat_completions_messages_to_lingua(value: any): any;
/**
* Convert array of Lingua Messages to Chat Completions messages
*/
export function lingua_to_chat_completions_messages(value: any): any;
/**
* Convert array of Responses API messages to Lingua Messages
*/
export function responses_messages_to_lingua(value: any): any;
/**
* Convert array of Lingua Messages to Responses API messages
*/
export function lingua_to_responses_messages(value: any): any;
/**
* Convert array of Anthropic messages to Lingua Messages
*/
export function anthropic_messages_to_lingua(value: any): any;
/**
* Convert array of Lingua Messages to Anthropic messages
*/
export function lingua_to_anthropic_messages(value: any): any;
/**
* Deduplicate messages based on role and content
*/
export function deduplicate_messages(value: any): any;
/**
* Import messages from spans
*/
export function import_messages_from_spans(value: any): any;
/**
* Import and deduplicate messages from spans in a single operation
*/
export function import_and_deduplicate_messages(value: any): any;
/**
* Validate a JSON string as a Chat Completions request
*/
export function validate_chat_completions_request(json: string): any;
/**
* Validate a JSON string as a Chat Completions response
*/
export function validate_chat_completions_response(json: string): any;
/**
* Validate a JSON string as a Responses API request
*/
export function validate_responses_request(json: string): any;
/**
* Validate a JSON string as a Responses API response
*/
export function validate_responses_response(json: string): any;
/**
* Validate a JSON string as an OpenAI request
* @deprecated Use validate_chat_completions_request instead
*/
export function validate_openai_request(json: string): any;
/**
* Validate a JSON string as an OpenAI response
* @deprecated Use validate_chat_completions_response instead
*/
export function validate_openai_response(json: string): any;
/**
* Validate a JSON string as an Anthropic request
*/
export function validate_anthropic_request(json: string): any;
/**
* Validate a JSON string as an Anthropic response
*/
export function validate_anthropic_response(json: string): any;
/**
* Validate a JSON string as a Google request (not supported - protobuf types)
*/
export function validate_google_request(json: string): any;
/**
* Validate a JSON string as a Google response (not supported - protobuf types)
*/
export function validate_google_response(json: string): any;

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly chat_completions_messages_to_lingua: (a: number, b: number) => void;
readonly lingua_to_chat_completions_messages: (a: number, b: number) => void;
readonly responses_messages_to_lingua: (a: number, b: number) => void;
readonly lingua_to_responses_messages: (a: number, b: number) => void;
readonly anthropic_messages_to_lingua: (a: number, b: number) => void;
readonly lingua_to_anthropic_messages: (a: number, b: number) => void;
readonly deduplicate_messages: (a: number, b: number) => void;
readonly import_messages_from_spans: (a: number, b: number) => void;
readonly import_and_deduplicate_messages: (a: number, b: number) => void;
readonly validate_chat_completions_request: (a: number, b: number, c: number) => void;
readonly validate_chat_completions_response: (a: number, b: number, c: number) => void;
readonly validate_responses_request: (a: number, b: number, c: number) => void;
readonly validate_responses_response: (a: number, b: number, c: number) => void;
readonly validate_anthropic_request: (a: number, b: number, c: number) => void;
readonly validate_anthropic_response: (a: number, b: number, c: number) => void;
readonly validate_google_request: (a: number, b: number, c: number) => void;
readonly validate_openai_request: (a: number, b: number, c: number) => void;
readonly validate_openai_response: (a: number, b: number, c: number) => void;
readonly validate_google_response: (a: number, b: number, c: number) => void;
readonly __wbindgen_export_0: (a: number, b: number) => number;
readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
readonly __wbindgen_export_2: (a: number) => void;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;
/**
* Instantiates the given `module`, which can either be bytes or
* a precompiled `WebAssembly.Module`.
*
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
*
* @returns {InitOutput}
*/
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;

/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
*
* @returns {Promise<InitOutput>}
*/
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
Loading