Potential Bug in ConversationalRetrievalChain - TypeError: can only concatenate str (not "CTransformers") to str | TypeError: can only concatenate str (not "AzureChatOpenAI") to str
Labels: name: area: memory, name: auto:bug, name: area: models, name: integration: chroma

### System Info

LangChain Version: 0.0.339
Python version: 3.10.8
Windows 10 Enterprise 21H2

When creating a ConversationalRetrievalChain as follows:

CONVERSATION_RAG_CHAIN_WITH_SUMMARY_BUFFER = ConversationalRetrievalChain(
combine_docs_chain=combine_docs_chain,
memory=summary_memory,
retriever=rag_retriever,
question_generator=question_generator_chain
)

With
LLM = AzureChatOpenAI(...)

The following error occurs:
"
Traceback (most recent call last):
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\om403f\Documents\Applied_Research\Deep_Learning\web_app\app.py", line 1456, in llm_task
    history_rag_buffer_result = CONVERSATION_RAG_CHAIN_WITH_SUMMARY_BUFFER.invoke({'question':user_query, 'chat_history':summary_memory})
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\base.py", line 87, in invoke
    return self(
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\base.py", line 310, in __call__
    raise e
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\base.py", line 304, in __call__
    self._call(inputs, run_manager=run_manager)
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\conversational_retrieval\base.py", line 135, in _call
    chat_history_str = get_chat_history(inputs["chat_history"])
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\conversational_retrieval\base.py", line 44, in _get_chat_history
    ai = "Assistant: " + dialogue_turn[1]
TypeError: can only concatenate str (not "AzureChatOpenAI") to str
"



Alternately, when using CTransformers as follows:

LLM = CTransformers(model=llm_model, model_type="llama", config=config, streaming=True, callbacks=[StreamingStdOutCallbackHandler()])

The following error occurs:
"
Traceback (most recent call last):
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\om403f\Documents\Applied_Research\Deep_Learning\web_app\app.py", line 1456, in llm_task
    history_rag_buffer_result = CONVERSATION_RAG_CHAIN_WITH_SUMMARY_BUFFER.invoke({'question':user_query, 'chat_history':summary_memory})
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\base.py", line 87, in invoke
    return self(
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\base.py", line 310, in __call__
    raise e
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\base.py", line 304, in __call__
    self._call(inputs, run_manager=run_manager)
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\conversational_retrieval\base.py", line 135, in _call
    chat_history_str = get_chat_history(inputs["chat_history"])
  File "C:\Users\om403f\AppData\Local\Programs\Python\Python310\lib\site-packages\langchain\chains\conversational_retrieval\base.py", line 44, in _get_chat_history
    ai = "Assistant: " + dialogue_turn[1]
TypeError: can only concatenate str (not "CTransformers") to str
"

Hope this is an accurate bug report and it helps! Apologies if this is in fact a dumb report and actually an error at my end.

### Who can help?

@hwchase17 
@agola11

### Information

- [X] The official example notebooks/scripts
- [ ] My own modified scripts

### Related Components

- [X] LLMs/Chat Models
- [ ] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [ ] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [X] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
from langchain.schema.vectorstore import VectorStoreRetriever
from langchain.memory import ConversationSummaryBufferMemory
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.prompts import PromptTemplate
from langchain.vectorstores import Chroma
from langchain.chains import LLMChainn
from langchain.chains import StuffDocumentsChain
from langchain.chains import ConversationalRetrievalChain
from langchain.llms import CTransformers

VECTOR_STORE = Chroma(persist_directory=VECTORDB_SBERT_FOLDER, embedding_function=HuggingFaceEmbeddings())

LLM = CTransformers(model=llm_model, model_type="llama", config=config, streaming=True, callbacks=[StreamingStdOutCallbackHandler()])

document_prompt = PromptTemplate(
    input_variables=["page_content"],
    template="{page_content}"
)

document_variable_name = "context"

temp_StuffDocumentsChain_prompt = PromptTemplate.from_template(
    "Summarize this content: {context}"
)

llm_chain_for_StuffDocumentsChain = LLMChain(llm=LLM, prompt=temp_StuffDocumentsChain_prompt)

combine_docs_chain = StuffDocumentsChain(
    llm_chain=llm_chain_for_StuffDocumentsChain,
    document_prompt=document_prompt,
    document_variable_name=document_variable_name
)

summary_memory = ConversationSummaryBufferMemory(llm=LLM, max_token_limit=100)

retriever=VECTOR_STORE.as_retriever()
 
rag_retriever = VectorStoreRetriever(vectorstore=VECTOR_STORE)

temp_template = (
    """
    Combine the chat history and qustion into a standalone question:
    Chat history: {chat_history}
    question: {user_query}
    """
)

temp_prompt = PromptTemplate.from_template(temp_template)

question_generator_chain = LLMChain(llm=LLM, prompt=temp_prompt)

CONVERSATION_RAG_CHAIN_WITH_SUMMARY_BUFFER = ConversationalRetrievalChain(
    combine_docs_chain=combine_docs_chain,
    memory=summary_memory,
    retriever=rag_retriever,
    question_generator=question_generator_chain
)

CONVERSATION_RAG_CHAIN_WITH_SUMMARY_BUFFER.invoke({'question':user_query, 'chat_history':summary_memory})

### Expected behavior

Should work according to code example and API specs as described in the official LangChain API docs:

https://api.python.langchain.com/en/latest/chains/langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain.html#langchain.chains.conversational_retrieval.base.ConversationalRetrievalChain