@renderify/llm 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/llm.cjs.js +1769 -0
- package/dist/llm.cjs.js.map +1 -0
- package/dist/llm.d.mts +117 -0
- package/dist/llm.d.ts +117 -0
- package/dist/llm.esm.js +1746 -0
- package/dist/llm.esm.js.map +1 -0
- package/package.json +59 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Web LLM
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# @renderify/llm
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
LLM provider implementations and registry for Renderify.
|
|
8
|
+
|
|
9
|
+
`@renderify/llm` provides built-in interpreters for OpenAI, Anthropic, and Google, plus a provider registry API for custom providers.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @renderify/llm
|
|
15
|
+
# or
|
|
16
|
+
npm i @renderify/llm
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Built-in Providers
|
|
20
|
+
|
|
21
|
+
- `OpenAILLMInterpreter`
|
|
22
|
+
- `AnthropicLLMInterpreter`
|
|
23
|
+
- `GoogleLLMInterpreter`
|
|
24
|
+
|
|
25
|
+
## Factory API
|
|
26
|
+
|
|
27
|
+
- `createLLMInterpreter({ provider, providerOptions })`
|
|
28
|
+
- `LLMProviderRegistry`
|
|
29
|
+
- `createDefaultLLMProviderRegistry()`
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
import { createLLMInterpreter } from "@renderify/llm";
|
|
35
|
+
|
|
36
|
+
const llm = createLLMInterpreter({
|
|
37
|
+
provider: "openai",
|
|
38
|
+
providerOptions: {
|
|
39
|
+
apiKey: process.env.RENDERIFY_LLM_API_KEY,
|
|
40
|
+
model: "gpt-4o-mini",
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const response = await llm.generateResponse({
|
|
45
|
+
prompt: "return a simple RuntimePlan JSON",
|
|
46
|
+
context: {},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
console.log(response.text);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Custom Provider
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
import { LLMProviderRegistry, createLLMInterpreter } from "@renderify/llm";
|
|
56
|
+
|
|
57
|
+
const registry = new LLMProviderRegistry();
|
|
58
|
+
registry.register({
|
|
59
|
+
name: "my-provider",
|
|
60
|
+
create: () => {
|
|
61
|
+
const templates = new Map();
|
|
62
|
+
return {
|
|
63
|
+
configure() {},
|
|
64
|
+
async generateResponse() {
|
|
65
|
+
return { text: "{}", tokensUsed: 0 };
|
|
66
|
+
},
|
|
67
|
+
setPromptTemplate(name, content) {
|
|
68
|
+
templates.set(name, content);
|
|
69
|
+
},
|
|
70
|
+
getPromptTemplate(name) {
|
|
71
|
+
return templates.get(name);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const llm = createLLMInterpreter({ provider: "my-provider", registry });
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Notes
|
|
81
|
+
|
|
82
|
+
- Provider implementations follow the `LLMInterpreter` interface from `@renderify/core`.
|
|
83
|
+
- Streaming support is available through `generateResponseStream()` when provided by the selected interpreter.
|