Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bewinxed/elelem.ts
A tiny library for calling different LLMs from a single interface, only uses fetch!
https://github.com/bewinxed/elelem.ts
Last synced: about 1 month ago
JSON representation
A tiny library for calling different LLMs from a single interface, only uses fetch!
- Host: GitHub
- URL: https://github.com/bewinxed/elelem.ts
- Owner: Bewinxed
- Created: 2024-09-12T04:10:15.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-09-12T04:50:19.000Z (4 months ago)
- Last Synced: 2024-11-17T22:03:54.740Z (about 1 month ago)
- Language: TypeScript
- Size: 188 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# elelem.ts 🤖
This ONLY uses fetch, so no extra dependencies are needed except for types, which will be inlined soon.
This TypeScript library provides a unified interface for interacting with various Large Language Model (LLM) providers, including OpenAI, Anthropic, and Ollama. It offers a flexible and extensible way to integrate different LLM services into your applications.
## Features
- Support for multiple LLM providers (OpenAI, Anthropic, Ollama)
- Unified interface for streaming chat completions
- Type-safe configurations for different providers
- Extensible architecture for adding new providers## Installation
```bash
npm install elelem.ts
bun install elelem.ts
```## Usage
```typescript
import { createChatLLMWrapper } from 'elelem.ts';const llm = await createChatLLMWrapper('OPENAI' | 'ANTHROPIC' | ..., {
apiKey: 'your-api-key',
baseUrl: 'https://api.openai.com' | "http://localhost:11434",
});for await (const chunk of openaiWrapper.streamCompletion(streamParams)) {
console.log(chunk);
}// Only Streaming is supported for now.
```
## Supported Providers
- OpenAI
- OpenAI-compatible services
- Anthropic
- Ollama## Adding New Providers
To add a new provider:
Check /src/lib/chat/providers, and make a PR.
Or ask me to add it.## License
This project is licensed under the MIT License.