I just woke up. Your llm is ending")# To enable streaming, we pass in `streaming=True` to the ChatModel constructor# Additionally, we pass in a list with our custom handlerchat = ChatOpenAI(    max_tokens=25,    streaming=True,    callbacks=[MyCustomSyncHandler(), MyCustomAsyncHandler()],)await chat.agenerate([[HumanMessage(content="Tell me a joke")]])    zzzz....    Hi! I just woke up. Your llm is starting    Sync handler being called in a `thread_pool_executor`: token:     Sync handler being called in a `thread_pool_executor`: token: Why    Sync handler being called in a `thread_pool_executor`: token:  don    Sync handler being called in a `thread_pool_executor`: token: 't    Sync handler being called in a `thread_pool_executor`: token:  scientists    Sync handler being called in a `thread_pool_executor`: token:  trust    Sync handler being called in a `thread_pool_executor`: token:  atoms    Sync handler being called in a `thread_pool_executor`: token: ?    Sync handler being called in a `thread_pool_executor`: token:              Sync handler being called in a `thread_pool_executor`: token: Because    Sync handler being called in a `thread_pool_executor`: token:  they    Sync handler being called in a `thread_pool_executor`: token:  make    Sync handler being called in a `thread_pool_executor`: token:  up    Sync handler being called in a `thread_pool_executor`: token:  everything    Sync handler being called in a `thread_pool_executor`: token: .    Sync handler being called in a `thread_pool_executor`: token:     zzzz....    Hi! I just woke up. Your llm is ending    LLMResult(generations=[[ChatGeneration(text="Why don't scientists trust atoms? \n\nBecause they make up everything.", generation_info=None, message=AIMessage(content="Why don't scientists trust atoms? \n\nBecause they make up everything.", additional_kwargs={}, example=False))]], llm_output={'token_usage': {}, 'model_name': 'gpt-3.5-turbo'})PreviousCallbacksNextCustom callback
If you are planning to use the async API, it is recommended to use AsyncCallbackHandler to avoid blocking the runloop.
If you are planning to use the async API, it is recommended to use AsyncCallbackHandler to avoid blocking the runloop. ->: I just woke up. Your llm is ending")# To enable streaming, we pass in `streaming=True` to the ChatModel constructor# Additionally, we pass in a list with our custom handlerchat = ChatOpenAI(    max_tokens=25,    streaming=True,    callbacks=[MyCustomSyncHandler(), MyCustomAsyncHandler()],)await chat.agenerate([[HumanMessage(content="Tell me a joke")]])    zzzz....    Hi! I just woke up. Your llm is starting    Sync handler being called in a `thread_pool_executor`: token:     Sync handler being called in a `thread_pool_executor`: token: Why    Sync handler being called in a `thread_pool_executor`: token:  don    Sync handler being called in a `thread_pool_executor`: token: 't    Sync handler being called in a `thread_pool_executor`: token:  scientists    Sync handler being called in a `thread_pool_executor`: token:  trust    Sync handler being called in a `thread_pool_executor`: token:  atoms    Sync handler being called in a `thread_pool_executor`: token: ?    Sync handler being called in a `thread_pool_executor`: token:              Sync handler being called in a `thread_pool_executor`: token: Because    Sync handler being called in a `thread_pool_executor`: token:  they    Sync handler being called in a `thread_pool_executor`: token:  make    Sync handler being called in a `thread_pool_executor`: token:  up    Sync handler being called in a `thread_pool_executor`: token:  everything    Sync handler being called in a `thread_pool_executor`: token: .    Sync handler being called in a `thread_pool_executor`: token:     zzzz....    Hi! I just woke up. Your llm is ending    LLMResult(generations=[[ChatGeneration(text="Why don't scientists trust atoms? \n\nBecause they make up everything.", generation_info=None, message=AIMessage(content="Why don't scientists trust atoms? \n\nBecause they make up everything.", additional_kwargs={}, example=False))]], llm_output={'token_usage': {}, 'model_name': 'gpt-3.5-turbo'})PreviousCallbacksNextCustom callback