Skip to content

Commit 09ac536

Browse files
feat(cli): include hints in payload (#1947)
* feat(cli): include hints in payload * chore: add changeset --------- Co-authored-by: cherkanov_art <45258907+cherkanovart@users.noreply.github.com>
1 parent 1a29b2d commit 09ac536

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

.changeset/thin-fans-unite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"lingo.dev": patch
3+
---
4+
5+
Include hints in payload to LLMs

packages/cli/src/cli/localizer/explicit.ts

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,41 @@ function createAiSdkLocalizer(params: {
188188
},
189189
},
190190
],
191+
[
192+
{
193+
sourceLocale: "en",
194+
targetLocale: "es",
195+
data: {
196+
spring: "Spring",
197+
},
198+
hints: {
199+
spring: ["A source of water"],
200+
},
201+
},
202+
{
203+
sourceLocale: "en",
204+
targetLocale: "es",
205+
data: {
206+
spring: "Manantial",
207+
},
208+
},
209+
],
191210
];
192211

212+
const hasHints = input.hints && Object.keys(input.hints).length > 0;
213+
193214
const payload = {
194215
sourceLocale: input.sourceLocale,
195216
targetLocale: input.targetLocale,
196217
data: input.processableData,
218+
...(hasHints && { hints: input.hints }),
197219
};
198220

199221
const response = await generateText({
200222
model,
201223
...params.settings,
202224
messages: [
203225
{ role: "system", content: systemPrompt },
204-
{ role: "user", content: "OK" },
205226
...shots.flatMap(
206227
([userShot, assistantShot]) =>
207228
[

0 commit comments

Comments
 (0)