Skip to content

Commit 37b222a

Browse files
committed
docs: add multilingual output how-to with prompt-based example
1 parent 6234de1 commit 37b222a

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

docs/howto/multilingual.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
# Multilingual output (how-to)
3+
4+
**Version:** `gdm-concordia >= 2.1.0`
5+
6+
Concordia agents don’t have a global “language” toggle. The recommended way to constrain output language is to **modify the agent’s prompt**. You can do this either by:
7+
- injecting a language directive into the agent’s params (e.g., `goal`), or
8+
- wrapping/templating the prompt used by your prefab.
9+
10+
Below is a minimal example that sets one agent to Spanish and another to French.
11+
12+
```python
13+
from concordia.utils import prefab_lib
14+
15+
LANGUAGE_DIRECTIVE = "Always respond in {lang}. Do not switch languages."
16+
17+
instances = [
18+
prefab_lib.InstanceConfig(
19+
prefab="basic__Entity",
20+
role=prefab_lib.Role.ENTITY,
21+
params={
22+
"name": "Oliver Cromwell",
23+
"goal": "become lord protector. " + LANGUAGE_DIRECTIVE.format(lang="Spanish"),
24+
},
25+
),
26+
prefab_lib.InstanceConfig(
27+
prefab="basic__Entity",
28+
role=prefab_lib.Role.ENTITY,
29+
params={
30+
"name": "King Charles I",
31+
"goal": "avoid execution for treason. " + LANGUAGE_DIRECTIVE.format(lang="French"),
32+
},
33+
),
34+
prefab_lib.InstanceConfig(
35+
prefab="generic__GameMaster",
36+
role=prefab_lib.Role.GAME_MASTER,
37+
params={
38+
"name": "default rules",
39+
# Comma-separated list of thought chain steps.
40+
"extra_event_resolution_steps": "",
41+
},
42+
),
43+
prefab_lib.InstanceConfig(
44+
prefab="formative_memories_initializer__GameMaster",
45+
role=prefab_lib.Role.INITIALIZER,
46+
params={
47+
"name": "initial setup rules",
48+
"next_game_master_name": "default rules",
49+
"shared_memories": [
50+
"The king was captured by Parliamentary forces in 1646.",
51+
"Charles I was tried for treason and found guilty.",
52+
],
53+
},
54+
),
55+
]
56+
57+
config = prefab_lib.Config(
58+
default_premise="Today is January 29, 1649.",
59+
default_max_steps=5,
60+
instances=instances,
61+
)
62+
63+
64+
65+
eof

0 commit comments

Comments
 (0)