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! π΄β‘οΈπ€"
- 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 πβ‘οΈβ
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
- .NET 6+ SDK
- Ollama (with at least one LLM installed)
- F# Interactive (
dotnet tool install -g fsi)
- Clone the repository:
git clone https://github.com/pwrmind/IntelliFSharp.git
cd IntelliFSharp- Run the project:
dotnet runModify 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π© 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";
- Add More Models - Try different Ollama models:
const string modelName = "codellama:7b"; // Smaller/faster model- Extend Timeouts - For complex tasks:
bool completed = outputCompleted.WaitOne(30000); // 30s timeout- 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
- Requires running Ollama instance
- Simple error handling (WIP)
- FSI state persists between runs
- Currently supports single-file programs
- 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!