examples/openai-function-call-streaming-example/README.md
Welcome to this exciting example of using OpenAI's function calling feature with streaming in Go! 🎉
This example demonstrates how to use the LangChain Go library to interact with OpenAI's GPT-4 model, specifically showcasing function calling capabilities and streaming responses. Here's a breakdown of the main features:
OpenAI Model Initialization: The code sets up a connection to the GPT-4 Turbo model.
Function Definitions: Three functions are defined as tools that the AI can potentially use:
getCurrentWeather: Get current weather for a locationgetTomorrowWeather: Get predicted weather for a locationgetSuggestedPrompts: Generate related prompts based on user inputUser Query: The example asks the AI about the weather in Boston.
Streaming Response: As the AI generates its response, the code streams and prints each chunk of the response in real-time.
Function Call Detection: If the AI decides to call a function, the code will detect and display this information.
getCurrentWeather), this will be detected and displayed.Give it a try and watch as the AI decides whether to call a function or provide a direct response about the weather in Boston! ☀️🌦️