Skip to content

pwrmind/IntelliFSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

IntelliFSharp

πŸš€ IntelliFSharp - F# Code Runner with LLM Feedback Loop

An AI-powered playground where your F# code gets automatically tested and fixed! This project uses Large Language Models (Ollama) to generate F# code, executes it in real-time, and sends errors back to the AI for auto-correction πŸ”„

"It's like having a pair programmer who never sleeps! πŸ˜΄βž‘οΈπŸ€–"

🌟 Key Features

  • AI-Powered Code Generation - Uses Ollama LLMs to write F# code
  • Real-Time Execution - Runs code in F# Interactive (FSI) sandbox
  • Auto-Debugger - Sends errors back to AI for automatic fixes
  • Smart Feedback Loop - Up to 3 correction attempts
  • Emoji-Powered Logging - Because debugging should be fun πŸ›βž‘οΈβœ…

βš™οΈ How It Works

sequenceDiagram
    participant User
    participant Program
    participant Ollama
    participant FSI
    
    User->>Program: Start program
    Program->>Ollama: Send system message
    Ollama-->>Program: Acknowledge
    Program->>Ollama: Send coding task
    Ollama-->>Program: Generated F# code
    Program->>FSI: Execute code
    alt Success
        FSI-->>Program: Results
        Program-->>User: πŸŽ‰ Success + Output
    else Error
        FSI-->>Program: Error details
        Program->>Ollama: Send errors
        Ollama-->>Program: Fixed code
        loop Max 3 attempts
            Program->>FSI: Retry fixed code
        end
    end
Loading

πŸš€ Getting Started

Prerequisites

  • .NET 6+ SDK
  • Ollama (with at least one LLM installed)
  • F# Interactive (dotnet tool install -g fsi)

Installation

  1. Clone the repository:
git clone https://github.com/pwrmind/IntelliFSharp.git
cd IntelliFSharp
  1. Run the project:
dotnet run

Configuration

Modify these constants in Program.cs:

const string modelName = "deepseek-coder-v2:latest"; // Change to your preferred model
const int maxAttempts = 3; // Max auto-fix attempts

πŸ§ͺ Example Run

πŸ“© Sending system message...
βœ… System message sent

πŸ“€ Sending task:
πŸ“ Task: Write F# function calculating sum of squares from 1 to n

πŸ“₯ LLM response:
Here's the F# code:
```fsharp
let sumOfSquares n = 
    [1..n] |> List.map (fun x -> x * x) |> List.sum

sumOfSquares 5;;

⚑ Executing block #1... βœ… stdout: 55 ❗ stderr:

πŸŽ‰ Code executed successfully! πŸ“‹ Results: πŸ“¦ Block #1 result: 55 ══════════════════════


## πŸ› οΈ Customization Tips
1. **Change Tasks** - Modify the `taskMsg` variable for different challenges:
```csharp
var taskMsg = "πŸ“ Task: Write F# function to calculate Fibonacci sequence";
  1. Add More Models - Try different Ollama models:
const string modelName = "codellama:7b"; // Smaller/faster model
  1. Extend Timeouts - For complex tasks:
bool completed = outputCompleted.WaitOne(30000); // 30s timeout

πŸ€” Why This Is Cool

  • Perfect for Learning F# - See how AI solves programming challenges
  • Debugging Assistant - Watch how LLMs fix their own mistakes
  • Prototyping Tool - Quickly test algorithmic ideas
  • LLM Testing Platform - Evaluate code generation quality

🚧 Known Limitations

  • Requires running Ollama instance
  • Simple error handling (WIP)
  • FSI state persists between runs
  • Currently supports single-file programs

🌈 Future Improvements

  • Add support for multiple files
  • Implement FSI session reset
  • Add GUI interface
  • Support other languages (Python, JavaScript)
  • Add benchmark mode

Made with ❀️ and too much coffee β˜• by [Your Name Here]. Contribute and make it better!

About

IntelliFSharp - An AI-powered playground where your F# code gets automatically tested and fixed! This project uses Large Language Models (Ollama) to generate F# code, executes it in real-time, and sends errors back to the AI for auto-correction πŸ”„

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages