Tools not beeing applied to the Ollama call #1819

Closed
opened 2025-11-11 14:53:54 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @janinspark on GitHub (Aug 19, 2024).

Bug Report

Installation Method

pip installation and verified the same behaviour on the docker :dev as well as the normal container

Environment

  • Open WebUI Version: v0.3.13

  • Ollama (if applicable): 0.3.6

  • Operating System: Ubuntu 22.04

Confirmation:

  • I have read and followed all the instructions provided in the README.md.
  • I am on the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below.

Expected Behavior:

expected behavior is that a "Tool" is beeing used by the LLM.

here is my example that works nicely in langchain:

OLLAMA_MODEL = "llama3.1:70b"
messages = [
SystemMessage("You are a helpful assistant. If you find a code snippet to be executed, populate the Tools; if not, set it to []."),
HumanMessage("Provide summarize the content of the file ./main.py")
]

llm = ChatOllama(
model=OLLAMA_MODEL,
temperature=0,
)

tools_llm = llm.bind_tools([
clone_or_pull_git_repo, # Clone or pull Git repositories
create_and_switch_to_branch, # Create and switch to a new branch
list_files_in_directory,
create_directory,
delete_file,
delete_directory,
write_to_file, # Write to a file
read_from_file, # Read from a file
update_file, # Update (append to) a file
export_sqlite_ddl, # Export DDL from SQLite
read_sqlite_table, # Read data from an SQLite table
get_sqlite_table_columns, # Get columns from an SQLite table
export_postgres_ddl, # Export DDL from PostgreSQL
read_postgres_table, # Read data from a PostgreSQL table
get_postgres_table_columns # Get columns from a PostgreSQL table
])

result = tools_llm.invoke(messages)
for tool_call in result.tool_calls:
tool_name = tool_call["name"].lower()
selected_tool = {
"clone_or_pull_git_repo": clone_or_pull_git_repo,
"create_and_switch_to_branch": create_and_switch_to_branch,
"list_files_in_directory": list_files_in_directory,
"create_directory": create_directory,
"delete_file": delete_file,
"delete_directory": delete_directory,
"write_to_file": write_to_file,
"read_from_file": read_from_file,
"update_file": update_file,
"export_sqlite_ddl": export_sqlite_ddl,
"read_sqlite_table": read_sqlite_table,
"get_sqlite_table_columns": get_sqlite_table_columns,
"export_postgres_ddl": export_postgres_ddl,
"read_postgres_table": read_postgres_table,
"get_postgres_table_columns": get_postgres_table_columns
}[tool_name]
print(tool_name)
print(tool_call["args"])
tool_output = selected_tool(**tool_call["args"])
print("Tool Output:")
print(tool_output)
messages.append(ToolMessage(json.dumps(tool_output), tool_call_id=tool_call["id"]))

print("Updated Messages:")
print(messages)
r = tools_llm.invoke(messages)

Actual Behavior:

The LLM seems unaware of the tools (LLama 3.1 70b). When using langchain with the same exact prompt its working nicely. When using the web-ui the same requests doesnt "fill" the tool.
Tools i use:
Supreme File Management

Description

Bug Summary:
Tools bindings from ollama seems to be non working

Reproduction Details

Steps to Reproduce:
Install open-webui / ollama pull any LLama3.1 model and try to use a Tool with it, its creating empty "tools"

Logs and Screenshots

image

Docker Container Logs:
image

Additional Information

Screenshot from 2024-08-19 19-10-07

it seems to be completely unaware of the tools that it should be able to execute and tries to "populate" an mkdir which i never defined.

Note

If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!

