File size: 567 Bytes
87d8ff9
 
c838dd8
87d8ff9
 
 
4703150
c838dd8
4703150
87d8ff9
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from langchain.chat_models import ChatOpenAI
from langchain.base_language import BaseLanguageModel
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler

def llm(temperature=0) -> BaseLanguageModel:
    # gpt-3.5
    return ChatOpenAI(streaming=True, callbacks=[StreamingStdOutCallbackHandler()], temperature=temperature)

    # return ChatOpenAI(streaming=True, callbacks=[StreamingStdOutCallbackHandler()], temperature=temperature, model_name="gpt-4")
    # gpt-4
    # return ChatOpenAI(temperature=temperature, model_name="gpt-4")