
⚠️ Note: This project is under active development and currently supports only the Gemini LLM.
What is GoPilot?
GoPilot is an intelligent automation platform that enables users to perform complex tasks across systems, APIs, or agents using simple natural language inputs. Powered by advanced language models, GoPilot interprets user commands, selects the appropriate functions or agents, configures parameters, and executes tasks seamlessly—saving time and effort.
How It Works
Imagine an application with a complex settings menu. Instead of navigating multiple layers to adjust a setting, a user can simply say, "Set the app's font size to 15." If a GoPilot module is configured for this task, it analyzes the input, identifies the relevant agent or API, sets the necessary parameters, and executes the command as if the user had manually made the change. The result is a streamlined, intuitive experience that feels like having a personal assistant.
Key Features
- Natural Language Processing: Understands and processes conversational or imperfect user inputs.
- Agent Selection: Automatically selects the most suitable function, API, or agent for the task.
- Parameter Automation: Populates required parameters without user intervention.
- Versatile Integration: Integrates with existing systems, APIs, or custom agents for diverse applications.
Example Usage
Below is an example of how to use GoPilot to register and execute a function, such as fetching weather information for a city:
func main() {
// Initialize Gemini client
client, err := clients.NewGeminiClient(apiKey, "gemini-2.0-flash")
if err != nil {
log.Fatal(err)
}
defer client.Close()
// Initialize GoPilot
gp, err := gopilot.NewGopilot(client)
if err != nil {
log.Fatal("gopilot is not run:", err.Error())
}
// Register a weather agent
if err := gp.FunctionRegister(
func() *gopilot.Function {
return &gopilot.Function{
Name: "weather-agent",
Description: "Gets weather information for a specified city",
Parameters: map[string]gopilot.ParameterSchema{
"city": {
Type: "string",
Description: "The name of the city to get weather information for",
Required: true,
},
},
Execute: func(params map[string]interface{}) (interface{}, error) {
city, ok := params["city"].(string)
if !ok {
return nil, errors.New("city parameter must be a string")
}
// Placeholder for real weather API integration
return map[string]interface{}{
"city": city,
"temp": 25,
"condition": "sunny",
}, nil
},
}
}()); err != nil {
log.Fatal(err)
}
// Set system prompt (not optional)
gp.SetSystemPrompt()
// Generate and execute a command
input := "Get the weather for Istanbul"
response, err := gp.Generate(input)
if err != nil {
log.Fatal(err)
}
result, err := gp.FunctionExecute(response.Agent, response.Parameters)
if err != nil {
log.Fatal(err)
}
// Alternatively, use the combined method
// result, err := gp.GenerateAndExecute(input)
}
Installation
-
Ensure you have Go >=1.23
installed.
-
Clone the repository:
git clone https://github.com/SadikSunbul/gopilot.git
-
Install dependencies:
cd gopilot
go mod tidy
-
Set up your Gemini API key as an environment variable:
export GEMINI_API_KEY=your-api-key
Usage
- Import the GoPilot package into your Go project.
- Initialize a client for your chosen LLM (currently only Gemini is supported).
- Create and register functions or agents with defined parameters and execution logic.
- Use
Generate
and FunctionExecute
or the combined GenerateAndExecute
to process user inputs.
Contributing
We welcome contributions to GoPilot! To get started:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
).
- Make your changes and commit (
git commit -m "Add your feature"
).
- Push to your branch (
git push origin feature/your-feature
).
- Open a Pull Request.
Please read our CONTRIBUTING.md for more details.
Roadmap
- Support for additional LLMs (e.g., OpenAI, Anthropic).
- Enhanced error handling and logging.
- Pre-built agents for common tasks (e.g., file management, notifications).
- Web-based interface for easier interaction.
- Comprehensive test suite.
License
This project is licensed under the MIT License. See LICENSE for details.
For questions, suggestions, or issues, please:
- Open an issue on GitHub.
- Reach out to the maintainer: Sadik Sunbul