@aeye/replicate 0.3.0 → 0.3.1
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/README.md +2 -53
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -112,56 +112,7 @@ const provider = new ReplicateProvider({
|
|
|
112
112
|
|
|
113
113
|
### Creating Custom Adapters
|
|
114
114
|
|
|
115
|
-
TODO
|
|
116
|
-
|
|
117
|
-
```typescript
|
|
118
|
-
import { ModelTransformer } from '@aeye/ai';
|
|
119
|
-
import type { Request, Response } from '@aeye/core';
|
|
120
|
-
|
|
121
|
-
const myCustomAdapter: ModelTransformer = {
|
|
122
|
-
// Convert @aeye request to model-specific input
|
|
123
|
-
transformRequest: (request: Request) => {
|
|
124
|
-
return {
|
|
125
|
-
prompt: request.messages[request.messages.length - 1].content,
|
|
126
|
-
temperature: request.temperature ?? 0.7,
|
|
127
|
-
max_tokens: request.maxTokens ?? 500,
|
|
128
|
-
// ... other model-specific parameters
|
|
129
|
-
};
|
|
130
|
-
},
|
|
131
|
-
|
|
132
|
-
// Convert model output to @aeye response
|
|
133
|
-
transformResponse: (output: unknown): Response => {
|
|
134
|
-
const result = output as { text: string; tokens_used?: number };
|
|
135
|
-
|
|
136
|
-
return {
|
|
137
|
-
content: result.text,
|
|
138
|
-
finishReason: 'stop',
|
|
139
|
-
usage: {
|
|
140
|
-
inputTokens: 0,
|
|
141
|
-
outputTokens: result.tokens_used ?? 0,
|
|
142
|
-
totalTokens: result.tokens_used ?? 0,
|
|
143
|
-
},
|
|
144
|
-
};
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
// Optional: streaming support
|
|
148
|
-
transformStreamChunk: (chunk: unknown) => {
|
|
149
|
-
const data = chunk as { text?: string };
|
|
150
|
-
|
|
151
|
-
return {
|
|
152
|
-
content: data.text,
|
|
153
|
-
};
|
|
154
|
-
},
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
// Register the adapter
|
|
158
|
-
const provider = new ReplicateProvider({
|
|
159
|
-
apiKey: process.env.REPLICATE_API_KEY!,
|
|
160
|
-
transformers: {
|
|
161
|
-
'owner/my-custom-model': myCustomAdapter,
|
|
162
|
-
},
|
|
163
|
-
});
|
|
164
|
-
```
|
|
115
|
+
TODO: correct example
|
|
165
116
|
|
|
166
117
|
## Usage Examples
|
|
167
118
|
|
|
@@ -502,9 +453,7 @@ export function createMyModelAdapter(): ModelTransformer {
|
|
|
502
453
|
content,
|
|
503
454
|
finishReason: 'stop',
|
|
504
455
|
usage: {
|
|
505
|
-
|
|
506
|
-
outputTokens: 0,
|
|
507
|
-
totalTokens: 0,
|
|
456
|
+
text: { input: 0, output: 0 },
|
|
508
457
|
},
|
|
509
458
|
};
|
|
510
459
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeye/replicate",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "@aeye Replicate - Replicate integration for @aeye",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"LICENSE"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@aeye/ai": "^0.3.
|
|
33
|
-
"@aeye/core": "^0.3.
|
|
32
|
+
"@aeye/ai": "^0.3.1",
|
|
33
|
+
"@aeye/core": "^0.3.1",
|
|
34
34
|
"replicate": "^1.3.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|