Originally created by @janinspark on GitHub (Aug 19, 2024). # Bug Report ## Installation Method pip installation and verified the same behaviour on the docker :dev as well as the normal container ## Environment - **Open WebUI Version:** v0.3.13 - **Ollama (if applicable):** 0.3.6 - **Operating System:** Ubuntu 22.04 **Confirmation:** - [X] I have read and followed all the instructions provided in the README.md. - [X] I am on the latest version of both Open WebUI and Ollama. - [ ] I have included the browser console logs. - [X] I have included the Docker container logs. - [X] I have provided the exact steps to reproduce the bug in the "Steps to Reproduce" section below. ## Expected Behavior: expected behavior is that a "Tool" is beeing used by the LLM. here is my example that works nicely in langchain: OLLAMA_MODEL = "llama3.1:70b" messages = [ SystemMessage("You are a helpful assistant. If you find a code snippet to be executed, populate the Tools; if not, set it to []."), HumanMessage("Provide summarize the content of the file ./main.py") ] llm = ChatOllama( model=OLLAMA_MODEL, temperature=0, ) tools_llm = llm.bind_tools([ clone_or_pull_git_repo, # Clone or pull Git repositories create_and_switch_to_branch, # Create and switch to a new branch list_files_in_directory, create_directory, delete_file, delete_directory, write_to_file, # Write to a file read_from_file, # Read from a file update_file, # Update (append to) a file export_sqlite_ddl, # Export DDL from SQLite read_sqlite_table, # Read data from an SQLite table get_sqlite_table_columns, # Get columns from an SQLite table export_postgres_ddl, # Export DDL from PostgreSQL read_postgres_table, # Read data from a PostgreSQL table get_postgres_table_columns # Get columns from a PostgreSQL table ]) result = tools_llm.invoke(messages) for tool_call in result.tool_calls: tool_name = tool_call["name"].lower() selected_tool = { "clone_or_pull_git_repo": clone_or_pull_git_repo, "create_and_switch_to_branch": create_and_switch_to_branch, "list_files_in_directory": list_files_in_directory, "create_directory": create_directory, "delete_file": delete_file, "delete_directory": delete_directory, "write_to_file": write_to_file, "read_from_file": read_from_file, "update_file": update_file, "export_sqlite_ddl": export_sqlite_ddl, "read_sqlite_table": read_sqlite_table, "get_sqlite_table_columns": get_sqlite_table_columns, "export_postgres_ddl": export_postgres_ddl, "read_postgres_table": read_postgres_table, "get_postgres_table_columns": get_postgres_table_columns }[tool_name] print(tool_name) print(tool_call["args"]) tool_output = selected_tool(**tool_call["args"]) print("Tool Output:") print(tool_output) messages.append(ToolMessage(json.dumps(tool_output), tool_call_id=tool_call["id"])) print("Updated Messages:") print(messages) r = tools_llm.invoke(messages) ## Actual Behavior: The LLM seems unaware of the tools (LLama 3.1 70b). When using langchain with the same exact prompt its working nicely. When using the web-ui the same requests doesnt "fill" the tool. Tools i use: Supreme File Management ## Description **Bug Summary:** Tools bindings from ollama seems to be non working ## Reproduction Details **Steps to Reproduce:** Install open-webui / ollama pull any LLama3.1 model and try to use a Tool with it, its creating empty "tools" ## Logs and Screenshots ![image](https://github.com/user-attachments/assets/9179f702-aa97-43c4-9ca2-8e03fec46c71) **Docker Container Logs:** ![image](https://github.com/user-attachments/assets/96a0599c-dffd-480c-aba3-848204d01b8e) ## Additional Information ![Screenshot from 2024-08-19 19-10-07](https://github.com/user-attachments/assets/33f7f85e-54a8-4a04-9ef3-bd2cab97b5c1) it seems to be completely unaware of the tools that it should be able to execute and tries to "populate" an mkdir which i never defined. ## Note If the bug report is incomplete or does not follow the provided instructions, it may not be addressed. Please ensure that you have followed the steps outlined in the README.md and troubleshooting.md documents, and provide all necessary information for us to reproduce and address the issue. Thank you!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#1819