Chainlit / docs

9 stars 60 forks source link

setting hide_cot to true still shows chain of thoughts #75

Closed suman12345678 closed 7 months ago

suman12345678 commented 7 months ago

Path: /observability-iteration/chain-of-thought

willydouhard commented 7 months ago

Can you provide a snippet of code to reproduce as well as a screenshot?

suman12345678 commented 7 months ago

Hi Chainlit/docs

Thanks a lot for replying.

I have code spread in many module so I cannot share snippet. But here is what I am doing.

Under .chainlit/config I am changing hide_cot to true and running my app. I am using pandasai and azuregpt4 llm , I still see the chain of thoughts printing when I am calling by chainlit run app.py from anaconda prompt.

I want to avoid this printing be cause if I deploy it in server logs will be filled by chain of thoughts. So if you can help me to know if there are any other settings I should do, that would be great.

On Wed, Nov 15, 2023, 1:33 PM Willy Douhard @.***> wrote:

Can you provide a snippet of code to reproduce as well as a screenshot?

— Reply to this email directly, view it on GitHub https://github.com/Chainlit/docs/issues/75#issuecomment-1813053124, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGVIXVYXISMO652PTOZSRCTYEUDHJAVCNFSM6AAAAAA7M53ODKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJTGA2TGMJSGQ . You are receiving this because you authored the thread.Message ID: @.***>

willydouhard commented 7 months ago

Can you share a screenshot (you can blur sensitive data)? Just to make sure we are talking about the same thing!

suman12345678 commented 7 months ago

Hi Chainlit/docs,

Below are some part of code. def get_response(message): question=message message = prompt+message

chain = cl.user_session.get('some model')
response =  None

# Retry the OpenAI API call if it fails
for attempt in range(max_retries):
    try:
        response = chain.chat(message)

@cl.on_chat_start async def on_chat_start():

llm=define_llm()
app_user = cl.user_session.get("user")
await cl.Avatar(
    name = "some chatbot",
    path="chatbot.PNG"
).send()
await cl.Message(content=f"Hi! {app_user.username} I'm an assistant. \
                 How can I assist you?",\
                 author="some chatbot").send()

model= SmartDataframe(df,config={"llm": llm,"save_logs":False, \

"conversational": True, \

"enable_cache":False,

"verbose":False})

# creating user session to store data
cl.user_session.set('some model',model)

get_response_async = make_async(get_response)

@cl.on_message # called when user provide a input async def main(message: str): print('user message ',message)

# making long running script as async
response=await  get_response_async(message)

print('---------return ',response)
# Send a response back to the user
await cl.Message(
    content=str(response),author="some chatbot"
).send()

On Thu, Nov 16, 2023, 2:24 PM Willy Douhard @.***> wrote:

Can you share a screenshot (you can blur sensitive data)? Just to make sure we are talking about the same thing!

— Reply to this email directly, view it on GitHub https://github.com/Chainlit/docs/issues/75#issuecomment-1815172798, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGVIXVZEBSX4JUOXYIFKD3TYEZR7BAVCNFSM6AAAAAA7M53ODKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJVGE3TENZZHA . You are receiving this because you authored the thread.Message ID: @.***>

willydouhard commented 7 months ago

Chain of thought is basically nested messages. In your code I do not see any parent_id or indent attribute to your messages. This code will not show any Chain of Thought.