tryAGI / tryAGI/LangChain

Failed to run Checking-internet-speed-with-Crew-and-Ollama

Open
#440 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
1.1k
Forks
141
Avg merge
2d 18m
Merged PRs (30d)
2

Description

Describe the bug

https://github.com/tryAGI/LangChain/wiki/Checking-internet-speed-with-Crew-and-Ollama

I Change the code sample such as:
using System.Diagnostics;
using System.Net;
using LangChain.Chains.StackableChains.Agents.Crew;
using LangChain.Chains.StackableChains.Agents.Crew.Tools;
using LangChain.Providers;
using LangChain.Providers.Ollama;
using Ollama;
using static LangChain.Chains.Chain;
using static LangChain.Chains.StackableChains.Agents.Crew.CrewChain;

Console.WriteLine("Hello, World!");

//var model = new OllamaLanguageModelInstruction("mistral:latest",
// "http://localhost:11434",
// options: new OllamaLanguageModelOptions()
// {
// Stop = new[] { "Observation", "[END]" }, // add injection word Observation and [END] to stop the model(just as additional safety feature)
// Temperature = 0
// }).UseConsoleForDebug(); // we want to see what is going on
// 2. Create a model
var model = new OllamaChatModel(new OllamaProvider(options: new RequestOptions
{
Temperature = 0,
Stop = ["User:"],
}), "llama3.1:latest");

var pingTool = new CrewAgentToolLambda("ping", "executes ping on specified ip address", address =>
{
var addressParsed = IPAddress.Parse(address);
var process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "ping",
Arguments = "-n 5 " + addressParsed,
RedirectStandardOutput = true,
UseShellExecute = false,
CreateNoWindow = true
}
};
process.Start();
string result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return Task.FromResult(result);
});

// controls agents
var manager = new CrewAgent(model, "manager", "assign task to one of your co-workers and return the result");

// the actual agent who does the job
var pinger = new CrewAgent(model, "pinger", "checks the speed of internet connection",
"you using ping command and analyzing it's result. After this you print a single number as your final answer(the connection speed in milliseconds).");

pinger.AddTools(new[] { pingTool });

var chain =
Set("What is my ping to google's main dns server?")
| Crew(new[] { manager, pinger }, manager);

// get response and send it as AI answer
var res = await chain.RunAsync("text", CancellationToken.None);
Console.WriteLine(res);

I got nothing: res

Steps to reproduce the bug

run the sample code , get nothing.

Expected behavior

No response

Screenshots

image

NuGet package version

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Checking-internet-speed-with-Crew-and-Ollama wiki example and run the posted C# sample using OllamaChatModel, CrewAgent, and chain.RunAsync. Trace the returned res value and the manager/pinger interaction; done means the sample produces the expected ping result, which should be clarified because the issue currently reports only an empty result.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, ollama
Domain
ai
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.