rmusser01 / tldw

tl/dw (Too Long, Didn't Watch): Your Personal Research Multi-Tool - a naive attempt at 'A Young Lady's Illustrated Primer'
Apache License 2.0
272 stars 9 forks source link

Connecting to an local network instance of ollama fails #388

Open DIGist opened 22 hours ago

DIGist commented 22 hours ago

Are You on the Latest version? You did a git pull and are running the latest version/build? Y

Please describe the bug attempting to connect to a network instance of ollama, it still seems to be trying to control the llama instance through ollama cli config.txt: ollama_api_IP = http://myserver:33821/v1/chat/completions ollama_api_key = 411 ollama_model = qwen2.5

running: python summarize.py -gui -api ollama --local_llm tried with and without the --local_llm switch

log:

INFO:root:Local LLM flag: True /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1002: UserWarning: Expected 12 arguments for function <function import_file_handler at 0x7fb2dd96c540>, received 11. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1006: UserWarning: Expected at least 12 arguments for function <function import_file_handler at 0x7fb2dd96c540>, received 11. warnings.warn( INFO:App_Function_Libraries.DB.RAG_QA_Chat_DB:Retrieved page 1 of 0 (total items: 0) INFO:App_Function_Libraries.DB.RAG_QA_Chat_DB:Retrieved 0 conversations (page 1 of 0) INFO:App_Function_Libraries.DB.RAG_QA_Chat_DB:Retrieved page 1 of 0 (total items: 0) INFO:App_Function_Libraries.DB.RAG_QA_Chat_DB:Retrieved 0 conversations (page 1 of 0) /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1002: UserWarning: Expected 14 arguments for function <function create_rag_qa_chat_tab..rag_qa_chat_wrapper at 0x7fb2d865dd00>, received 13. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1006: UserWarning: Expected at least 14 arguments for function <function create_rag_qa_chat_tab..rag_qa_chat_wrapper at 0x7fb2d865dd00>, received 13. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1002: UserWarning: Expected 3 arguments for function <function save_chat_history at 0x7fb2da6696c0>, received 2. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1006: UserWarning: Expected at least 3 arguments for function <function save_chat_history at 0x7fb2da6696c0>, received 2. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1002: UserWarning: Expected 1 arguments for function <function show_edit_message at 0x7fb2da6684a0>, received 0. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1006: UserWarning: Expected at least 1 arguments for function <function show_edit_message at 0x7fb2da6684a0>, received 0. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1002: UserWarning: Expected 1 arguments for function <function show_delete_message at 0x7fb2da668d60>, received 0. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1006: UserWarning: Expected at least 1 arguments for function <function show_delete_message at 0x7fb2da668d60>, received 0. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1002: UserWarning: Expected 4 arguments for function <function create_character_card_interaction_tab..import_chat_history at 0x7fb2d84ed6c0>, received 3. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1006: UserWarning: Expected at least 4 arguments for function <function create_character_card_interaction_tab..import_chat_history at 0x7fb2d84ed6c0>, received 3. warnings.warn( {"asctime": "2024-10-22 06:59:30,257", "levelname": "INFO", "name": "tldw_app_logs", "event": "load_characters_attempt", "type": "counter", "value": 1, "labels": {}, "timestamp": "2024-10-22T06:59:30.257466+00:00Z", "taskName": null} INFO:tldw_app_logs:metric WARNING:root:Characters file not found: /tldw/App_Function_Libraries/../Helper_Scripts/Character_Cards/Characters.json /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1002: UserWarning: Expected 5 arguments for function <function adjust_tone at 0x7fb2da694fe0>, received 3. warnings.warn( /tldw/venv/lib/python3.12/site-packages/gradio/utils.py:1006: UserWarning: Expected at least 5 arguments for function <function adjust_tone at 0x7fb2da694fe0>, received 3. warnings.warn( Traceback (most recent call last): File "/tldw/summarize.py", line 861, in launch_ui(share_public=False) File "/tldw/App_Function_Libraries/Gradio_Related.py", line 388, in launch_ui create_ollama_tab() File "/tldw/App_Function_Libraries/Local_LLM/Local_LLM_ollama.py", line 66, in create_ollama_tab model_list = gr.Dropdown(label="Available Models", choices=get_ollama_models()) ^^^^^^^^^^^^^^^^^^^ File "/tldw/App_Function_Libraries/Local_LLM/Local_LLM_ollama.py", line 12, in get_ollama_models result = subprocess.run(['ollama', 'list'], capture_output=True, text=True, check=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/subprocess.py", line 548, in run with Popen(*popenargs, **kwargs) as process: ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/subprocess.py", line 1026, in init self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) FileNotFoundError: [Errno 2] No such file or directory: 'ollama'

Is the bug reproducable reliably? Yes

What was the expected behavior? connect to a networked ollama instance

rmusser01 commented 10 hours ago

@DIGist Thank you for filing this issue.

The --local_llm flag is on its way to being deprecated, and shouldn't be used, since the equivalent functionality can be achieved through the GUI.

the -api flag should only be used when you're using the program only through the CLI, otherwise you have to manually specific it from the dropdown. I am planning on adding a 'default_api' to the config.txt file, but it's not currently in yet.

Regarding the error, is this occurring immediately after application start, or after you've attempted to perform some action within the GUI?

I've gone ahead and refactored the Ollama_tab so it now does lazy loading, which should fix that issue? (I think?)

Please do a clone/update the local copy and let me know if it works.

(Thanks again for filing this, really appreciate it)