Skip to content

Fix issue #190: Check Python version and locale encoding at startup - #444

Open
Sekhar03 wants to merge 22 commits into
NaomiProject:naomi-devfrom
Sekhar03:naomi-dev
Open

Fix issue #190: Check Python version and locale encoding at startup#444
Sekhar03 wants to merge 22 commits into
NaomiProject:naomi-devfrom
Sekhar03:naomi-dev

Conversation

@Sekhar03

Copy link
Copy Markdown

This pull request moves the Python version check to the top of Naomi.py and Populate.py (before naomi is imported) and adds a system locale check to warn the user if a non-UTF-8 locale is detected.

aaronchantrill and others added 13 commits December 15, 2024 20:08
This change basically gives Naomi the ability to use an LLM in
crafting responses. The LLM is contacted over a web api, so any
OpenAI compatible LLM server should be fine. I am currently using
llama.cpp on a system with an nVidia GeForce RTX 3060 with 12 GB
VRAM. I am currently using the following model:
https://huggingface.co/mav23/Llama_3.2_1B_Intruct_Tool_Calling_V2-GGUF/blob/main/llama_3.2_1b_intruct_tool_calling_v2.Q4_K_M.gguf
This is only a 3B parameter model, so it should run fine on cards
with less VRAM. I have also tried running it on an Intel graphics
card on my laptop using SyCL which seems to work fine.

This is very much experimental. The basic idea is that I use the
existing TTI parser to activate a plugin, then pass the output
from that plugin to the LLM as a system message. This allows the
LLM to use current data and answer questions like "What time is
it?" or "Are we expecting rain on Thursday?" I'm also looking into
using function calling which would allow the LLM to be used as
an intent parser and might make plugin activation more integrated,
but that has its own set of problems, including that different
models define and use plugins differently.

I also have included some notebooks. I plan to use these to create
a set of notebooks that will hopefully be helpful to people who
want to better understand how Naomi works internally.
The news and hacker news plugins were using a test mic, which did
not have the new use_llm property.
Add the ALPACA template used by SiliconMaid and Kunoichi models.
Added a conversation log in SQLite3, planning to move to JSON.
Started having the LLM use commands.
Added Zephyr template for working with TinyLlama.
Added support for FAISS intent parser.
…own beeps by discarding frames while playing audio
…age if python3-virtualenvwrapper does not provide virtualenvwrapper.sh
… to apt_requirements.txt; add --quiet/-q flag to skip interactive prompts
…ad_git helper in app_utils.py; fix DeprecationWarning invalid escape sequences in __main__.py and npe.py; add test_fixes.py (27 tests, all passing)
Comment thread Naomi.py
sys.stderr.write("WARNING: Your system locale is configured to use a non-UTF-8 character encoding ({}).\n".format(encoding))
sys.stderr.write("This may cause Naomi to crash when reading files or configuration containing international characters.\n")
sys.stderr.write("Please consider setting your system locale to UTF-8 (e.g. by setting LC_ALL=en_US.UTF-8 in Linux).\n")
except Exception:
Comment thread Populate.py
sys.stderr.write("WARNING: Your system locale is configured to use a non-UTF-8 character encoding ({}).\n".format(encoding))
sys.stderr.write("This may cause Naomi to crash when reading files or configuration containing international characters.\n")
sys.stderr.write("Please consider setting your system locale to UTF-8 (e.g. by setting LC_ALL=en_US.UTF-8 in Linux).\n")
except Exception:
@CLAassistant

CLAassistant commented Aug 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@Sekhar03

Copy link
Copy Markdown
Author

CLA Accepted

@aaronchantrill

Copy link
Copy Markdown
Contributor

Hello Sekhar, thank you for submitting to Naomi. I am reviewing your modifications now. I should have a comprehensive review sometime this weekend.

-Aaron

Comment thread naomi/llama_client.py
for row in result:
self._messages.append({'role': row[1], 'content': row[2]})
conn.close()
self.template = Template(TEMPLATES[template]['template'])
Comment thread naomi/llama_client.py
self.template = Template(TEMPLATES[template]['template'])
self.eot_markers = TEMPLATES[template]['eot_markers']
self.emoji_filter = re.compile("["
U"\U0001F600-\U0001F64F" # emoticons
Comment thread naomi/llama_client.py
self.template = Template(TEMPLATES[template]['template'])
self.eot_markers = TEMPLATES[template]['eot_markers']
self.emoji_filter = re.compile("["
U"\U0001F600-\U0001F64F" # emoticons
Comment thread naomi/llama_client.py
self.template = Template(TEMPLATES[template]['template'])
self.eot_markers = TEMPLATES[template]['eot_markers']
self.emoji_filter = re.compile("["
U"\U0001F600-\U0001F64F" # emoticons
Comment thread naomi/llama_client.py
self.template = Template(TEMPLATES[template]['template'])
self.eot_markers = TEMPLATES[template]['eot_markers']
self.emoji_filter = re.compile("["
U"\U0001F600-\U0001F64F" # emoticons
Comment thread naomi/llama_client.py
self.eot_markers = TEMPLATES[template]['eot_markers']
self.emoji_filter = re.compile("["
U"\U0001F600-\U0001F64F" # emoticons
U"\U0001F300-\U0001F5FF" # symbols & pictographs
Comment thread naomi/mic_asynchronous.py
else:
self.actions_queue.appendleft(lambda: self.tts(phrase))
if "[shutdown]" in phrase.lower() or "[shut down]" in phrase.lower():
self.actions_queue.appendleft(lambda: self.shutdown())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants