brunoclbr
10/10/2025, 7:53 PMpython
cr = ClientRegistry()
if model_provider == 'anthropic' or model_provider == 'openai':
# Use existing client from clients.baml - no need to create a new one.
# "model_name" is essentialy the client name from clients.baml.
# Just set it as primary so ExtractSentimentScores uses it
cr.set_primary(model_name)
elif model_provider == 'openai-generic': # this is for custom LLM
cr.add_llm_client(name="MyDynamicClient",
provider=model_provider,
options={"model": model_name,
"temperature": 0.5,
"max_tokens": 2048,
'base_url': self.base_url
})
cr.set_primary("MyDynamicClient")
else:
raise ValueError(f'Model provider {model_provider} not supported')
return cr
https://cdn.discordapp.com/attachments/1253172394345107466/1426296495069466807/image.png?ex=68eab59f&is=68e9641f&hm=2d923f4e7ac7e2f096915373f8fde26be39448da71be226901212504a682c6c4&
https://cdn.discordapp.com/attachments/1253172394345107466/1426296495686291677/image.png?ex=68eab59f&is=68e9641f&hm=b97d8b2de135556a1b2801fc53fa6b6708d0f52325dd8880b6f0abbcd26e144d&baml-sam
10/10/2025, 7:57 PMbaml-sam
10/10/2025, 7:58 PMbrunoclbr
10/11/2025, 11:45 AMbrunoclbr
10/12/2025, 8:13 AMbaml-sam
10/12/2025, 10:08 PM{{ _.role("user") }} at the start of that promptbaml-sam
10/12/2025, 10:09 PMbaml-sam
10/12/2025, 10:12 PMbrunoclbr
10/13/2025, 4:00 AMbaml-sam
10/13/2025, 6:28 PMjamesone_1
10/16/2025, 7:09 AM{{ _.role("user") }}
{{ _.role("system") }}
Are there any recommended best practises? Should we always place the system prompt at the top & user at the end?jamesone_1
10/16/2025, 7:13 AM{{ _.role("system") }}
Determine what to reply based on the conversation
CONVERSATION HISTORY:
{% for msg in conversationHistory %}
{{ _.role(msg.role) }} # Can equal user or assistant
{{ msg.content[0].text }}
{% endfor %}
LATEST USER MESSAGE:
{{ _.role("user") }}
I like green apples
---
In this scenario - I am doing:
LATEST USER MESSAGE:
{{ _.role("user") }}
I like green apples
To signify that it is latest user message, curious to know if this is the right approach or I need to think differently.baml-sam
10/16/2025, 9:46 PM