HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //opt/textanalyse/agents/dictionary_agent.py
# agents/dictionary_agent.py
from agno.agent import Agent
from textwrap import dedent

# Import the specific tool function
from tools.dictionary_tool import check_word_in_dictionary
from tools.segmentation_tool import split_sentences
from tools.morphology_tool import analyze_morphology
# Import model config
from config import SelectedModelClass, SELECTED_MODEL_ID, SELECTED_API_KEY

# Agent definition
DictionaryAgent = None
if SelectedModelClass:
    DictionaryAgent = Agent(
        name="DictionaryExpert",
        # Use the model selected in config.py
        model=SelectedModelClass(id=SELECTED_MODEL_ID, api_key=SELECTED_API_KEY),
        role="Verify if words belong to the official 7000-word list.",
        instructions=dedent("""\
            1. Receive a segment of text.
            2. Use the 'check_word_in_dictionary' tool to identify which words in the text are NOT on the official list.
            3. The tool automatically preprocesses the text (lowercase, splits into words, removes punctuation).
            4. The tool returns a list of non-official words found in the text.
            5. Return this list directly, with no additional comments or formatting.
            6. The expected output is just the list of non-official words. 
            7. If no non-official words are found (the tool returns an empty list), you should still return that empty list as your final answer.
        """),
        tools=[split_sentences, analyze_morphology, check_word_in_dictionary],
        show_tool_calls=False, # Keep False for cleaner production output
        markdown=False, # Output is a list, not markdown text
        # Add memory/storage if needed for context across chunks
    )
else:
    print("ERROR: DictionaryAgent could not be created due to invalid model configuration.")