LLamaSharp
LLamaSharp copied to clipboard
[Feature]: Tool Calling Support
Background & Description
With some new LLMs, there are new features called tool calling, such as with Qwen 4B 2507 Instruct with Qwen Agent. I would like LlamaSharp to harness this power and become more agentic, as shown in this Python example:
from qwen_agent.agents import Assistant
llm_cfg = {
'model': 'Qwen3-4B-Instruct-2507',
'model_server': 'http://localhost:8000/v1', # api_base
'api_key': 'EMPTY',
}
tools = [
{
'mcpServers': {
'time': {
'command': 'uvx',
'args': ['mcp-server-time', '--local-timezone=Asia/Shanghai']
},
'fetch': {
'command': 'uvx',
'args': ['mcp-server-fetch']
}
}
},
'code_interpreter',
]
bot = Assistant(llm=llm_cfg, function_list=tools)
messages = [{
'role': 'user',
'content': 'https://qwenlm.github.io/blog/ Introduce the latest developments of Qwen'
}]
for responses in bot.run(messages=messages):
pass
print(responses)
This way we can get more out of LlamaSharp inference and help the future of agentic AI.
API & Usage
Maybe you could try integrating Qwen Agent or a similar solution into LlamaSharp.
How to implement
No response
It can be done in LlamaSharp. I did it today with Tinyagent-1.1b.
You have to load the LLamaSharp.KernelMemory for RAG operations. It's flimsy but works.
using LLamaSharp.KernelMemory;
It can be done in LlamaSharp. I did it today with Tinyagent-1.1b.
You have to load the LLamaSharp.KernelMemory for RAG operations. It's flimsy but works.
using LLamaSharp.KernelMemory;
Are there any examples of such an implementation?
@rockofme1
You should use SemanticKernel.
- You can find examples of function calling in (SemanticKernel) Here:
https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/Concepts
- And you can find examples of Model Context Protocol, here:
https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/Demos
It depends if you want to use functions / tools in your code or implemented in a MCP server.