跳到正文
DEV Community· technonotes-hacker·· 3 小時前AI 評分19

LLM 工具呼叫與 MCP

LLM - Tool Calling & MCP

AI 導讀

LLM 工具呼叫由模型指出要呼叫的工具;MCP 是 AI 工具的通用標準,MCP client 會選擇要呼叫的方法。文中以 LangChain 説明一種工具呼叫方式,並指出自訂工具與 function calling 是相同概念的不同實作方式。資料庫工具在 PROD 僅允許 SELECT;加入人工介入後可使用 update,但在 PROD 更新仍有風險。

正文

technonotes-hacker

Function Calling - The Manual Tool LOOP

  • LLM ( ChatGroq ) Will say which tool needs to be called.
  • List or the Object will have some value.

  • This is with Langchain and one type of Tool Calling.

Custom Tool

  • Its a structured way.

External API Tools

  • These are the APIs which we are going to call.

Database Tools

  • Create a custom table.
  • We are allowing only SELECT in PROD.
  • But if we use HUMAN in the loop , then update can be also used - But make sure its also RISK to use in PROD to update a query.
  • Qwen Models --> Mostly you can use this for local testing.

MCP - Model Context Protocol

  • Its a protocol.

  • MCP is a common standard (like USB for AI tools).
  • MCP client will decide which method to call.

  • இப்ப ஒரு API expose பண்ணும்போது அதுல PUT GET எல்லாமே இருக்கும், but இந்த MCPல , APIல எல்லாத்தையும் club பண்ணி , எல்லாத்தையும் expose பண்ணுவாங்க . MCP cleint will take care which one to call like a Agent.

Questions & Things to know

Notes

  • Langchain is a Framework.
  • Function description --> https://developers.openai.com/api/docs/guides/function-calling?api-mode=responses
  • Tool Calling ( description , above one )
  • With pydantic we achieved DATA validation --> Return you will get in Object flow.
  • Sqlite --> File based DB.
  • esh --> english to shell , project --> https://github.com/numericalworks/esh
  • ER Model Will be generated from the tool , before LLM become famous.
  • Ollama or Llama cpp ?
  • Custom Tool or Function calling --> Both are same , there are different methods.
  • General Method --> API with swagger , You will get the request and response with PUT GET etc. Now the MCP Client will search and decide , which method to call.

來源:DEV Community · dev.to