Chainlit / cookbook

Chainlit's cookbook repo
https://github.com/Chainlit/chainlit
662 stars 245 forks source link

How to set a System Prompt for AsyncAnthropic? #130

Closed Krishna2709 closed 1 week ago

Krishna2709 commented 1 week ago

I am working on a conversational bot using Anthropic using the following example:

https://github.com/Chainlit/cookbook/tree/main/anthropic-chat

I want to set the bot's role using a system prompt. I tried the system and messages parameters, but these are not supported in the AsyncAnthropic class.

AsyncAnthropic: https://github.com/anthropics/anthropic-sdk-python/blob/main/src/anthropic/resources/completions.py#L409

Krishna2709 commented 1 week ago

Okay, the Text Completions API is a Legacy API. We should use Messages API, which supports system and message parameters.