ollama
library
Ollama の使用方法: ローカル LLM の実践とチャットボットの構築 | HackerNoon
homebrew で入る
code:run
$ brew install ollama
$ ollama serve # で
$ ollama run phi3
command
/clear
/set
tool 呼ぶ
curl で
Using ollama tools via curl
code:curl.sh
curl http://localhost:11434/api/chat -s -d @- <<JSON | jq .
{
"model": "cogito:8b",
"tools": [
{
"type": "function",
"function": {
"name": "add_numbers",
"description": "Add two numbers together",
"parameters": {
"type": "object",
"properties": {
"a": {
"type": "number",
"description": "First number to add"
},
"b": {
"type": "number",
"description": "Second number to add"
}
},
"required": "a", "b"
}
}
},
{
"type": "function",
"function": {
"name": "get_current_time",
"description": "Get the current time",
"parameters": {
"type": "object",
"properties": {
"timezone": {
"type": "string",
"description": "The timezone to get the current time for, e.g. 'UTC', 'America/New_York', 'Asia/Tokyo'"
}
},
"required": "timezone"
}
}
}
],
"messages": [
{
"role": "user",
"content": "今ニューヨークは何時?"
}
],
"stream": false
}
JSON
#LLM