diff --git a/main.py b/main.py new file mode 100644 index 0000000..f54be7b --- /dev/null +++ b/main.py @@ -0,0 +1,13 @@ +import os +from langchain.chat_models import ChatOpenAI +from langchain.schema import HumanMessage + +# Example of streaming with LangChain +if __name__ == "__main__": + # Use OpenAI API key from env + os.environ.setdefault("OPENAI_API_KEY", "sk-...") + model = ChatOpenAI(temperature=0.7) + # Stream response + for chunk in model.stream([HumanMessage(content="Hello, world!" )]): + print(chunk.content, end="", flush=True) + print("\n[Done]") \ No newline at end of file