Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: localization #1803

Open
ChrisW-priv opened this issue Nov 15, 2024 · 6 comments
Open

Feature request: localization #1803

ChrisW-priv opened this issue Nov 15, 2024 · 6 comments

Comments

@ChrisW-priv
Copy link

Hi!

It is me again :-) .
As am trying out some basics of the DSPy some more I realised one thing: the currently is no option to set diff. lang than English. The thing is, I want to make sure the LM will respond in Polish for example.
All my documents are in polish (not in the notebook example I attach but in actual aplication I build yes) and I would prefer to set the system instruction in Polish too. But currently there is no way of achieving that in DSPy as the templates are still using some english.

I am tiny bit worried that the LM will get "confused" as to what language to generate in but was not able to generate example of that just yet.

TLDR: In current version I use there seems to only exist the english template for sys prompt. But if user inputs the prompt in diff lang, then there is a mix of languages in the prompt which is confusing.

Is localization ever on a roadmap? Do I have to give up on polish system prompt and just code it full english and "hope" the LM responds in the same language as the prompt field?

Personaly I think short term I will have to stick to the later aproach but wanted to consult you first.
some localization tests.txt

@ChrisW-priv
Copy link
Author

ChrisW-priv commented Nov 15, 2024

What I found helpful is to include the "Answer in the language present in the prompt section." in the signature field but that feels like manual prompt engineering.

Not necessarily a bad thing, and it is still better than not using the DSPy (now LM knows what is prompt section etc.), just wanted to start a topic.
some localization tests (2).txt

@okhat
Copy link
Collaborator

okhat commented Nov 15, 2024

Hey @ChrisW-priv ! Thanks for opening this and laying it out so well. Localization is indeed an active direction, led by @sushmanthreddy .

Sushmanth's approach is to build a dspy.LocalizationAdapter(lang='fr', base=dspy.ChatAdapter()) that takes a language and an (English) adapter, and translates the workings of that adapter to the specified language.

Then, users do dspy.configure(adapter=....) to set their language.

This would work for you right?

@ChrisW-priv
Copy link
Author

Yes, I think so. Thanks for the reply. Is there a branch for this feature I can subscribe to?

@okhat
Copy link
Collaborator

okhat commented Nov 15, 2024

Not yet, @sushmanthreddy started brainstorming some 10 days ago. But we'd want this to become a PR in the next 2 weeks!

@sushmanthreddy
Copy link
Contributor

@ChrisW-priv there will be a pr soon , testing is in pending.Will update it soon

@plattenschieber
Copy link

Nice, I'm having similar experiences with German language. Can we help contribute @sushmanthreddy ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants