gpt-eng / docs /examples /open_llms /langchain_interface.py
kakumusic's picture
Upload folder using huggingface_hub
e7c3249 verified
raw
history blame contribute delete
No virus
404 Bytes
import os
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
from langchain_openai import ChatOpenAI
model = ChatOpenAI(
model=os.getenv("MODEL_NAME"),
temperature=0.1,
callbacks=[StreamingStdOutCallbackHandler()],
streaming=True,
)
prompt = (
"Provide me with only the code for a simple python function that sums two numbers."
)
model.invoke(prompt)