First, about my setup, the host system runs Windows 11, and all tools are installed in a Windows 11 virtual machine using VMware.
On the host system, to fully utilize the available resources, I installed
Ollama with the
qwen2.5-coder model, as well as
OpenWebUI via
Docker.
Inside the VMware environment, I created an ASP.NET Core Web API project in Visual Studio, which automatically generated the WeatherForecastController.
Since Docker is running on the host system and the WeatherForecastController is running inside VMware, I changed the settings of my ASP.NET Core Web API to allow access from outside the virtual machine.
My \Properties\launchSettings.json file looks like this:
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5259",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://0.0.0.0:7216;https://0.0.0.0:7217",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
This means that the controller was accessible via the following endpoint:
https://192.168.2.50:7217/WeatherForecast
In OpenWebUI tools, I wrote:
import requests
import urllib3
class Tools:
def today_from_csharp_http(self) -> str:
"""
Get the current weather.
"""
url = "https://192.168.2.50:7217/WeatherForecast"
try:
r = requests.get(url, timeout=5, verify=False)
r.raise_for_status()
data = r.json()
if not isinstance(data, list) or len(data) == 0:
return f"Unexpected JSON: {type(data).__name__}: {data}"
first = data[0]
date = first.get("date")
summary = first.get("summary")
temp = first.get("temperatureC")
return f"OK: {date} | {summary} | {temp}°C"
except Exception as e:
return f"HTTP request failed: {e}"
The tool must be enabled for this model by checking the corresponding tool checkbox.