Skip to content

Go-based financial AI agent providing cryptocurrency prices, IBAN validation, and financial data through OpenAI GPT-3.5 integration. Features Docker deployment and RESTful API.

Notifications You must be signed in to change notification settings

spolia/finance-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Finance Agent

A Go-based financial assistant that provides real-time cryptocurrency prices, IBAN validation, and financial information through an AI-powered chat interface.

Features

  • 🤖 AI-Powered Chat: Interactive chat interface using OpenAI GPT-3.5
  • 💰 Cryptocurrency Data: Real-time prices for Bitcoin and other cryptocurrencies
  • 🏦 IBAN Validation: Validate and get information about International Bank Account Numbers
  • 🔧 Tool Integration: Seamless integration with external APIs for financial data
  • 🐳 Docker Support: Easy deployment with Docker and Docker Compose

Prerequisites

  • Go 1.23.6 or higher
  • Docker and Docker Compose (optional)
  • OpenAI API Key
  • Ninja API Key

Installation

Local Development

  1. Clone the repository:
git clone <repository-url>
cd finance-agent
  1. Create a .env file in the root directory:
OPENAI_API_KEY=your_openai_api_key_here
NINJA_API_KEY=your_ninja_api_key_here
  1. Install dependencies:
go mod download
  1. Run the application:
go run cmd/main.go

The server will start on http://localhost:8080

Docker Deployment

  1. Build and run with Docker Compose:
docker-compose up --build

API Usage

Chat Endpoint

POST /ask

Request body:

{
  "user_id": "user123",
  "question": "What's the current Bitcoin price?"
}

Response:

{
  "code": 200,
  "status": "OK",
  "data": {
    "user_id": "user123",
    "question": "What's the current Bitcoin price?",
    "answer": "The current Bitcoin price is $45,000 USD. This information is based on real-time market data from cryptocurrency exchanges.",
    "messages": [
      {
        "role": "user",
        "content": "What's the current Bitcoin price?"
      },
      {
        "role": "assistant",
        "content": "The current Bitcoin price is $45,000 USD. This information is based on real-time market data from cryptocurrency exchanges."
      }
    ]
  }
}

Error Response

{
  "code": 400,
  "status": "Bad Request",
  "error": "Validation error message"
}

Available Tools

The AI agent can use the following tools:

  • get_last_bitcoin_price: Returns the current Bitcoin price
  • get_crypto_price: Returns the price of a specific cryptocurrency
  • get_iban_information: Validates and provides information about IBAN numbers

Project Structure

finance-agent/
├── cmd/
│   ├── main.go          # Application entry point
│   └── api/
│       ├── handler.go   # HTTP request handlers
│       └── router.go    # Route definitions
├── internal/
│   ├── agent/
│   │   ├── agent.go     # Main agent logic
│   │   ├── mcp/         # Memory/context management
│   │   └── tools/       # Tool definitions and handlers
│   └── platform/
│       └── ninjaclient/ # External API client
├── dockerfile
├── docker-compose.yml
├── go.mod
└── README.md

Environment Variables

Variable Description Required
OPENAI_API_KEY OpenAI API key for GPT-3.5 Yes
NINJA_API_KEY Ninja API key for financial data Yes

Development

Running Tests

go test ./...

Building

go build -o finance-agent cmd/main.go

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Support

For support and questions, please open an issue in the repository.

About

Go-based financial AI agent providing cryptocurrency prices, IBAN validation, and financial data through OpenAI GPT-3.5 integration. Features Docker deployment and RESTful API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages