The following examples focus on LLMInterface usage.
- Chat: Basic LLMInterface.sendMessage() chat usage. This example features an OpenAI compatible structure.
- Prompt: Basic LLMInterface.sendMessage() prompt usage.
- Streaming Mode: LLMInterface.sendMessage() streaming mode prompt usage.
- Set Multiple API Keys: LLMInterface.setApiKey() multiple key usage. This example shows how to set more than one API key at once.
- Embeddings: Basic LLMInterface.embeddings() usage example.
- Embeddings Failover: LLMInterface.embeddings() with default failover usage example.
- Embeddings Custom Failover: LLMInterface.embeddings() with custom failover usage example.
- Simple Cache: Default file-based cache usage example.
- Memory Cache: High-speed in-memory cache usage example.
- Flat Cache: NPM
flat-cache
, a JSON flat file cache, usage example. (Node Package) - Cache Manager: NPM
cache-manager
, an advanced caching system supporting multiple backends including MongoDB, Memcache, Redis, SQLite, and more, usage example. (Node Package)
- Auto Retry Failed Requests: Controlling retries with interfaceOptions.retryAttempts and interfaceOptions.retryMultiplier usage example.
- Include Original Response: Including the complete original response with interfaceOptions.includeOriginalResponse usage example.
- JSON Repair: Repairing badly formed JSON with interfaceOptions.attemptJsonRepair usage example.
- JSON Output: Requesting a JSON response using the prompt usage example.
- JSON Repair: Repairing badly formed JSON with interfaceOptions.attemptJsonRepair usage example.
- Native JSON Output: Requesting a JSON response with options.response_format usage example.
The following are some examples using LLMInterface.
- Retrieval-Augmented Generation (RAG): Example demonstrating Retrieval-Augmented Generation (RAG) using Langchain.js
PromptTemplate
andLLMChain
.
- Mixture of Agents (MoA): Example demonstrating the Mixture of Agents (MoA) concept to improve response quality.
- Chart Generation: Example demonstrating Node.js code generation, sandboxed execution, and chart generation.
- RSS Feed Summarization: Example demonstrating RSS feed summarization.