rosetta-ai 1.0.0 → 1.0.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 +28 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
The translation layer for LLM provider messages.
|
|
4
4
|
|
|
5
|
-
Rosetta
|
|
5
|
+
Rosetta converts messages between different LLM providers using a standardized intermediate format (GenAI). Just pass in messages from any provider—OpenAI, Anthropic, Google, or even custom formats—and get consistent output. No manual mapping required.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- Convert messages from any supported provider to a unified GenAI format
|
|
10
|
-
- Convert GenAI messages to any supported provider format
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
9
|
+
- 🔄 Convert messages from any supported provider to a unified GenAI format
|
|
10
|
+
- 🔀 Convert GenAI messages to any supported provider format
|
|
11
|
+
- 🪄 **Universal fallback** - Pass messages from *any* LLM provider or framework, even unsupported ones, and we'll attempt best-effort conversion
|
|
12
|
+
- 🔍 Automatic provider detection when source is not specified
|
|
13
|
+
- 📝 Full TypeScript support with strict types
|
|
14
|
+
- ✅ Runtime validation with Zod schemas
|
|
15
|
+
- 💾 Preserve provider-specific metadata for lossless round-trips
|
|
16
|
+
- 🌐 Works in Node.js and browsers
|
|
17
|
+
- 🌳 Tree-shakeable ESM build
|
|
17
18
|
|
|
18
19
|
## Installation
|
|
19
20
|
|
|
@@ -115,7 +116,24 @@ const { messages } = translator.translate(inputMessages);
|
|
|
115
116
|
| Google Gemini | ✅ Available | ✅ | - |
|
|
116
117
|
| Compat | ✅ Available | ✅ | - |
|
|
117
118
|
|
|
118
|
-
|
|
119
|
+
### Universal Compatibility
|
|
120
|
+
|
|
121
|
+
The **Compat** provider is a universal fallback that handles messages from *any* LLM provider—even ones not explicitly supported. When you call `translate()` without specifying a source provider, Rosetta tries to match against known provider schemas. If none match, it automatically falls back to Compat, which:
|
|
122
|
+
|
|
123
|
+
- Normalizes field names across conventions (`tool_calls`, `toolCalls`, `tool-calls` all work)
|
|
124
|
+
- Detects common patterns: roles, content arrays, tool calls, images, reasoning, etc.
|
|
125
|
+
- Handles formats from Cohere, Mistral, Ollama, AWS Bedrock, LangChain, and more
|
|
126
|
+
- Preserves unrecognized data so nothing is lost
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
// Works with any provider - no need to specify the source
|
|
130
|
+
const weirdMessages = [
|
|
131
|
+
{ role: "user", content: "Hello" },
|
|
132
|
+
{ role: "assistant", tool_calls: [{ id: "1", function: { name: "search", arguments: "{}" } }] },
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
const { messages } = translate(weirdMessages); // Just works™
|
|
136
|
+
```
|
|
119
137
|
|
|
120
138
|
More providers will be added. See [AGENTS.md](./AGENTS.md) for contribution guidelines.
|
|
121
139
|
|