openai-function-call-example

command module
v0.0.0-...-1794009 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 7 Imported by: 0

README ยถ

OpenAI Function Call Example

Welcome to this cheerful example of using OpenAI's function calling capabilities with the LangChain Go library! ๐ŸŽ‰

What does this example do?

This example demonstrates how to use OpenAI's GPT-3.5-turbo model to generate responses and make function calls based on user input. It's like having a smart assistant that can not only answer questions but also fetch real-time information for you! ๐Ÿค–๐Ÿ’ฌ

Here's a breakdown of what happens in this exciting journey:

  1. We set up an OpenAI language model using the LangChain Go library.
  2. We ask the model about the weather in Boston and Chicago.
  3. The model recognizes that it needs to fetch weather information and makes a function call to getCurrentWeather.
  4. We simulate getting the weather data (it's always sunny in this example! โ˜€๏ธ).
  5. We provide the weather information back to the model.
  6. Finally, we ask the model to compare the weather in both cities.

Key Features

  • ๐ŸŒŸ Uses OpenAI's GPT-3.5-turbo model
  • ๐Ÿ› ๏ธ Demonstrates function calling capabilities
  • ๐ŸŒค๏ธ Simulates weather data retrieval
  • ๐Ÿ”„ Shows how to manage conversation context and message history

How it Works

  1. Initial Query: We ask about the weather in Boston and Chicago.
  2. Function Recognition: The model recognizes it needs to call the getCurrentWeather function.
  3. Data Retrieval: We simulate fetching weather data for both cities.
  4. Context Update: We update the conversation context with the weather information.
  5. Comparison: We ask the model to compare the weather, and it provides a human-like response.

Fun Fact

In this example, Boston is always 72 and sunny, while Chicago is 65 and windy. Looks like Boston is winning the weather game today! ๐Ÿ†

So, grab your virtual sunglasses and enjoy exploring this example of AI-powered weather inquiries! โ˜€๏ธ๐Ÿ•ถ๏ธ

Documentation ยถ

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL