[
  {
    "path": ".dockerignore",
    "content": "# Python cache files\n__pycache__/\n*.py[cod]\n\n# Virtual environments\nagentic_seek_env/\n.agentic_seek_env/\n\n.env\n\n# Git metadata\n.git/\n\n# macOS Finder files\n.DS_Store\n\n# Log files\n*.log"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: [Fosowl ]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]\n\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the bug**\nA clear and concise description of what the bug is.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n1. Go to '...'\n2. Click on '....'\n3. Scroll down to '....'\n4. See error\n\n**Expected behavior**\nA clear and concise description of what you expected to happen.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**LLM Model used**\nThe model you used, for example deepseek-r1:14b\n\n**Desktop (please complete the following information):**\n - OS: [e.g. iOS]\n - Browser [e.g. chrome, safari]\n - Version [e.g. 22]\n\n**Additional context**\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".gitignore",
    "content": "*.wav\n*.DS_Store\n*.log\n*.tmp\n*.safetensors\n*.egg-info\ncookies.json\ntest_agent.py\nsearxng/uwsgi.ini.new\nsearxng/settings.yml.new\nconfig.ini\n.voices/\nexperimental/\nchrome_bundle/\n.logs/\n.screenshots/*.png\n.screenshots/*.jpg\nconversations/\nagentic_env/*\nagentic_seek_env/*\n.env\n*/.env\ndsk/\nchrome136/\n\n### react ###\n.DS_*\n*.log\nlogs\n**/*.backup.*\n**/*.back.*\nnode_modules\nbower_components\n*.sublime*\npsd\nthumb\nsketch\n\n\n# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\nwheels/\nshare/python-wheels/\n*.egg-info/\n.installed.cfg\n*.egg\nMANIFEST\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.nox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*.cover\n*.py,cover\n.hypothesis/\n.pytest_cache/\ncover/\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\nlocal_settings.py\ndb.sqlite3\ndb.sqlite3-journal\n\n# Flask stuff:\ninstance/\n.webassets-cache\n\n# Scrapy stuff:\n.scrapy\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\n.pybuilder/\ntarget/\n\n# Jupyter Notebook\n.ipynb_checkpoints\n\n# IPython\nprofile_default/\nipython_config.py\n\n# pyenv\n#   For a library or package, you might want to ignore these files since the code is\n#   intended to run in multiple environments; otherwise, check them in:\n# .python-version\n\n# pipenv\n#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.\n#   However, in case of collaboration, if having platform-specific dependencies or dependencies\n#   having no cross-platform support, pipenv may install dependencies that don't work, or not\n#   install all needed dependencies.\n#Pipfile.lock\n\n# UV\n#   Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.\n#   This is especially recommended for binary packages to ensure reproducibility, and is more\n#   commonly ignored for libraries.\n#uv.lock\n\n# poetry\n#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.\n#   This is especially recommended for binary packages to ensure reproducibility, and is more\n#   commonly ignored for libraries.\n#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control\n#poetry.lock\n\n# pdm\n#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.\n#pdm.lock\n#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it\n#   in version control.\n#   https://pdm.fming.dev/latest/usage/project/#working-with-version-control\n.pdm.toml\n.pdm-python\n.pdm-build/\n\n# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm\n__pypackages__/\n\n# Celery stuff\ncelerybeat-schedule\ncelerybeat.pid\n\n# SageMath parsed files\n*.sage.py\n\n# Environments\n.env\n.venv\nenv/\nvenv/\nENV/\nenv.bak/\nvenv.bak/\n\n# Spyder project settings\n.spyderproject\n.spyproject\n\n# Rope project settings\n.ropeproject\n\n# mkdocs documentation\n/site\n\n# mypy\n.mypy_cache/\n.dmypy.json\ndmypy.json\n\n# Pyre type checker\n.pyre/\n\n# pytype static type analyzer\n.pytype/\n\n# Cython debug symbols\ncython_debug/\n\n# PyCharm\n#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can\n#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore\n#  and can be added to the global gitignore or merged into this file.  For a more nuclear\n#  option (not recommended) you can uncomment the following to ignore the entire idea folder.\n#.idea/\n\n# PyPI configuration file\n.pypirc\n"
  },
  {
    "path": ".pre-commit-config.yaml",
    "content": "repos:\n  - repo: local\n    hooks:\n      - id: trufflehog\n        name: TruffleHog\n        description: Detect secrets in your data.\n        entry: bash -c 'trufflehog git file://. --since-commit HEAD --results=verified,unknown --no-update'\n        language: system\n        stages: [\"commit\", \"push\"]"
  },
  {
    "path": ".python-version",
    "content": "3.10\n"
  },
  {
    "path": "Dockerfile.backend",
    "content": "\nFROM --platform=linux/amd64 python:3.11.12\nENV DEBIAN_FRONTEND=noninteractive\n\n# Install essential packages and Chrome dependencies\nRUN apt-get update -y && apt-get install -y \\\n    wget \\\n    gnupg2 \\\n    ca-certificates \\\n    unzip \\\n    xvfb \\\n    libxss1 \\\n    #libappindicator1 \\\n    fonts-liberation \\\n    libnss3 \\\n    libatk1.0-0 \\\n    libatk-bridge2.0-0 \\\n    libcups2 \\\n    libdrm2 \\\n    libxcomposite1 \\\n    libxdamage1 \\\n    libxrandr2 \\\n    xdg-utils \\\n    dbus \\\n    && rm -rf /var/lib/apt/lists/*\n\nRUN apt-get update -y && \\\n      apt-get install -y \\\n      gcc \\\n      g++ \\\n      gfortran \\\n      libportaudio2 \\\n      portaudio19-dev \\\n      ffmpeg \\\n      libavcodec-dev \\\n      libavformat-dev \\\n      libavutil-dev \\\n      gnupg2 \\\n      wget \\\n      unzip \\\n      python3 \\\n      python3-pip \\\n      libasound2 \\\n      libatk-bridge2.0-0 \\\n      libgtk-4-1 \\\n      libnss3 \\\n      xdg-utils \\\n      wget \\\n    && rm -rf /var/lib/apt/lists/*\n\n\nRUN apt-get update -y && \\\napt-get install -y \\\n  alsa-utils \\\n&& rm -rf /var/lib/apt/lists/*\n\nENV CHROME_TESTING_VERSION=134.0.6998.88\nENV DISPLAY=:99\n\nWORKDIR /app\n\nRUN set -eux; \\\n    wget -qO /tmp/chrome.zip \\\n      \"https://storage.googleapis.com/chrome-for-testing-public/${CHROME_TESTING_VERSION}/linux64/chrome-linux64.zip\"; \\\n    unzip -q /tmp/chrome.zip -d /opt; \\\n    rm /tmp/chrome.zip; \\\n    ln -s /opt/chrome-linux64/chrome /usr/local/bin/google-chrome; \\\n    ln -s /opt/chrome-linux64/chrome /usr/local/bin/chrome; \\\n    mkdir -p /opt/chrome; \\\n    ln -s /opt/chrome-linux64/chrome /opt/chrome/chrome; \\\n    google-chrome --version\n\nRUN set -eux; \\\n    wget -qO /tmp/chromedriver.zip \\\n      \"https://storage.googleapis.com/chrome-for-testing-public/${CHROME_TESTING_VERSION}/linux64/chromedriver-linux64.zip\"; \\\n    unzip -q /tmp/chromedriver.zip -d /tmp; \\\n    mv /tmp/chromedriver-linux64/chromedriver /usr/local/bin; \\\n    rm /tmp/chromedriver.zip; \\\n    chmod +x /usr/local/bin/chromedriver; \\\n    chromedriver --version\n\nRUN chmod +x /opt/chrome/chrome\n\nRUN pip3 install --upgrade pip setuptools wheel\n\nCOPY requirements.txt .\nRUN pip install --no-cache-dir -r requirements.txt\n\nRUN mkdir -p /opt/workspace\nRUN mkdir -p /tmp && chmod 1777 /tmp\n\n# Copy application code\nCOPY api.py .\nCOPY sources/ ./sources/\nCOPY prompts/ ./prompts/\nCOPY crx/ crx/\nCOPY llm_router/ llm_router/\nCOPY config.ini .\n\nEXPOSE 8000\n\n# Run the application\nCMD [\"python3\", \"api.py\"]\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "# AgenticSeek: Private, Local Manus Alternative.\n\n<p align=\"center\">\n<img align=\"center\" src=\"./media/agentic_seek_logo.png\" width=\"300\" height=\"300\" alt=\"Agentic Seek Logo\">\n<p>\n\n  English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)\n\n*A **100% local alternative to Manus AI**, this voice-enabled AI assistant autonomously browses the web, writes code, and plans tasks while keeping all data on your device. Tailored for local reasoning models, it runs entirely on your hardware, ensuring complete privacy and zero cloud dependency.*\n\n[![Visit AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)\n\n### Why AgenticSeek ?\n\n* 🔒 Fully Local & Private - Everything runs on your machine — no cloud, no data sharing. Your files, conversations, and searches stay private.\n\n* 🌐 Smart Web Browsing - AgenticSeek can browse the internet by itself — search, read, extract info, fill web form — all hands-free.\n\n* 💻 Autonomous Coding Assistant - Need code? It can write, debug, and run programs in Python, C, Go, Java, and more — all without supervision.\n\n* 🧠 Smart Agent Selection - You ask, it figures out the best agent for the job automatically. Like having a team of experts ready to help.\n\n* 📋 Plans & Executes Complex Tasks - From trip planning to complex projects — it can split big tasks into steps and get things done using multiple AI agents.\n\n* 🎙️ Voice-Enabled - Clean, fast, futuristic voice and speech to text allowing you to talk to it like it's your personal AI from a sci-fi movie. (In progress)\n\n### **Demo**\n\n> *Can you search for the agenticSeek project, learn what skills are required, then open the CV_candidates.zip and then tell me which match best the project*\n\nhttps://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316\n\nDisclaimer: This demo, including all the files that appear (e.g: CV_candidates.zip), are entirely fictional. We are not a corporation, we seek open-source contributors not candidates.\n\n> 🛠⚠️️ **Active Work in Progress**\n\n> 🙏 This project started as a side-project and has zero roadmap and zero funding. It's grown way beyond what I expected by ending in GitHub Trending. Contributions, feedback, and patience are deeply appreciated.\n\n## Prerequisites\n\nBefore you begin, ensure you have the following software installed:\n\n*   **Git:** For cloning the repository. [Download Git](https://git-scm.com/downloads)\n*   **Python 3.10.x:** We strongly recommend using Python version 3.10.x. Using other versions might lead to dependency errors. [Download Python 3.10](https://www.python.org/downloads/release/python-3100/) (pick a 3.10.x version).\n*   **Docker Engine & Docker Compose:** For running bundled services like SearxNG.\n    *   Install Docker Desktop (which includes Docker Compose V2): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)\n    *   Alternatively, install Docker Engine and Docker Compose separately on Linux: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (ensure you install Compose V2, e.g., `sudo apt-get install docker-compose-plugin`).\n\n### 1. **Clone the repository and setup**\n\n```sh\ngit clone https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek\nmv .env.example .env\n```\n\n### 2. Change the .env file content\n\n```sh\nSEARXNG_BASE_URL=\"http://searxng:8080\" # http://127.0.0.1:8080 if running on host\nREDIS_BASE_URL=\"redis://redis:6379/0\"\nWORK_DIR=\"/Users/mlg/Documents/workspace_for_ai\"\nOLLAMA_PORT=\"11434\"\nLM_STUDIO_PORT=\"1234\"\nCUSTOM_ADDITIONAL_LLM_PORT=\"11435\"\nOPENAI_API_KEY='optional'\nDEEPSEEK_API_KEY='optional'\nOPENROUTER_API_KEY='optional'\nTOGETHER_API_KEY='optional'\nGOOGLE_API_KEY='optional'\nANTHROPIC_API_KEY='optional'\n```\n\n\nUpdate the `.env` file with your own values as needed:\n\n- **SEARXNG_BASE_URL**: Leave unchanged unless running on host with CLI mode.\n- **REDIS_BASE_URL**: Leave unchanged \n- **WORK_DIR**: Path to your working directory on your local machine. AgenticSeek will be able to read and interact with these files.\n- **OLLAMA_PORT**: Port number for the Ollama service.\n- **LM_STUDIO_PORT**: Port number for the LM Studio service.\n- **CUSTOM_ADDITIONAL_LLM_PORT**: Port for any additional custom LLM service.\n\n**API Key are totally optional for user who choose to run LLM locally. Which is the primary purpose of this project. Leave empty if you have sufficient hardware**\n\n### 3. **Start Docker**\n\nMake sure Docker is installed and running on your system. You can start Docker using the following commands:\n\n- **On Linux/macOS:**  \n    Open a terminal and run:\n    ```sh\n    sudo systemctl start docker\n    ```\n    Or launch Docker Desktop from your applications menu if installed.\n\n- **On Windows:**  \n    Start Docker Desktop from the Start menu.\n\nYou can verify Docker is running by executing:\n```sh\ndocker info\n```\nIf you see information about your Docker installation, it is running correctly.\n\nSee the table of [Local Providers](#list-of-local-providers) below for a summary.\n\nNext step: [Run AgenticSeek locally](#start-services-and-run)\n\n*See the [Troubleshooting](#troubleshooting) section if you are having issues.*\n*If your hardware can't run LLMs locally, see [Setup to run with an API](#setup-to-run-with-an-api).*\n*For detailed `config.ini` explanations, see [Config Section](#config).*\n\n---\n\n## Setup for running LLM locally on your machine\n\n**Hardware Requirements:**\n\nTo run LLMs locally, you'll need sufficient hardware. At a minimum, a GPU capable of running Magistral, Qwen or Deepseek 14B is required. See the FAQ for detailed model/performance recommendations.\n\n**Setup your local provider**  \n\nStart your local provider (for example with ollama):\n\nUnless you wish to to run AgenticSeek on host (CLI mode), export or set the provider listen address:\n\n```sh\nexport OLLAMA_HOST=0.0.0.0:11434\n```\n\nThen, start you provider:\n\n```sh\nollama serve\n```\n\nSee below for a list of local supported provider.\n\n**Update the config.ini**\n\nChange the config.ini file to set the provider_name to a supported provider and provider_model to a LLM supported by your provider. We recommend reasoning model such as *Magistral* or *Deepseek*.\n\nSee the **FAQ** at the end of the README for required hardware.\n\n```sh\n[MAIN]\nis_local = True # Whenever you are running locally or with remote provider.\nprovider_name = ollama # or lm-studio, openai, etc..\nprovider_model = deepseek-r1:14b # choose a model that fit your hardware\nprovider_server_address = 127.0.0.1:11434\nagent_name = Jarvis # name of your AI\nrecover_last_session = True # whenever to recover the previous session\nsave_session = True # whenever to remember the current session\nspeak = False # text to speech\nlisten = False # Speech to text, only for CLI, experimental\njarvis_personality = False # Whenever to use a more \"Jarvis\" like personality (experimental)\nlanguages = en zh # The list of languages, Text to speech will default to the first language on the list\n[BROWSER]\nheadless_browser = True # leave unchanged unless using CLI on host.\nstealth_mode = True # Use undetected selenium to reduce browser detection\n```\n\n**Warning**:\n\n- The `config.ini` file format does not support comments. \nDo not copy and paste the example configuration directly, as comments will cause errors.  Instead, manually modify the `config.ini` file with your desired settings, excluding any comments.\n\n- Do *NOT* set provider_name to `openai` if using LM-studio for running LLMs. Set it to `lm-studio`.\n\n- Some provider (eg: lm-studio) require you to have `http://` in front of the IP. For example `http://127.0.0.1:1234`\n\n**List of local providers**\n\n| Provider  | Local? | Description                                               |\n|-----------|--------|-----------------------------------------------------------|\n| ollama    | Yes    | Run LLMs locally with ease using ollama as a LLM provider |\n| lm-studio  | Yes    | Run LLM locally with LM studio (set `provider_name` to `lm-studio`)|\n| openai    | Yes     |  Use openai compatible API (eg: llama.cpp server)  |\n\nNext step: [Start services and run AgenticSeek](#Start-services-and-Run)  \n\n*See the [Troubleshooting](#troubleshooting) section if you are having issues.*\n*If your hardware can't run LLMs locally, see [Setup to run with an API](#setup-to-run-with-an-api).*\n*For detailed `config.ini` explanations, see [Config Section](#config).*\n\n## Setup to run with an API\n\nThis setup uses external, cloud-based LLM providers. You'll need an API key from your chosen service.\n\n**1. Choose an API Provider and Get an API Key:**\n\nRefer to the [List of API Providers](#list-of-api-providers) below. Visit their websites to sign up and obtain an API key.\n\n**2. Set Your API Key as an Environment Variable:**\n\n\n*   **Linux/macOS:**\n    Open your terminal and use the `export` command. It's best to add this to your shell's profile file (e.g., `~/.bashrc`, `~/.zshrc`) for persistence.\n    ```sh\n    export PROVIDER_API_KEY=\"your_api_key_here\" \n    # Replace PROVIDER_API_KEY with the specific variable name, e.g., OPENAI_API_KEY, GOOGLE_API_KEY\n    ```\n    Example for TogetherAI:\n    ```sh\n    export TOGETHER_API_KEY=\"xxxxxxxxxxxxxxxxxxxxxx\"\n    ```\n*   **Windows:**\n    *   **Command Prompt (Temporary for current session):**\n        ```cmd\n        set PROVIDER_API_KEY=your_api_key_here\n        ```\n    *   **PowerShell (Temporary for current session):**\n        ```powershell\n        $env:PROVIDER_API_KEY=\"your_api_key_here\"\n        ```\n    *   **Permanently:** Search for \"environment variables\" in the Windows search bar, click \"Edit the system environment variables,\" then click the \"Environment Variables...\" button. Add a new User variable with the appropriate name (e.g., `OPENAI_API_KEY`) and your key as the value.\n\n    *(See FAQ: [How do I set API keys?](#how-do-i-set-api-keys) for more details).*\n\n\n**3. Update `config.ini`:**\n```ini\n[MAIN]\nis_local = False\nprovider_name = openai # Or google, deepseek, togetherAI, huggingface\nprovider_model = gpt-3.5-turbo # Or gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1 etc.\nprovider_server_address = # Typically ignored or can be left blank when is_local = False for most APIs\n# ... other settings ...\n```\n*Warning:* Make sure there are no trailing spaces in the `config.ini` values.\n\n**List of API Providers**\n\n| Provider     | `provider_name` | Local? | Description                                       | API Key Link (Examples)                     |\n|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|\n| OpenAI       | `openai`        | No     | Use ChatGPT models via OpenAI's API.              | [platform.openai.com/signup](https://platform.openai.com/signup) |\n| Google Gemini| `google`        | No     | Use Google Gemini models via Google AI Studio.    | [aistudio.google.com/keys](https://aistudio.google.com/keys) |\n| Deepseek     | `deepseek`      | No     | Use Deepseek models via their API.                | [platform.deepseek.com](https://platform.deepseek.com) |\n| Hugging Face | `huggingface`   | No     | Use models from Hugging Face Inference API.       | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |\n| TogetherAI   | `togetherAI`    | No     | Use various open-source models via TogetherAI API.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |\n| OpenRouter   | `openrouter`    | No     | Use OpenRouter Models| [https://openrouter.ai/](https://openrouter.ai/) |\n| MiniMax      | `minimax`       | No     | Use MiniMax M2.5 series models (e.g., MiniMax-M2.5).| [platform.minimax.io](https://platform.minimax.io/user-center/basic-information) |\n\n*Note:*\n*   We advise against using `gpt-4o` or other OpenAI models for complex web browsing and task planning as current prompt optimizations are geared towards models like Deepseek.\n*   Coding/bash tasks might encounter issues with Gemini, as it may not strictly follow formatting prompts optimized for Deepseek.\n*   The `provider_server_address` in `config.ini` is generally not used when `is_local = False` as the API endpoint is usually hardcoded in the respective provider's library.\n\nNext step: [Start services and run AgenticSeek](#Start-services-and-Run)\n\n*See the **Known issues** section if you are having issues*\n\n*See the **Config** section for detailed config file explanation.*\n\n---\n\n## Start services and Run\n\nBy default AgenticSeek is run fully in docker.\n\n**Option 1:** Run in Docker, use web interface:\n\nStart required services. This will start all services from the docker-compose.yml, including:\n    - searxng\n    - redis (required by searxng)\n    - frontend\n    - backend (if using `full` when using the web interface)\n\n```sh\n./start_services.sh full # MacOS\nstart start_services.cmd full # Window\n```\n\n**Warning:** This step will download and load all Docker images, which may take up to 30 minutes. After starting the services, please wait until the backend service is fully running (you should see **backend: \"GET /health HTTP/1.1\" 200 OK** in the log) before sending any messages. The backend services might take 5 minute to start on first run.\n\nGo to `http://localhost:3000/` and you should see the web interface.\n\n*Troubleshooting service start:* If these scripts fail, ensure Docker Engine is running and Docker Compose (V2, `docker compose`) is correctly installed. Check the output in the terminal for error messages. See [FAQ: Help! I get an error when running AgenticSeek or its scripts.](#faq-troubleshooting)\n\n**Option 2:** CLI mode:\n\nTo run with CLI interface you would have to install package on host:\n\n```sh\n./install.sh\n./install.bat # windows\n```\n\nThen you must change the SEARXNG_BASE_URL in `config.ini` to:\n\n```sh\nSEARXNG_BASE_URL=\"http://localhost:8080\"\n```\n\nStart required services. This will start some services from the docker-compose.yml, including:\n    - searxng\n    - redis (required by searxng)\n    - frontend\n\n```sh\n./start_services.sh # MacOS\nstart start_services.cmd # Window\n```\n\nRun: uv run: `uv run python -m ensurepip` to ensure uv has pip enabled.\n\nUse the CLI: `uv run cli.py`\n\n\n---\n\n## Usage\n\nMake sure the services are up and running with `./start_services.sh full` and go to `localhost:3000` for web interface.\n\nYou can also use speech to text by setting `listen = True` in the config. Only for CLI mode.\n\nTo exit, simply say/type `goodbye`.\n\nHere are some example usage:\n\n> *Make a snake game in python!*\n\n> *Search the web for top cafes in Rennes, France, and save a list of three with their addresses in rennes_cafes.txt.*\n\n> *Write a Go program to calculate the factorial of a number, save it as factorial.go in your workspace*\n\n> *Search my summer_pictures folder for all JPG files, rename them with today’s date, and save a list of renamed files in photos_list.txt*\n\n> *Search online for popular sci-fi movies from 2024 and pick three to watch tonight. Save the list in movie_night.txt.*\n\n> *Search the web for the latest AI news articles from 2025, select three, and write a Python script to scrape their titles and summaries. Save the script as news_scraper.py and the summaries in ai_news.txt in /home/projects*\n\n> *Friday, search the web for a free stock price API, register with supersuper7434567@gmail.com then write a Python script to fetch using the API daily prices for Tesla, and save the results in stock_prices.csv*\n\n*Note that form filling capabilities are still experimental and might fail.*\n\n\n\nAfter you type your query, AgenticSeek will allocate the best agent for the task.\n\nBecause this is an early prototype, the agent routing system might not always allocate the right agent based on your query.\n\nTherefore, you should be very explicit in what you want and how the AI might proceed for example if you want it to conduct a web search, do not say:\n\n`Do you know some good countries for solo-travel?`\n\nInstead, ask:\n\n`Do a web search and find out which are the best country for solo-travel`\n\n---\n\n## **Setup to run the LLM on your own server**  \n\nIf you have a powerful computer or a server that you can use, but you want to use it from your laptop you have the options to run the LLM on a remote server using our custom llm server. \n\nOn your \"server\" that will run the AI model, get the ip address\n\n```sh\nip a | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # local ip\ncurl https://ipinfo.io/ip # public ip\n```\n\nNote: For Windows or macOS, use ipconfig or ifconfig respectively to find the IP address.\n\nClone the repository and enter the `server/`folder.\n\n\n```sh\ngit clone --depth 1 https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek/llm_server/\n```\n\nInstall server specific requirements:\n\n```sh\npip3 install -r requirements.txt\n```\n\nRun the server script.\n\n```sh\npython3 app.py --provider ollama --port 3333\n```\n\nYou have the choice between using `ollama` and `llamacpp` as a LLM service.\n\n\nNow on your personal computer:\n\nChange the `config.ini` file to set the `provider_name` to `server` and `provider_model` to `deepseek-r1:xxb`.\nSet the `provider_server_address` to the ip address of the machine that will run the model.\n\n```sh\n[MAIN]\nis_local = False\nprovider_name = server\nprovider_model = deepseek-r1:70b\nprovider_server_address = http://x.x.x.x:3333\n```\n\n\nNext step: [Start services and run AgenticSeek](#Start-services-and-Run)  \n\n---\n\n## Speech to Text\n\nWarning: speech to text only work in CLI mode at the moment.\n\nPlease note that currently speech to text only work in english.\n\nThe speech-to-text functionality is disabled by default. To enable it, set the listen option to True in the config.ini file:\n\n```\nlisten = True\n```\n\nWhen enabled, the speech-to-text feature listens for a trigger keyword, which is the agent's name, before it begins processing your input. You can customize the agent's name by updating the `agent_name` value in the *config.ini* file:\n\n```\nagent_name = Friday\n```\n\nFor optimal recognition, we recommend using a common English name like \"John\" or \"Emma\" as the agent name\n\nOnce you see the transcript start to appear, say the agent's name aloud to wake it up (e.g., \"Friday\").\n\nSpeak your query clearly.\n\nEnd your request with a confirmation phrase to signal the system to proceed. Examples of confirmation phrases include:\n```\n\"do it\", \"go ahead\", \"execute\", \"run\", \"start\", \"thanks\", \"would ya\", \"please\", \"okay?\", \"proceed\", \"continue\", \"go on\", \"do that\", \"go it\", \"do you understand?\"\n```\n\n## Config\n\nExample config:\n```\n[MAIN]\nis_local = True\nprovider_name = ollama\nprovider_model = deepseek-r1:32b\nprovider_server_address = http://127.0.0.1:11434 # Example for Ollama; use http://127.0.0.1:1234 for LM-Studio\nagent_name = Friday\nrecover_last_session = False\nsave_session = False\nspeak = False\nlisten = False\n\njarvis_personality = False\nlanguages = en zh # List of languages for TTS and potentially routing.\n[BROWSER]\nheadless_browser = False\nstealth_mode = False\n```\n\n**Explanation of `config.ini` Settings**:\n\n*   **`[MAIN]` Section:**\n    *   `is_local`: `True` if using a local LLM provider (Ollama, LM-Studio, local OpenAI-compatible server) or the self-hosted server option. `False` if using a cloud-based API (OpenAI, Google, etc.).\n    *   `provider_name`: Specifies the LLM provider.\n        *   Local options: `ollama`, `lm-studio`, `openai` (for local OpenAI-compatible servers), `server` (for the self-hosted server setup).\n        *   API options: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.\n    *   `provider_model`: The specific model name or ID for the chosen provider (e.g., `deepseekcoder:6.7b` for Ollama, `gpt-3.5-turbo` for OpenAI API, `mistralai/Mixtral-8x7B-Instruct-v0.1` for TogetherAI).\n    *   `provider_server_address`: The address of your LLM provider.\n        *   For local providers: e.g., `http://127.0.0.1:11434` for Ollama, `http://127.0.0.1:1234` for LM-Studio.\n        *   For the `server` provider type: The address of your self-hosted LLM server (e.g., `http://your_server_ip:3333`).\n        *   For cloud APIs (`is_local = False`): This is often ignored or can be left blank, as the API endpoint is usually handled by the client library.\n    *   `agent_name`: Name of the AI assistant (e.g., Friday). Used as a trigger word for speech-to-text if enabled.\n    *   `recover_last_session`: `True` to attempt to restore the previous session's state, `False` to start fresh.\n    *   `save_session`: `True` to save the current session's state for potential recovery, `False` otherwise.\n    *   `speak`: `True` to enable text-to-speech voice output, `False` to disable.\n    *   `listen`: `True` to enable speech-to-text voice input (CLI mode only), `False` to disable.\n    *   `work_dir`: **Crucial:** The directory where AgenticSeek will read/write files. **Ensure this path is valid and accessible on your system.**\n    *   `jarvis_personality`: `True` to use a more \"Jarvis-like\" system prompt (experimental), `False` for the standard prompt.\n    *   `languages`: A comma-separated list of languages (e.g., `en, zh, fr`). Used for TTS voice selection (defaults to the first) and can assist the LLM router. Avoid too many or very similar languages for router efficiency.\n*   **`[BROWSER]` Section:**\n    *   `headless_browser`: `True` to run the automated browser without a visible window (recommended for web interface or non-interactive use). `False` to show the browser window (useful for CLI mode or debugging).\n    *   `stealth_mode`: `True` to enable measures to make browser automation harder to detect. May require manual installation of browser extensions like anticaptcha.\n\n\nThis section summarizes the supported LLM provider types. Configure them in `config.ini`.\n\n**Local Providers (Run on Your Own Hardware):**\n\n| Provider Name in `config.ini` | `is_local` | Description                                                                 | Setup Section                                                    |\n|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|\n| `ollama`                      | `True`     | Use Ollama to serve local LLMs.                                             | [Setup for running LLM locally](#setup-for-running-llm-locally-on-your-machine) |\n| `lm-studio`                   | `True`     | Use LM-Studio to serve local LLMs.                                          | [Setup for running LLM locally](#setup-for-running-llm-locally-on-your-machine) |\n| `openai` (for local server)   | `True`     | Connect to a local server that exposes an OpenAI-compatible API (e.g., llama.cpp). | [Setup for running LLM locally](#setup-for-running-llm-locally-on-your-machine) |\n| `server`                      | `False`    | Connect to the AgenticSeek self-hosted LLM server running on another machine. | [Setup to run the LLM on your own server](#setup-to-run-the-llm-on-your-own-server) |\n\n**API Providers (Cloud-Based):**\n\n| Provider Name in `config.ini` | `is_local` | Description                                      | Setup Section                                       |\n|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|\n| `openai`                      | `False`    | Use OpenAI's official API (e.g., GPT-3.5, GPT-4). | [Setup to run with an API](#setup-to-run-with-an-api) |\n| `google`                      | `False`    | Use Google's Gemini models via API.              | [Setup to run with an API](#setup-to-run-with-an-api) |\n| `deepseek`                    | `False`    | Use Deepseek's official API.                     | [Setup to run with an API](#setup-to-run-with-an-api) |\n| `huggingface`                 | `False`    | Use Hugging Face Inference API.                  | [Setup to run with an API](#setup-to-run-with-an-api) |\n| `togetherAI`                  | `False`    | Use TogetherAI's API for various open models.    | [Setup to run with an API](#setup-to-run-with-an-api) |\n\n---\n## Troubleshooting\n\nIf you encounter issues, this section provides guidance.\n\n# Known Issues\n\n## ChromeDriver Issues\n\n**Error Example:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`\n\n### Root Cause\nChromeDriver version incompatibility occurs when:\n1. Your installed ChromeDriver version doesn't match your Chrome browser version\n2. In Docker environments, `undetected_chromedriver` may download its own ChromeDriver version, bypassing the mounted binary\n\n### Solution Steps\n\n#### 1. Check Your Chrome Version\nOpen Google Chrome → `Settings > About Chrome` to find your version (e.g., \"Version 134.0.6998.88\")\n\n#### 2. Download Matching ChromeDriver\n\n**For Chrome 115 and newer:** Use the [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)\n- Visit the Chrome for Testing availability dashboard\n- Find your Chrome version or the closest available match\n- Download the ChromeDriver for your OS (Linux64 for Docker environments)\n\n**For older Chrome versions:** Use the [legacy ChromeDriver downloads](https://chromedriver.chromium.org/downloads)\n\n![Download ChromeDriver from Chrome for Testing](./media/chromedriver_readme.png)\n\n#### 3. Install ChromeDriver (Choose One Method)\n\n**Method A: Project Root Directory (Recommended for Docker)**\n```bash\n# Place the downloaded chromedriver binary in your project root\ncp path/to/downloaded/chromedriver ./chromedriver\nchmod +x ./chromedriver  # Make executable on Linux/macOS\n```\n\n**Method B: System PATH**\n```bash\n# Linux/macOS\nsudo mv chromedriver /usr/local/bin/\nsudo chmod +x /usr/local/bin/chromedriver\n\n# Windows: Place chromedriver.exe in a folder that's in your PATH\n```\n\n#### 4. Verify Installation\n```bash\n# Test the ChromeDriver version\n./chromedriver --version\n# OR if in PATH:\nchromedriver --version\n```\n\n### Docker-Specific Notes\n\n⚠️ **Important for Docker Users:**\n- The Docker volume mount approach may not work with stealth mode (`undetected_chromedriver`)\n- **Solution**: Place ChromeDriver in the project root directory as `./chromedriver`\n- The application will automatically detect and use this binary\n- You should see: `\"Using ChromeDriver from project root: ./chromedriver\"` in the logs\n\n### Troubleshooting Tips\n\n1. **Still getting version mismatch?**\n   - Verify the ChromeDriver is executable: `ls -la ./chromedriver`\n   - Check the ChromeDriver version: `./chromedriver --version`\n   - Ensure it matches your Chrome browser version\n\n2. **Docker container issues?**\n   - Check backend logs: `docker logs backend`\n   - Look for the message: `\"Using ChromeDriver from project root\"`\n   - If not found, verify the file exists and is executable\n\n3. **Chrome for Testing versions**\n   - Use the exact version match when possible\n   - For version 134.0.6998.88, use ChromeDriver 134.0.6998.165 (closest available)\n   - Major version numbers must match (134 = 134)\n\n### Version Compatibility Matrix\n\n| Chrome Version | ChromeDriver Version | Status |\n|----------------|---------------------|---------|\n| 134.0.6998.x   | 134.0.6998.165     | ✅ Works |\n| 133.0.6943.x   | 133.0.6943.141     | ✅ Works |\n| 132.0.6834.x   | 132.0.6834.159     | ✅ Works |\n\n*For the latest compatibility, check the [Chrome for Testing dashboard](https://googlechromelabs.github.io/chrome-for-testing/)*\n\n`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113\nCurrent browser version is 134.0.6998.89 with binary path`\n\nThis happen if there is a mismatch between your browser and chromedriver version.\n\nYou need to navigate to download the latest version:\n\nhttps://developer.chrome.com/docs/chromedriver/downloads\n\nIf you're using Chrome version 115 or newer go to:\n\nhttps://googlechromelabs.github.io/chrome-for-testing/\n\nAnd download the chromedriver version matching your OS.\n\n![alt text](./media/chromedriver_readme.png)\n\nIf this section is incomplete please raise an issue.\n\n##  connection adapters Issues\n\n```\nException: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (Note: port may vary)\n```\n\n*   **Cause:** The `provider_server_address` in `config.ini` for `lm-studio` (or other similar local OpenAI-compatible servers) is missing the `http://` prefix or is pointing to the wrong port.\n*   **Solution:**\n    *   Ensure the address includes `http://`. LM-Studio typically defaults to `http://127.0.0.1:1234`.\n    *   Correct `config.ini`: `provider_server_address = http://127.0.0.1:1234` (or your actual LM-Studio server port).\n\n## SearxNG Base URL Not Provided\n\n```\nraise ValueError(\"SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.\")\nValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`\n```\n\nThis might arise if you are running the CLI mode with the wrong base url for searxng.\n\nThe SEARXNG_BASE_URL should be depending on whenever you run in docker or on host:\n\n**Run on host**: `SEARXNG_BASE_URL=\"http://localhost:8080\"`\n\n**Run fully in docker (web interface)**: `SEARXNG_BASE_URL=\"http://searxng:8080\"`\n\n## FAQ\n\n**Q: What hardware do I need?**  \n\n| Model Size  | GPU  | Comment                                               |\n|-----------|--------|-----------------------------------------------------------|\n| 7B        | 8GB Vram | ⚠️ Not recommended. Performance is poor, frequent hallucinations, and planner agents will likely fail. |\n| 14B        | 12 GB VRAM (e.g. RTX 3060) | ✅ Usable for simple tasks. May struggle with web browsing and planning tasks. |\n| 32B        | 24+ GB VRAM (e.g. RTX 4090) | 🚀 Success with most tasks, might still struggle with task planning |\n| 70B+        | 48+ GB Vram | 💪 Excellent. Recommended for advanced use cases. |\n\n**Q: I get an error what do I do?**  \n\nEnsure local is running (`ollama serve`), your `config.ini` matches your provider, and dependencies are installed. If none work feel free to raise an issue.\n\n**Q: Can it really run 100% locally?**  \n\nYes with Ollama, lm-studio or server providers, all speech to text, LLM and text to speech model run locally. Non-local options (OpenAI or others API) are optional.\n\n**Q: Why should I use AgenticSeek when I have Manus?**\n\nUnlike Manus, AgenticSeek prioritizes independence from external systems, giving you more control, privacy and avoid api cost.\n\n**Q: Who is behind the project ?**\n\nThe project was created by me, along with two friends who serve as maintainers and contributors from the open-source community on GitHub. We’re just a group of passionate individuals, not a startup or affiliated with any organization.\n\nAny AgenticSeek account on X other than my personal account (https://x.com/Martin993886460) is an impersonation.\n\n## Contribute\n\nWe’re looking for developers to improve AgenticSeek! Check out open issues or discussion.\n\n[Contribution guide](./docs/CONTRIBUTING.md)\n\n\n## Sponsors:\n\nWant to level up AgenticSeek capabilities with features like flight search, trip planning, or snagging the best shopping deals? Consider crafting a custom tool with SerpApi to unlock more Jarvis-like capabilities. With SerpApi, you can turbocharge your agent for specialized tasks while staying in full control.\n\n<a href=\"https://serpapi.com/\"><img src=\"./media/banners/sponsor_banner_serpapi.png\" height=\"350\" alt=\"SerpApi Banner\" ></a>\n\nSee [Contributing.md](./docs/CONTRIBUTING.md) to learn how to integrate custom tools!\n\n### **Patron sponsor**:\n\n- [tatra-labs](https://github.com/tatra-labs)\n\n## Maintainers:\n\n > [Fosowl](https://github.com/Fosowl) | Paris Time \n\n > [antoineVIVIES](https://github.com/antoineVIVIES) | Taipei Time \n\n## Special Thanks:\n\n > [tcsenpai](https://github.com/tcsenpai) and [plitc](https://github.com/plitc) For helping with backend dockerization\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)"
  },
  {
    "path": "README_CHS.md",
    "content": "# AgenticSeek：私有、本地的 Manus 替代方案\n\n<p align=\"center\">\n<img align=\"center\" src=\"./media/agentic_seek_logo.png\" width=\"300\" height=\"300\" alt=\"Agentic Seek Logo\">\n<p>\n\n  English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)\n\n*一个**100%本地运行的 Manus AI 替代品**，支持语音的 AI 助手，可自主浏览网页、编写代码、规划任务，所有数据仅保存在你的设备上。专为本地推理模型设计，完全在你的硬件上运行，确保隐私无忧，无需云端依赖。*\n\n[![访问 AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)\n\n### 为什么选择 AgenticSeek？\n\n* 🔒 完全本地 & 私有 —— 所有内容都在你的电脑上运行，无云端、无数据共享。你的文件、对话和搜索都保持私密。\n\n* 🌐 智能网页浏览 —— AgenticSeek 可自主浏览互联网：搜索、阅读、提取信息、填写网页表单，全程免手动。\n\n* 💻 自动化编程助手 —— 需要代码？它能编写、调试并运行 Python、C、Go、Java 等程序，无需监督。\n\n* 🧠 智能代理选择 —— 你提问，它自动判断最合适的代理来完成任务。就像有一支专家团队随时待命。\n\n* 📋 规划并执行复杂任务 —— 从旅行规划到复杂项目，可将大任务拆分为步骤，调用多个 AI 代理协作完成。\n\n* 🎙️ 语音支持 —— 干净、快速、未来感的语音与语音转文本功能，让你像科幻电影中的 AI 一样与它对话。（开发中）\n\n### **演示**\n\n> *你能搜索 agenticSeek 项目，了解需要哪些技能，然后打开 CV_candidates.zip 并告诉我哪些最匹配该项目吗？*\n\nhttps://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316\n\n免责声明：本演示及出现的所有文件（如 CV_candidates.zip）均为虚构。我们不是公司，只寻求开源贡献者而非候选人。\n\n> 🛠⚠️️ **项目正在积极开发中**\n\n> 🙏 本项目起初只是一个副业，没有路线图也没有资金支持。它意外地登上了 GitHub Trending。非常感谢大家的贡献、反馈与耐心。\n\n## 前置条件\n\n开始前，请确保已安装以下软件：\n\n*   **Git:** 用于克隆仓库。[下载 Git](https://git-scm.com/downloads)\n*   **Python 3.10.x:** 强烈推荐使用 Python 3.10.x 版本。使用其他版本可能导致依赖错误。[下载 Python 3.10](https://www.python.org/downloads/release/python-3100/)（选择 3.10.x 版本）。\n*   **Docker Engine & Docker Compose:** 用于运行捆绑服务如 SearxNG。\n    *   安装 Docker Desktop（包含 Docker Compose V2）：[Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)\n    *   或者在 Linux 上分别安装 Docker Engine 和 Docker Compose：[Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/)（确保安装 Compose V2，例如 `sudo apt-get install docker-compose-plugin`）。\n\n### 1. **克隆仓库并设置**\n\n```sh\ngit clone https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek\nmv .env.example .env\n```\n\n### 2. 修改 .env 文件内容\n\n```sh\nSEARXNG_BASE_URL=\"http://searxng:8080\" # 如果在主机上运行 CLI 模式，使用 http://127.0.0.1:8080\nREDIS_BASE_URL=\"redis://redis:6379/0\"\nWORK_DIR=\"/Users/mlg/Documents/workspace_for_ai\"\nOLLAMA_PORT=\"11434\"\nLM_STUDIO_PORT=\"1234\"\nCUSTOM_ADDITIONAL_LLM_PORT=\"11435\"\nOPENAI_API_KEY='optional'\nDEEPSEEK_API_KEY='optional'\nOPENROUTER_API_KEY='optional'\nTOGETHER_API_KEY='optional'\nGOOGLE_API_KEY='optional'\nANTHROPIC_API_KEY='optional'\n```\n\n根据需要更新 `.env` 文件：\n\n- **SEARXNG_BASE_URL**: 除非在主机上运行 CLI 模式，否则保持不变。\n- **REDIS_BASE_URL**: 保持不变 \n- **WORK_DIR**: 本地工作目录路径。AgenticSeek 可读取和操作这些文件。\n- **OLLAMA_PORT**: Ollama 服务端口号。\n- **LM_STUDIO_PORT**: LM Studio 服务端口号。\n- **CUSTOM_ADDITIONAL_LLM_PORT**: 任何额外自定义 LLM 服务的端口。\n\n**API 密钥对于选择本地运行 LLM 的用户完全可选，这也是本项目的主要目的。如果硬件足够，请留空。**\n\n### 3. **启动 Docker**\n\n确保 Docker 已安装并在系统上运行。可以使用以下命令启动 Docker：\n\n- **Linux/macOS:**  \n    打开终端运行：\n    ```sh\n    sudo systemctl start docker\n    ```\n    或者如果已安装，从应用程序菜单启动 Docker Desktop。\n\n- **Windows:**  \n    从开始菜单启动 Docker Desktop。\n\n可以通过执行以下命令验证 Docker 是否运行：\n```sh\ndocker info\n```\n如果看到 Docker 安装信息，则表示运行正常。\n\n请参阅下面的[本地提供商列表](#本地提供商列表)了解摘要。\n\n下一步：[本地运行 AgenticSeek](#启动服务并运行)\n\n*如果遇到问题，请参阅[故障排除](#故障排除)部分。*\n*如果硬件无法本地运行 LLM，请参阅[使用 API 运行设置](#使用-api-运行设置)。*\n*有关详细 `config.ini` 说明，请参阅[配置部分](#配置)。*\n\n---\n\n## 在您的机器上本地运行 LLM 的设置\n\n**硬件要求：**\n\n要本地运行 LLM，您需要足够的硬件。至少需要能够运行 Magistral、Qwen 或 Deepseek 14B 的 GPU。有关详细的模型/性能建议，请参阅 FAQ。\n\n**设置您的本地提供商**  \n\n启动您的本地提供商，例如使用 ollama：\n\n```sh\nollama serve\n```\n\n请参阅下面的本地支持提供商列表。\n\n**更新 config.ini**\n\n更改 config.ini 文件，将 provider_name 设置为支持的提供商，provider_model 设置为您的提供商支持的 LLM。我们推荐推理模型，如 *Magistral* 或 *Deepseek*。\n\n有关所需硬件，请参阅 README 末尾的 **FAQ**。\n\n```sh\n[MAIN]\nis_local = True # 无论您是本地运行还是使用远程提供商。\nprovider_name = ollama # 或 lm-studio、openai 等。\nprovider_model = deepseek-r1:14b # 选择适合您硬件的模型\nprovider_server_address = 127.0.0.1:11434\nagent_name = Jarvis # 您的 AI 名称\nrecover_last_session = True # 是否恢复上一个会话\nsave_session = True # 是否记住当前会话\nspeak = False # 文本转语音\nlisten = False # 语音转文本，仅限 CLI，实验性\njarvis_personality = False # 是否使用更\"Jarvis\"风格的性格（实验性）\nlanguages = en zh # 语言列表，文本转语音将默认使用列表中的第一种语言\n[BROWSER]\nheadless_browser = True # 除非在主机上使用 CLI，否则保持不变。\nstealth_mode = True # 使用不可检测的 selenium 减少浏览器检测\n```\n\n**警告**：\n\n- `config.ini` 文件格式不支持注释。\n不要直接复制粘贴示例配置，因为注释会导致错误。相反，手动修改 `config.ini` 文件，使用您所需的设置，排除任何注释。\n\n- 如果使用 LM-studio 运行 LLM，请*不要*将 provider_name 设置为 `openai`。将其设置为 `lm-studio`。\n\n- 某些提供商（例如：lm-studio）要求您在 IP 前加上 `http://`。例如 `http://127.0.0.1:1234`\n\n**本地提供商列表**\n\n| 提供商  | 本地？ | 描述                                               |\n|-----------|--------|-----------------------------------------------------------|\n| ollama    | 是    | 使用 ollama 作为 LLM 提供商轻松本地运行 LLM |\n| lm-studio  | 是    | 使用 LM studio 本地运行 LLM（将 `provider_name` 设置为 `lm-studio`）|\n| openai    | 是     |  使用 openai 兼容 API（例如：llama.cpp 服务器）  |\n\n下一步：[启动服务并运行 AgenticSeek](#启动服务并运行)  \n\n*如果遇到问题，请参阅[故障排除](#故障排除)部分。*\n*如果硬件无法本地运行 LLM，请参阅[使用 API 运行设置](#使用-api-运行设置)。*\n*有关详细 `config.ini` 说明，请参阅[配置部分](#配置)。*\n\n## 使用 API 运行设置\n\n此设置使用外部、基于云的 LLM 提供商。您需要从所选服务获取 API 密钥。\n\n**1. 选择 API 提供商并获取 API 密钥：**\n\n请参阅下面的[API 提供商列表](#api-提供商列表)。访问他们的网站注册并获取 API 密钥。\n\n**2. 将您的 API 密钥设置为环境变量：**\n\n*   **Linux/macOS:**\n    打开终端并使用 `export` 命令。最好将其添加到 shell 的配置文件中（例如 `~/.bashrc`、`~/.zshrc`）以保持持久性。\n    ```sh\n    export PROVIDER_API_KEY=\"your_api_key_here\" \n    # 将 PROVIDER_API_KEY 替换为特定的变量名，例如 OPENAI_API_KEY、GOOGLE_API_KEY\n    ```\n    TogetherAI 示例：\n    ```sh\n    export TOGETHER_API_KEY=\"xxxxxxxxxxxxxxxxxxxxxx\"\n    ```\n*   **Windows:**\n    *   **命令提示符（当前会话临时）：**\n        ```cmd\n        set PROVIDER_API_KEY=your_api_key_here\n        ```\n    *   **PowerShell（当前会话临时）：**\n        ```powershell\n        $env:PROVIDER_API_KEY=\"your_api_key_here\"\n        ```\n    *   **永久性：** 在 Windows 搜索栏中搜索\"环境变量\"，点击\"编辑系统环境变量\"，然后点击\"环境变量...\"按钮。添加一个新的用户变量，使用适当的名称（例如 `OPENAI_API_KEY`）和您的密钥作为值。\n\n    *(有关更多详细信息，请参阅 FAQ：[如何设置 API 密钥？](#如何设置-api-密钥))。*\n\n\n**3. 更新 `config.ini`：**\n```ini\n[MAIN]\nis_local = False\nprovider_name = openai # 或 google、deepseek、togetherAI、huggingface\nprovider_model = gpt-3.5-turbo # 或 gemini-1.5-flash、deepseek-chat、mistralai/Mixtral-8x7B-Instruct-v0.1 等。\nprovider_server_address = # 当 is_local = False 时，对于大多数 API 通常被忽略或可以留空\n# ... 其他设置 ...\n```\n*警告：* 确保 `config.ini` 值中没有尾随空格。\n\n**API 提供商列表**\n\n| 提供商     | `provider_name` | 本地？ | 描述                                       | API 密钥链接（示例）                     |\n|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|\n| OpenAI       | `openai`        | 否     | 通过 OpenAI 的 API 使用 ChatGPT 模型。              | [platform.openai.com/signup](https://platform.openai.com/signup) |\n| Google Gemini| `google`        | 否     | 通过 Google AI Studio 使用 Google Gemini 模型。    | [aistudio.google.com/keys](https://aistudio.google.com/keys) |\n| Deepseek     | `deepseek`      | 否     | 通过他们的 API 使用 Deepseek 模型。                | [platform.deepseek.com](https://platform.deepseek.com) |\n| Hugging Face | `huggingface`   | 否     | 使用 Hugging Face Inference API 中的模型。       | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |\n| TogetherAI   | `togetherAI`    | 否     | 通过 TogetherAI API 使用各种开源模型。| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |\n| OpenRouter   | `openrouter`    | No     | 通过 OpenRouter 使用各种开源模型| [https://openrouter.ai/](https://openrouter.ai/) |\n| MiniMax      | `minimax`       | 否     | 使用 MiniMax 的 M2.5 系列模型（如 MiniMax-M2.5）。 | [platform.minimax.io](https://platform.minimax.io/user-center/basic-information) |\n\n*注意：*\n*   我们不建议将 `gpt-4o` 或其他 OpenAI 模型用于复杂的网页浏览和任务规划，因为当前的提示优化针对 Deepseek 等模型。\n*   编码/bash 任务可能会遇到 Gemini 的问题，因为它可能不严格遵循针对 Deepseek 优化的格式化提示。\n*   当 `is_local = False` 时，`config.ini` 中的 `provider_server_address` 通常不使用，因为 API 端点通常在相应提供商的库中硬编码。\n\n下一步：[启动服务并运行 AgenticSeek](#启动服务并运行)\n\n*如果遇到问题，请参阅**已知问题**部分*\n\n*有关详细配置文件说明，请参阅**配置**部分。*\n\n---\n\n## 启动服务并运行\n\n默认情况下，AgenticSeek 完全在 Docker 中运行。\n\n**选项 1:** 在 Docker 中运行，使用 Web 界面：\n\n启动所需服务。这将启动 docker-compose.yml 中的所有服务，包括：\n    - searxng\n    - redis（searxng 所需）\n    - frontend\n    - backend（如果使用 Web 界面时使用 `full`）\n\n```sh\n./start_services.sh full # MacOS\nstart start_services.cmd full # Windows\n```\n\n**警告：** 此步骤将下载并加载所有 Docker 镜像，可能需要长达 30 分钟。启动服务后，请等待后端服务完全运行（您应该在日志中看到 **backend: \"GET /health HTTP/1.1\" 200 OK**）后再发送任何消息。首次运行时，后端服务可能需要 5 分钟才能启动。\n\n转到 `http://localhost:3000/`，您应该会看到 Web 界面。\n\n*服务启动故障排除：* 如果这些脚本失败，请确保 Docker Engine 正在运行并且 Docker Compose（V2，`docker compose`）已正确安装。检查终端输出中的错误消息。请参阅 [FAQ：帮助！运行 AgenticSeek 或其脚本时出现错误。](#faq-故障排除)\n\n**选项 2:** CLI 模式：\n\n要使用 CLI 界面运行，您必须在主机上安装软件包：\n\n```sh\n./install.sh\n./install.bat # windows\n```\n\n然后您必须将 `config.ini` 中的 SEARXNG_BASE_URL 更改为：\n\n```sh\nSEARXNG_BASE_URL=\"http://localhost:8080\"\n```\n\n启动所需服务。这将启动 docker-compose.yml 中的一些服务，包括：\n    - searxng\n    - redis（searxng 所需）\n    - frontend\n\n```sh\n./start_services.sh # MacOS\nstart start_services.cmd # Windows\n```\n\n运行：uv run: `uv run python -m ensurepip` 以确保 uv 已启用 pip。\n\n使用 CLI：`uv run cli.py`\n\n---\n\n## 使用方法\n\n确保服务已通过 `./start_services.sh full` 启动并运行，然后转到 `localhost:3000` 使用 Web 界面。\n\n您也可以通过设置 `listen = True` 来使用语音转文本。仅限 CLI 模式。\n\n要退出，只需说/输入 `goodbye`。\n\n以下是一些使用示例：\n\n> *用 python 写一个贪吃蛇游戏！*\n\n> *搜索法国雷恩的最佳咖啡馆，并将三家及其地址保存到 rennes_cafes.txt。*\n\n> *写一个 Go 程序计算阶乘，保存为 factorial.go 到你的工作区*\n\n> *在 summer_pictures 文件夹中查找所有 JPG 文件，用今天日期重命名，并将重命名文件列表保存到 photos_list.txt*\n\n> *在线搜索 2024 年热门科幻电影，挑选三部今晚观看，保存到 movie_night.txt。*\n\n> *搜索 2025 年最新 AI 新闻文章，选三篇，写 Python 脚本抓取标题和摘要，脚本保存为 news_scraper.py，摘要保存到 ai_news.txt（/home/projects）*\n\n> *周五，搜索免费股票价格 API，用 supersuper7434567@gmail.com 注册，然后写 Python 脚本每日获取特斯拉股价，结果保存到 stock_prices.csv*\n\n*请注意，表单填写功能仍为实验性，可能失败。*\n\n输入查询后，AgenticSeek 将分配最佳代理执行任务。\n\n由于这是早期原型，代理路由系统可能无法总是根据您的查询分配正确的代理。\n\n因此，您应该非常明确地表达您想要什么以及 AI 可能如何进行，例如如果您希望它进行网页搜索，不要说：\n\n`你知道哪些适合独自旅行的国家吗？`\n\n而应说：\n\n`进行网页搜索，找出最适合独自旅行的国家`\n\n---\n\n## **在自己的服务器上运行 LLM 的设置**  \n\n如果您有功能强大的计算机或可以使用的服务器，但想从笔记本电脑使用它，您可以选择使用我们的自定义 llm 服务器在远程服务器上运行 LLM。\n\n在将运行 AI 模型的\"服务器\"上，获取 IP 地址\n\n```sh\nip a | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # 本地 IP\ncurl https://ipinfo.io/ip # 公共 IP\n```\n\n注意：对于 Windows 或 macOS，分别使用 ipconfig 或 ifconfig 查找 IP 地址。\n\n克隆仓库并进入 `server/` 文件夹。\n\n```sh\ngit clone --depth 1 https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek/llm_server/\n```\n\n安装服务器特定要求：\n\n```sh\npip3 install -r requirements.txt\n```\n\n运行服务器脚本。\n\n```sh\npython3 app.py --provider ollama --port 3333\n```\n\n您可以选择使用 `ollama` 和 `llamacpp` 作为 LLM 服务。\n\n现在在您的个人计算机上：\n\n更改 `config.ini` 文件，将 `provider_name` 设置为 `server`，`provider_model` 设置为 `deepseek-r1:xxb`。\n将 `provider_server_address` 设置为将运行模型的机器的 IP 地址。\n\n```sh\n[MAIN]\nis_local = False\nprovider_name = server\nprovider_model = deepseek-r1:70b\nprovider_server_address = http://x.x.x.x:3333\n```\n\n下一步：[启动服务并运行 AgenticSeek](#启动服务并运行)  \n\n---\n\n## 语音转文本\n\n警告：目前语音转文本仅适用于 CLI 模式。\n\n请注意，目前语音转文本仅适用于英语。\n\n语音转文本功能默认禁用。要启用它，请在 config.ini 文件中将 listen 选项设置为 True：\n\n```\nlisten = True\n```\n\n启用后，语音转文本功能会监听触发关键字，即代理的名称，然后开始处理您的输入。您可以通过更新 *config.ini* 文件中的 `agent_name` 值来自定义代理的名称：\n\n```\nagent_name = Friday\n```\n\n为了获得最佳识别效果，我们建议使用常见的英文名称，如 \"John\" 或 \"Emma\" 作为代理名称。\n\n一旦您看到转录开始出现，请大声说出代理的名称以唤醒它（例如，\"Friday\"）。\n\n清晰地说出您的查询。\n\n用确认短语结束您的请求，以指示系统继续。确认短语的示例包括：\n```\n\"do it\", \"go ahead\", \"execute\", \"run\", \"start\", \"thanks\", \"would ya\", \"please\", \"okay?\", \"proceed\", \"continue\", \"go on\", \"do that\", \"go it\", \"do you understand?\"\n```\n\n## 配置\n\n配置示例：\n```\n[MAIN]\nis_local = True\nprovider_name = ollama\nprovider_model = deepseek-r1:32b\nprovider_server_address = http://127.0.0.1:11434 # Ollama 示例；LM-Studio 使用 http://127.0.0.1:1234\nagent_name = Friday\nrecover_last_session = False\nsave_session = False\nspeak = False\nlisten = False\n\njarvis_personality = False\nlanguages = en zh # TTS 和潜在路由的语言列表。\n[BROWSER]\nheadless_browser = False\nstealth_mode = False\n```\n\n**`config.ini` 设置说明**：\n\n*   **`[MAIN]` 部分：**\n    *   `is_local`: 如果使用本地 LLM 提供商（Ollama、LM-Studio、本地 OpenAI 兼容服务器）或自托管服务器选项，则为 `True`。如果使用基于云的 API（OpenAI、Google 等），则为 `False`。\n    *   `provider_name`: 指定 LLM 提供商。\n        *   本地选项：`ollama`、`lm-studio`、`openai`（用于本地 OpenAI 兼容服务器）、`server`（用于自托管服务器设置）。\n        *   API 选项：`openai`、`google`、`deepseek`、`huggingface`、`togetherAI`。\n    *   `provider_model`: 所选提供商的特定模型名称或 ID（例如，Ollama 的 `deepseekcoder:6.7b`，OpenAI API 的 `gpt-3.5-turbo`，TogetherAI 的 `mistralai/Mixtral-8x7B-Instruct-v0.1`）。\n    *   `provider_server_address`: 您的 LLM 提供商的地址。\n        *   对于本地提供商：例如，Ollama 的 `http://127.0.0.1:11434`，LM-Studio 的 `http://127.0.0.1:1234`。\n        *   对于 `server` 提供商类型：您的自托管 LLM 服务器的地址（例如 `http://your_server_ip:3333`）。\n        *   对于云 API（`is_local = False`）：这通常被忽略或可以留空，因为 API 端点通常由客户端库处理。\n    *   `agent_name`: AI 助手的名称（例如 Friday）。如果启用，用作语音转文本的触发词。\n    *   `recover_last_session`: `True` 尝试恢复上一个会话的状态，`False` 重新开始。\n    *   `save_session`: `True` 保存当前会话的状态以供潜在恢复，`False` 否则。\n    *   `speak`: `True` 启用文本转语音语音输出，`False` 禁用。\n    *   `listen`: `True` 启用语音转文本语音输入（仅限 CLI 模式），`False` 禁用。\n    *   `work_dir`: **关键：** AgenticSeek 将读取/写入文件的目录。**确保此路径在您的系统上有效且可访问。**\n    *   `jarvis_personality`: `True` 使用更\"Jarvis-like\"的系统提示（实验性），`False` 使用标准提示。\n    *   `languages`: 逗号分隔的语言列表（例如 `en, zh, fr`）。用于 TTS 语音选择（默认为第一个），并可以协助 LLM 路由器。为避免路由器效率低下，避免使用过多或非常相似的语言。\n*   **`[BROWSER]` 部分：**\n    *   `headless_browser`: `True` 在没有可见窗口的情况下运行自动化浏览器（推荐用于 Web 界面或非交互式使用）。`False` 显示浏览器窗口（对于 CLI 模式或调试有用）。\n    *   `stealth_mode`: `True` 启用使浏览器自动化更难检测的措施。可能需要手动安装浏览器扩展，如 anticaptcha。\n\n本节总结了支持的 LLM 提供商类型。在 `config.ini` 中配置它们。\n\n**本地提供商（在您自己的硬件上运行）：**\n\n| config.ini 中的提供商名称 | `is_local` | 描述                                                                 | 设置部分                                                    |\n|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|\n| `ollama`                      | `True`     | 使用 Ollama 轻松提供本地 LLM。                                             | [在您的机器上本地运行 LLM 的设置](#在您的机器上本地运行-llm-的设置) |\n| `lm-studio`                   | `True`     | 使用 LM-Studio 提供本地 LLM。                                          | [在您的机器上本地运行 LLM 的设置](#在您的机器上本地运行-llm-的设置) |\n| `openai`（用于本地服务器）   | `True`     | 连接到暴露 OpenAI 兼容 API 的本地服务器（例如，llama.cpp）。 | [在您的机器上本地运行 LLM 的设置](#在您的机器上本地运行-llm-的设置) |\n| `server`                      | `False`    | 连接到在另一台机器上运行的 AgenticSeek 自托管 LLM 服务器。 | [在自己的服务器上运行 LLM 的设置](#在自己的服务器上运行-llm-的设置) |\n\n**API 提供商（基于云）：**\n\n| config.ini 中的提供商名称 | `is_local` | 描述                                      | 设置部分                                       |\n|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|\n| `openai`                      | `False`    | 使用 OpenAI 的官方 API（例如，GPT-3.5、GPT-4）。 | [使用 API 运行设置](#使用-api-运行设置) |\n| `google`                      | `False`    | 通过 API 使用 Google 的 Gemini 模型。              | [使用 API 运行设置](#使用-api-运行设置) |\n| `deepseek`                    | `False`    | 使用 Deepseek 的官方 API。                     | [使用 API 运行设置](#使用-api-运行设置) |\n| `huggingface`                 | `False`    | 使用 Hugging Face Inference API。                  | [使用 API 运行设置](#使用-api-运行设置) |\n| `togetherAI`                  | `False`    | 使用 TogetherAI 的 API 获取各种开放模型。    | [使用 API 运行设置](#使用-api-运行设置) |\n\n---\n## 故障排除\n\n如果遇到问题，本节提供指导。\n\n# 已知问题\n\n## ChromeDriver 问题\n\n**错误示例：** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`\n\n### 根本原因\nChromeDriver 版本不兼容发生在：\n1. 您安装的 ChromeDriver 版本与 Chrome 浏览器版本不匹配\n2. 在 Docker 环境中，`undetected_chromedriver` 可能会下载自己的 ChromeDriver 版本，绕过挂载的二进制文件\n\n### 解决步骤\n\n#### 1. 检查您的 Chrome 版本\n打开 Google Chrome → `设置 > 关于 Chrome` 查找您的版本（例如，\"版本 134.0.6998.88\"）\n\n#### 2. 下载匹配的 ChromeDriver\n\n**对于 Chrome 115 及更新版本：** 使用 [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)\n- 访问 Chrome for Testing 可用性仪表板\n- 找到您的 Chrome 版本或最接近的可用匹配\n- 为您的操作系统下载 ChromeDriver（Docker 环境使用 Linux64）\n\n**对于旧版 Chrome：** 使用 [旧版 ChromeDriver 下载](https://chromedriver.chromium.org/downloads)\n\n![从 Chrome for Testing 下载 ChromeDriver](./media/chromedriver_readme.png)\n\n#### 3. 安装 ChromeDriver（选择一种方法）\n\n**方法 A：项目根目录（Docker 推荐）**\n```bash\n# 将下载的 chromedriver 二进制文件放在项目根目录\ncp path/to/downloaded/chromedriver ./chromedriver\nchmod +x ./chromedriver  # 在 Linux/macOS 上使其可执行\n```\n\n**方法 B：系统 PATH**\n```bash\n# Linux/macOS\nsudo mv chromedriver /usr/local/bin/\nsudo chmod +x /usr/local/bin/chromedriver\n\n# Windows：将 chromedriver.exe 放在 PATH 中的文件夹中\n```\n\n#### 4. 验证安装\n```bash\n# 测试 ChromeDriver 版本\n./chromedriver --version\n# 或者在 PATH 中：\nchromedriver --version\n```\n\n### Docker 特定说明\n\n⚠️ **Docker 用户重要：**\n- Docker 卷挂载方法可能不适用于隐身模式（`undetected_chromedriver`）\n- **解决方案：** 将 ChromeDriver 放在项目根目录中作为 `./chromedriver`\n- 应用程序将自动检测并使用此二进制文件\n- 您应该在日志中看到：`\"Using ChromeDriver from project root: ./chromedriver\"`\n\n### 故障排除提示\n\n1. **仍然遇到版本不匹配？**\n   - 验证 ChromeDriver 是否可执行：`ls -la ./chromedriver`\n   - 检查 ChromeDriver 版本：`./chromedriver --version`\n   - 确保它与您的 Chrome 浏览器版本匹配\n\n2. **Docker 容器问题？**\n   - 检查后端日志：`docker logs backend`\n   - 查找消息：`\"Using ChromeDriver from project root\"`\n   - 如果未找到，请验证文件是否存在且可执行\n\n3. **Chrome for Testing 版本**\n   - 尽可能使用完全匹配的版本\n   - 对于版本 134.0.6998.88，使用 ChromeDriver 134.0.6998.165（最接近的可用版本）\n   - 主要版本号必须匹配（134 = 134）\n\n### 版本兼容性矩阵\n\n| Chrome 版本 | ChromeDriver 版本 | 状态 |\n|----------------|---------------------|---------|\n| 134.0.6998.x   | 134.0.6998.165     | ✅ 可用 |\n| 133.0.6943.x   | 133.0.6943.141     | ✅ 可用 |\n| 132.0.6834.x   | 132.0.6834.159     | ✅ 可用 |\n\n*有关最新兼容性，请查看 [Chrome for Testing 仪表板](https://googlechromelabs.github.io/chrome-for-testing/)*\n\n`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113\nCurrent browser version is 134.0.6998.89 with binary path`\n\n如果您的浏览器和 chromedriver 版本不匹配，会发生这种情况。\n\n您需要导航到下载最新版本：\n\nhttps://developer.chrome.com/docs/chromedriver/downloads\n\n如果您使用 Chrome 版本 115 或更新版本，请转到：\n\nhttps://googlechromelabs.github.io/chrome-for-testing/\n\n并下载与您的操作系统匹配的 chromedriver 版本。\n\n![alt text](./media/chromedriver_readme.png)\n\n如果此部分不完整，请提出问题。\n\n##  连接适配器问题\n\n```\nException: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'`（注意：端口可能不同）\n```\n\n*   **原因：** `config.ini` 中 `lm-studio`（或其他类似的本地 OpenAI 兼容服务器）的 `provider_server_address` 缺少 `http://` 前缀或指向错误的端口。\n*   **解决方案：**\n    *   确保地址包含 `http://`。LM-Studio 通常默认为 `http://127.0.0.1:1234`。\n    *   正确的 `config.ini`：`provider_server_address = http://127.0.0.1:1234`（或您的实际 LM-Studio 服务器端口）。\n\n## SearxNG 基本 URL 未提供\n\n```\nraise ValueError(\"SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.\")\nValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`\n```\n\n如果您使用错误的 searxng 基本 URL 运行 CLI 模式，可能会出现这种情况。\n\nSEARXNG_BASE_URL 应根据您是在 Docker 中运行还是在主机上运行而有所不同：\n\n**在主机上运行**：`SEARXNG_BASE_URL=\"http://localhost:8080\"`\n\n**完全在 Docker 中运行（Web 界面）**：`SEARXNG_BASE_URL=\"http://searxng:8080\"`\n\n## FAQ\n\n**问：我需要什么硬件？**  \n\n| 模型大小  | GPU  | 评论                                               |\n|-----------|--------|-----------------------------------------------------------|\n| 7B        | 8GB 显存 | ⚠️ 不推荐。性能差，频繁出现幻觉，规划代理可能会失败。 |\n| 14B        | 12 GB VRAM（例如 RTX 3060） | ✅ 可用于简单任务。可能在网页浏览和规划任务方面有困难。 |\n| 32B        | 24+ GB VRAM（例如 RTX 4090） | 🚀 大多数任务成功，可能仍然在任务规划方面有困难 |\n| 70B+        | 48+ GB 显存 | 💪 优秀。推荐用于高级用例。 |\n\n**问：我遇到错误该怎么办？**  \n\n确保本地正在运行（`ollama serve`），您的 `config.ini` 与您的提供商匹配，并且依赖项已安装。如果都不起作用，请随时提出问题。\n\n**问：它真的可以 100% 本地运行吗？**  \n\n是的，使用 Ollama、lm-studio 或服务器提供商，所有语音转文本、LLM 和文本转语音模型都在本地运行。非本地选项（OpenAI 或其他 API）是可选的。\n\n**问：当我有 Manus 时，为什么应该使用 AgenticSeek？**\n\n与 Manus 不同，AgenticSeek 优先考虑独立于外部系统，给您更多控制、隐私和避免 API 成本。\n\n**问：谁是这个项目的幕后推手？**\n\n这个项目是由我创建的，还有两个朋友作为维护者和 GitHub 上开源社区的贡献者。我们只是一群充满热情的个人，不是初创公司，也不隶属于任何组织。\n\nX 上除了我的个人账户（https://x.com/Martin993886460）之外的任何 AgenticSeek 账户都是冒充的。\n\n## 贡献\n\n我们正在寻找开发人员来改进 AgenticSeek！查看开放的问题或讨论。\n\n[贡献指南](./docs/CONTRIBUTING.md)\n\n## 赞助商：\n\n想要通过航班搜索、旅行规划或抢购最佳购物优惠等功能来提升 AgenticSeek 的能力？考虑使用 SerpApi 制作自定义工具，以解锁更多 Jarvis 般的功能。使用 SerpApi，您可以为专业任务加速您的代理，同时保持完全控制。\n\n<a href=\"https://serpapi.com/\"><img src=\"./media/banners/sponsor_banner_serpapi.png\" height=\"350\" alt=\"SerpApi Banner\" ></a>\n\n查看 [Contributing.md](./docs/CONTRIBUTING.md) 了解如何集成自定义工具！\n\n### **赞助商**：\n\n- [tatra-labs](https://github.com/tatra-labs)\n\n## 维护者：\n\n > [Fosowl](https://github.com/Fosowl) | 巴黎时间 \n\n > [antoineVIVIES](https://github.com/antoineVIVIES) | 台北时间 \n\n## 特别感谢：\n\n > [tcsenpai](https://github.com/tcsenpai) 和 [plitc](https://github.com/plitc) 协助后端 Docker 化\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)\n"
  },
  {
    "path": "README_CHT.md",
    "content": "# AgenticSeek：私有、本地的 Manus 替代方案\n\n<p align=\"center\">\n<img align=\"center\" src=\"./media/agentic_seek_logo.png\" width=\"300\" height=\"300\" alt=\"Agentic Seek Logo\">\n<p>\n\n  English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)\n\n*一個**100%本地運行的 Manus AI 替代品**，支援語音的 AI 助手，可自主瀏覽網頁、編寫代碼、規劃任務，所有數據僅保存在你的設備上。專為本地推理模型設計，完全在你的硬件上運行，確保隱私無憂，無需雲端依賴。*\n\n[![訪問 AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)\n\n### 為什麼選擇 AgenticSeek？\n\n* 🔒 完全本地 & 私有 —— 所有內容都在你的電腦上運行，無雲端、無數據共享。你的文件、對話和搜索都保持私密。\n\n* 🌐 智能網頁瀏覽 —— AgenticSeek 可自主瀏覽互聯網：搜索、閱讀、提取信息、填寫網頁表單，全程免手動。\n\n* 💻 自動化編程助手 —— 需要代碼？它能編寫、調試並運行 Python、C、Go、Java 等程序，無需監督。\n\n* 🧠 智能代理選擇 —— 你提問，它自動判斷最合適的代理來完成任務。就像有一支專家團隊隨時待命。\n\n* 📋 規劃並執行複雜任務 —— 從旅行規劃到複雜項目，可將大任務拆分為步驟，調用多個 AI 代理協作完成。\n\n* 🎙️ 語音支持 —— 乾淨、快速、未來感的語音與語音轉文本功能，讓你像科幻電影中的 AI 一樣與它對話。（開發中）\n\n### **演示**\n\n> *你能搜索 agenticSeek 項目，了解需要哪些技能，然後打開 CV_candidates.zip 並告訴我哪些最匹配該項目嗎？*\n\nhttps://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316\n\n免責聲明：本演示及出現的所有文件（如 CV_candidates.zip）均為虛構。我們不是公司，只尋求開源貢獻者而非候選人。\n\n> 🛠⚠️️ **項目正在積極開發中**\n\n> 🙏 本項目起初只是一個副業，沒有路線圖也沒有資金支持。它意外地登上了 GitHub Trending。非常感謝大家的貢獻、反饋與耐心。\n\n## 前置條件\n\n開始前，請確保已安裝以下軟件：\n\n*   **Git:** 用於克隆倉庫。[下載 Git](https://git-scm.com/downloads)\n*   **Python 3.10.x:** 強烈推薦使用 Python 3.10.x 版本。使用其他版本可能導致依賴錯誤。[下載 Python 3.10](https://www.python.org/downloads/release/python-3100/)（選擇 3.10.x 版本）。\n*   **Docker Engine & Docker Compose:** 用於運行捆綁服務如 SearxNG。\n    *   安裝 Docker Desktop（包含 Docker Compose V2）：[Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)\n    *   或者在 Linux 上分別安裝 Docker Engine 和 Docker Compose：[Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/)（確保安裝 Compose V2，例如 `sudo apt-get install docker-compose-plugin`）。\n\n### 1. **克隆倉庫並設置**\n\n```sh\ngit clone https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek\nmv .env.example .env\n```\n\n### 2. 修改 .env 文件內容\n\n```sh\nSEARXNG_BASE_URL=\"http://searxng:8080\" # 如果在主機上運行 CLI 模式，使用 http://127.0.0.1:8080\nREDIS_BASE_URL=\"redis://redis:6379/0\"\nWORK_DIR=\"/Users/mlg/Documents/workspace_for_ai\"\nOLLAMA_PORT=\"11434\"\nLM_STUDIO_PORT=\"1234\"\nCUSTOM_ADDITIONAL_LLM_PORT=\"11435\"\nOPENAI_API_KEY='optional'\nDEEPSEEK_API_KEY='optional'\nOPENROUTER_API_KEY='optional'\nTOGETHER_API_KEY='optional'\nGOOGLE_API_KEY='optional'\nANTHROPIC_API_KEY='optional'\n```\n\n根據需要更新 `.env` 文件：\n\n- **SEARXNG_BASE_URL**: 除非在主機上運行 CLI 模式，否則保持不變。\n- **REDIS_BASE_URL**: 保持不變 \n- **WORK_DIR**: 本地工作目錄路徑。AgenticSeek 可讀取和操作這些文件。\n- **OLLAMA_PORT**: Ollama 服務端口號。\n- **LM_STUDIO_PORT**: LM Studio 服務端口號。\n- **CUSTOM_ADDITIONAL_LLM_PORT**: 任何額外自定義 LLM 服務的端口。\n\n**API 密鑰對於選擇本地運行 LLM 的用戶完全可選，這也是本項目的主要目的。如果硬件足夠，請留空。**\n\n### 3. **啟動 Docker**\n\n確保 Docker 已安裝並在系統上運行。可以使用以下命令啟動 Docker：\n\n- **Linux/macOS:**  \n    打開終端運行：\n    ```sh\n    sudo systemctl start docker\n    ```\n    或者如果已安裝，從應用程序菜單啟動 Docker Desktop。\n\n- **Windows:**  \n    從開始菜單啟動 Docker Desktop。\n\n可以通過執行以下命令驗證 Docker 是否運行：\n```sh\ndocker info\n```\n如果看到 Docker 安裝信息，則表示運行正常。\n\n請參閱下面的[本地提供商列表](#本地提供商列表)了解摘要。\n\n下一步：[本地運行 AgenticSeek](#啟動服務並運行)\n\n*如果遇到問題，請參閱[故障排除](#故障排除)部分。*\n*如果硬件無法本地運行 LLM，請參閱[使用 API 運行設置](#使用-api-運行設置)。*\n*有關詳細 `config.ini` 說明，請參閱[配置部分](#配置)。*\n\n---\n\n## 在您的機器上本地運行 LLM 的設置\n\n**硬件要求：**\n\n要本地運行 LLM，您需要足夠的硬件。至少需要能夠運行 Magistral、Qwen 或 Deepseek 14B 的 GPU。有關詳細的模型/性能建議，請參閱 FAQ。\n\n**設置您的本地提供商**  \n\n啟動您的本地提供商，例如使用 ollama：\n\n```sh\nollama serve\n```\n\n請參閱下面的本地支持提供商列表。\n\n**更新 config.ini**\n\n更改 config.ini 文件，將 provider_name 設置為支持的提供商，provider_model 設置為您的提供商支持的 LLM。我們推薦推理模型，如 *Magistral* 或 *Deepseek*。\n\n有關所需硬件，請參閱 README 末尾的 **FAQ**。\n\n```sh\n[MAIN]\nis_local = True # 無論您是本地運行還是使用遠程提供商。\nprovider_name = ollama # 或 lm-studio、openai 等。\nprovider_model = deepseek-r1:14b # 選擇適合您硬件的模型\nprovider_server_address = 127.0.0.1:11434\nagent_name = Jarvis # 您的 AI 名稱\nrecover_last_session = True # 是否恢復上一個會話\nsave_session = True # 是否記住當前會話\nspeak = False # 文本轉語音\nlisten = False # 語音轉文本，僅限 CLI，實驗性\njarvis_personality = False # 是否使用更\"Jarvis\"風格的性格（實驗性）\nlanguages = en zh # 語言列表，文本轉語音將默認使用列表中的第一種語言\n[BROWSER]\nheadless_browser = True # 除非在主機上使用 CLI，否則保持不變。\nstealth_mode = True # 使用不可檢測的 selenium 減少瀏覽器檢測\n```\n\n**警告**：\n\n- `config.ini` 文件格式不支持註釋。\n不要直接複製粘貼示例配置，因為註釋會導致錯誤。相反，手動修改 `config.ini` 文件，使用您所需的設置，排除任何註釋。\n\n- 如果使用 LM-studio 運行 LLM，請*不要*將 provider_name 設置為 `openai`。將其設置為 `lm-studio`。\n\n- 某些提供商（例如：lm-studio）要求您在 IP 前加上 `http://`。例如 `http://127.0.0.1:1234`\n\n**本地提供商列表**\n\n| 提供商  | 本地？ | 描述                                               |\n|-----------|--------|-----------------------------------------------------------|\n| ollama    | 是    | 使用 ollama 作為 LLM 提供商輕鬆本地運行 LLM |\n| lm-studio  | 是    | 使用 LM studio 本地運行 LLM（將 `provider_name` 設置為 `lm-studio`）|\n| openai    | 是     |  使用 openai 兼容 API（例如：llama.cpp 服務器）  |\n\n下一步：[啟動服務並運行 AgenticSeek](#啟動服務並運行)  \n\n*如果遇到問題，請參閱[故障排除](#故障排除)部分。*\n*如果硬件無法本地運行 LLM，請參閱[使用 API 運行設置](#使用-api-運行設置)。*\n*有關詳細 `config.ini` 說明，請參閱[配置部分](#配置)。*\n\n## 使用 API 運行設置\n\n此設置使用外部、基於雲的 LLM 提供商。您需要從所選服務獲取 API 密鑰。\n\n**1. 選擇 API 提供商並獲取 API 密鑰：**\n\n請參閱下面的[API 提供商列表](#api-提供商列表)。訪問他們的網站註冊並獲取 API 密鑰。\n\n**2. 將您的 API 密鑰設置為環境變量：**\n\n*   **Linux/macOS:**\n    打開終端並使用 `export` 命令。最好將其添加到 shell 的配置文件中（例如 `~/.bashrc`、`~/.zshrc`）以保持持久性。\n    ```sh\n    export PROVIDER_API_KEY=\"your_api_key_here\" \n    # 將 PROVIDER_API_KEY 替換為特定的變量名，例如 OPENAI_API_KEY、GOOGLE_API_KEY\n    ```\n    TogetherAI 示例：\n    ```sh\n    export TOGETHER_API_KEY=\"xxxxxxxxxxxxxxxxxxxxxx\"\n    ```\n*   **Windows:**\n    *   **命令提示符（當前會話臨時）：**\n        ```cmd\n        set PROVIDER_API_KEY=your_api_key_here\n        ```\n    *   **PowerShell（當前會話臨時）：**\n        ```powershell\n        $env:PROVIDER_API_KEY=\"your_api_key_here\"\n        ```\n    *   **永久性：** 在 Windows 搜索欄中搜索\"環境變量\"，點擊\"編輯系統環境變量\"，然後點擊\"環境變量...\"按鈕。添加一個新的用戶變量，使用適當的名稱（例如 `OPENAI_API_KEY`）和您的密鑰作為值。\n\n    *(有關更多詳細信息，請參閱 FAQ：[如何設置 API 密鑰？](#如何設置-api-密鑰))。*\n\n\n**3. 更新 `config.ini`：**\n```ini\n[MAIN]\nis_local = False\nprovider_name = openai # 或 google、deepseek、togetherAI、huggingface\nprovider_model = gpt-3.5-turbo # 或 gemini-1.5-flash、deepseek-chat、mistralai/Mixtral-8x7B-Instruct-v0.1 等。\nprovider_server_address = # 當 is_local = False 時，對於大多數 API 通常被忽略或可以留空\n# ... 其他設置 ...\n```\n*警告：* 確保 `config.ini` 值中沒有尾隨空格。\n\n**API 提供商列表**\n\n| 提供商     | `provider_name` | 本地？ | 描述                                       | API 密鑰鏈接（示例）                     |\n|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|\n| OpenAI       | `openai`        | 否     | 通過 OpenAI 的 API 使用 ChatGPT 模型。              | [platform.openai.com/signup](https://platform.openai.com/signup) |\n| Google Gemini| `google`        | 否     | 通過 Google AI Studio 使用 Google Gemini 模型。    | [aistudio.google.com/keys](https://aistudio.google.com/keys) |\n| Deepseek     | `deepseek`      | 否     | 通過他們的 API 使用 Deepseek 模型。                | [platform.deepseek.com](https://platform.deepseek.com) |\n| Hugging Face | `huggingface`   | 否     | 使用 Hugging Face Inference API 中的模型。       | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |\n| TogetherAI   | `togetherAI`    | 否     | 通過 TogetherAI API 使用各種開源模型。| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |\n| OpenRouter   | `openrouter`    | No     | 通过 OpenRouter 使用各种开源模型| [https://openrouter.ai/](https://openrouter.ai/) |\n\n*注意：*\n*   我們不建議將 `gpt-4o` 或其他 OpenAI 模型用於複雜的網頁瀏覽和任務規劃，因為當前的提示優化針對 Deepseek 等模型。\n*   編碼/bash 任務可能會遇到 Gemini 的問題，因為它可能不嚴格遵循針對 Deepseek 優化的格式化提示。\n*   當 `is_local = False` 時，`config.ini` 中的 `provider_server_address` 通常不使用，因為 API 端點通常在相應提供商的庫中硬編碼。\n\n下一步：[啟動服務並運行 AgenticSeek](#啟動服務並運行)\n\n*如果遇到問題，請參閱**已知問題**部分*\n\n*有關詳細配置文件說明，請參閱**配置**部分。*\n\n---\n\n## 啟動服務並運行\n\n默認情況下，AgenticSeek 完全在 Docker 中運行。\n\n**選項 1:** 在 Docker 中運行，使用 Web 界面：\n\n啟動所需服務。這將啟動 docker-compose.yml 中的所有服務，包括：\n    - searxng\n    - redis（searxng 所需）\n    - frontend\n    - backend（如果使用 Web 界面時使用 `full`）\n\n```sh\n./start_services.sh full # MacOS\nstart start_services.cmd full # Windows\n```\n\n**警告：** 此步驟將下載並加載所有 Docker 鏡像，可能需要長達 30 分鐘。啟動服務後，請等待後端服務完全運行（您應該在日誌中看到 **backend: \"GET /health HTTP/1.1\" 200 OK**）後再發送任何消息。首次運行時，後端服務可能需要 5 分鐘才能啟動。\n\n轉到 `http://localhost:3000/`，您應該會看到 Web 界面。\n\n*服務啟動故障排除：* 如果這些腳本失敗，請確保 Docker Engine 正在運行並且 Docker Compose（V2，`docker compose`）已正確安裝。檢查終端輸出中的錯誤消息。請參閱 [FAQ：幫助！運行 AgenticSeek 或其腳本時出現錯誤。](#faq-故障排除)\n\n**選項 2:** CLI 模式：\n\n要使用 CLI 界面運行，您必須在主機上安裝軟件包：\n\n```sh\n./install.sh\n./install.bat # windows\n```\n\n然後您必須將 `config.ini` 中的 SEARXNG_BASE_URL 更改為：\n\n```sh\nSEARXNG_BASE_URL=\"http://localhost:8080\"\n```\n\n啟動所需服務。這將啟動 docker-compose.yml 中的一些服務，包括：\n    - searxng\n    - redis（searxng 所需）\n    - frontend\n\n```sh\n./start_services.sh # MacOS\nstart start_services.cmd # Windows\n```\n\n運行：uv run: `uv run python -m ensurepip` 以確保 uv 已啟用 pip。\n\n使用 CLI：`uv run cli.py`\n\n---\n\n## 使用方法\n\n確保服務已通過 `./start_services.sh full` 啟動並運行，然後轉到 `localhost:3000` 使用 Web 界面。\n\n您也可以通過設置 `listen = True` 來使用語音轉文本。僅限 CLI 模式。\n\n要退出，只需說/輸入 `goodbye`。\n\n以下是一些使用示例：\n\n> *用 python 寫一個貪吃蛇遊戲！*\n\n> *搜索法國雷恩的最佳咖啡館，並將三家及其地址保存到 rennes_cafes.txt。*\n\n> *寫一個 Go 程序計算階乘，保存為 factorial.go 到你的工作區*\n\n> *在 summer_pictures 文件夾中查找所有 JPG 文件，用今天日期重命名，並將重命名文件列表保存到 photos_list.txt*\n\n> *在線搜索 2024 年熱門科幻電影，挑選三部今晚觀看，保存到 movie_night.txt。*\n\n> *搜索 2025 年最新 AI 新聞文章，選三篇，寫 Python 腳本抓取標題和摘要，腳本保存為 news_scraper.py，摘要保存到 ai_news.txt（/home/projects）*\n\n> *周五，搜索免費股票價格 API，用 supersuper7434567@gmail.com 註冊，然後寫 Python 腳本每日獲取特斯拉股價，結果保存到 stock_prices.csv*\n\n*請注意，表單填寫功能仍為實驗性，可能失敗。*\n\n輸入查詢後，AgenticSeek 將分配最佳代理執行任務。\n\n由於這是早期原型，代理路由系統可能無法總是根據您的查詢分配正確的代理。\n\n因此，您應該非常明確地表達您想要什麼以及 AI 可能如何進行，例如如果您希望它進行網頁搜索，不要說：\n\n`你知道哪些適合獨自旅行的國家嗎？`\n\n而應說：\n\n`進行網頁搜索，找出最適合獨自旅行的國家`\n\n---\n\n## **在自己的服務器上運行 LLM 的設置**  \n\n如果您有功能強大的計算機或可以使用的服務器，但想從筆記本電腦使用它，您可以選擇使用我們的自定義 llm 服務器在遠程服務器上運行 LLM。\n\n在將運行 AI 模型的\"服務器\"上，獲取 IP 地址\n\n```sh\nip a | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # 本地 IP\ncurl https://ipinfo.io/ip # 公共 IP\n```\n\n注意：對於 Windows 或 macOS，分別使用 ipconfig 或 ifconfig 查找 IP 地址。\n\n克隆倉庫並進入 `server/` 文件夾。\n\n```sh\ngit clone --depth 1 https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek/llm_server/\n```\n\n安裝服務器特定要求：\n\n```sh\npip3 install -r requirements.txt\n```\n\n運行服務器腳本。\n\n```sh\npython3 app.py --provider ollama --port 3333\n```\n\n您可以選擇使用 `ollama` 和 `llamacpp` 作為 LLM 服務。\n\n現在在您的個人計算機上：\n\n更改 `config.ini` 文件，將 `provider_name` 設置為 `server`，`provider_model` 設置為 `deepseek-r1:xxb`。\n將 `provider_server_address` 設置為將運行模型的機器的 IP 地址。\n\n```sh\n[MAIN]\nis_local = False\nprovider_name = server\nprovider_model = deepseek-r1:70b\nprovider_server_address = http://x.x.x.x:3333\n```\n\n下一步：[啟動服務並運行 AgenticSeek](#啟動服務並運行)  \n\n---\n\n## 語音轉文本\n\n警告：目前語音轉文本僅適用於 CLI 模式。\n\n請注意，目前語音轉文本僅適用於英語。\n\n語音轉文本功能默認禁用。要啟用它，請在 config.ini 文件中將 listen 選項設置為 True：\n\n```\nlisten = True\n```\n\n啟用後，語音轉文本功能會監聽觸發關鍵字，即代理的名稱，然後開始處理您的輸入。您可以通過更新 *config.ini* 文件中的 `agent_name` 值來自定義代理的名稱：\n\n```\nagent_name = Friday\n```\n\n為了獲得最佳識別效果，我們建議使用常見的英文名稱，如 \"John\" 或 \"Emma\" 作為代理名稱。\n\n一旦您看到轉錄開始出現，請大聲說出代理的名稱以喚醒它（例如，\"Friday\"）。\n\n清晰地說出您的查詢。\n\n用確認短語結束您的請求，以指示系統繼續。確認短語的示例包括：\n```\n\"do it\", \"go ahead\", \"execute\", \"run\", \"start\", \"thanks\", \"would ya\", \"please\", \"okay?\", \"proceed\", \"continue\", \"go on\", \"do that\", \"go it\", \"do you understand?\"\n```\n\n## 配置\n\n配置示例：\n```\n[MAIN]\nis_local = True\nprovider_name = ollama\nprovider_model = deepseek-r1:32b\nprovider_server_address = http://127.0.0.1:11434 # Ollama 示例；LM-Studio 使用 http://127.0.0.1:1234\nagent_name = Friday\nrecover_last_session = False\nsave_session = False\nspeak = False\nlisten = False\n\njarvis_personality = False\nlanguages = en zh # TTS 和潛在路由的語言列表。\n[BROWSER]\nheadless_browser = False\nstealth_mode = False\n```\n\n**`config.ini` 設置說明**：\n\n*   **`[MAIN]` 部分：**\n    *   `is_local`: 如果使用本地 LLM 提供商（Ollama、LM-Studio、本地 OpenAI 兼容服務器）或自託管服務器選項，則為 `True`。如果使用基於雲的 API（OpenAI、Google 等），則為 `False`。\n    *   `provider_name`: 指定 LLM 提供商。\n        *   本地選項：`ollama`、`lm-studio`、`openai`（用於本地 OpenAI 兼容服務器）、`server`（用於自託管服務器設置）。\n        *   API 選項：`openai`、`google`、`deepseek`、`huggingface`、`togetherAI`。\n    *   `provider_model`: 所選提供商的特定模型名稱或 ID（例如，Ollama 的 `deepseekcoder:6.7b`，OpenAI API 的 `gpt-3.5-turbo`，TogetherAI 的 `mistralai/Mixtral-8x7B-Instruct-v0.1`）。\n    *   `provider_server_address`: 您的 LLM 提供商的地址。\n        *   對於本地提供商：例如，Ollama 的 `http://127.0.0.1:11434`，LM-Studio 的 `http://127.0.0.1:1234`。\n        *   對於 `server` 提供商類型：您的自託管 LLM 服務器的地址（例如 `http://your_server_ip:3333`）。\n        *   對於雲 API（`is_local = False`）：這通常被忽略或可以留空，因為 API 端點通常由客戶端庫處理。\n    *   `agent_name`: AI 助手的名稱（例如 Friday）。如果啟用，用作語音轉文本的觸發詞。\n    *   `recover_last_session`: `True` 嘗試恢復上一個會話的狀態，`False` 重新開始。\n    *   `save_session`: `True` 保存當前會話的狀態以供潛在恢復，`False` 否則。\n    *   `speak`: `True` 啟用文本轉語音語音輸出，`False` 禁用。\n    *   `listen`: `True` 啟用語音轉文本語音輸入（僅限 CLI 模式），`False` 禁用。\n    *   `work_dir`: **關鍵：** AgenticSeek 將讀取/寫入文件的目錄。**確保此路徑在您的系統上有效且可訪問。**\n    *   `jarvis_personality`: `True` 使用更\"Jarvis-like\"的系統提示（實驗性），`False` 使用標準提示。\n    *   `languages`: 逗號分隔的語言列表（例如 `en, zh, fr`）。用於 TTS 語音選擇（默認為第一個），並可以協助 LLM 路由器。為避免路由器效率低下，避免使用過多或非常相似的語言。\n*   **`[BROWSER]` 部分：**\n    *   `headless_browser`: `True` 在沒有可見窗口的情況下運行自動化瀏覽器（推薦用於 Web 界面或非交互式使用）。`False` 顯示瀏覽器窗口（對於 CLI 模式或調試有用）。\n    *   `stealth_mode`: `True` 啟用使瀏覽器自動化更難檢測的措施。可能需要手動安裝瀏覽器擴展，如 anticaptcha。\n\n本節總結了支持的 LLM 提供商類型。在 `config.ini` 中配置它們。\n\n**本地提供商（在您自己的硬件上運行）：**\n\n| config.ini 中的提供商名稱 | `is_local` | 描述                                                                 | 設置部分                                                    |\n|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|\n| `ollama`                      | `True`     | 使用 Ollama 輕鬆提供本地 LLM。                                             | [在您的機器上本地運行 LLM 的設置](#在您的機器上本地運行-llm-的設置) |\n| `lm-studio`                   | `True`     | 使用 LM-Studio 提供本地 LLM。                                          | [在您的機器上本地運行 LLM 的設置](#在您的機器上本地運行-llm-的設置) |\n| `openai`（用於本地服務器）   | `True`     | 連接到暴露 OpenAI 兼容 API 的本地服務器（例如，llama.cpp）。 | [在您的機器上本地運行 LLM 的設置](#在您的機器上本地運行-llm-的設置) |\n| `server`                      | `False`    | 連接到在另一台機器上運行的 AgenticSeek 自託管 LLM 服務器。 | [在自己的服務器上運行 LLM 的設置](#在自己的服務器上運行-llm-的設置) |\n\n**API 提供商（基於雲）：**\n\n| config.ini 中的提供商名稱 | `is_local` | 描述                                      | 設置部分                                       |\n|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|\n| `openai`                      | `False`    | 使用 OpenAI 的官方 API（例如，GPT-3.5、GPT-4）。 | [使用 API 運行設置](#使用-api-運行設置) |\n| `google`                      | `False`    | 通過 API 使用 Google 的 Gemini 模型。              | [使用 API 運行設置](#使用-api-運行設置) |\n| `deepseek`                    | `False`    | 使用 Deepseek 的官方 API。                     | [使用 API 運行設置](#使用-api-運行設置) |\n| `huggingface`                 | `False`    | 使用 Hugging Face Inference API。                  | [使用 API 運行設置](#使用-api-運行設置) |\n| `togetherAI`                  | `False`    | 使用 TogetherAI 的 API 獲取各種開放模型。    | [使用 API 運行設置](#使用-api-運行設置) |\n\n---\n## 故障排除\n\n如果遇到問題，本節提供指導。\n\n# 已知問題\n\n## ChromeDriver 問題\n\n**錯誤示例：** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`\n\n### 根本原因\nChromeDriver 版本不兼容發生在：\n1. 您安裝的 ChromeDriver 版本與 Chrome 瀏覽器版本不匹配\n2. 在 Docker 環境中，`undetected_chromedriver` 可能會下載自己的 ChromeDriver 版本，繞過掛載的二進制文件\n\n### 解決步驟\n\n#### 1. 檢查您的 Chrome 版本\n打開 Google Chrome → `設置 > 關於 Chrome` 查找您的版本（例如，\"版本 134.0.6998.88\"）\n\n#### 2. 下載匹配的 ChromeDriver\n\n**對於 Chrome 115 及更新版本：** 使用 [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)\n- 訪問 Chrome for Testing 可用性儀表板\n- 找到您的 Chrome 版本或最接近的可用匹配\n- 為您的操作系統下載 ChromeDriver（Docker 環境使用 Linux64）\n\n**對於舊版 Chrome：** 使用 [舊版 ChromeDriver 下載](https://chromedriver.chromium.org/downloads)\n\n![從 Chrome for Testing 下載 ChromeDriver](./media/chromedriver_readme.png)\n\n#### 3. 安裝 ChromeDriver（選擇一種方法）\n\n**方法 A：項目根目錄（Docker 推薦）**\n```bash\n# 將下載的 chromedriver 二進制文件放在項目根目錄\ncp path/to/downloaded/chromedriver ./chromedriver\nchmod +x ./chromedriver  # 在 Linux/macOS 上使其可執行\n```\n\n**方法 B：系統 PATH**\n```bash\n# Linux/macOS\nsudo mv chromedriver /usr/local/bin/\nsudo chmod +x /usr/local/bin/chromedriver\n\n# Windows：將 chromedriver.exe 放在 PATH 中的文件夾中\n```\n\n#### 4. 驗證安裝\n```bash\n# 測試 ChromeDriver 版本\n./chromedriver --version\n# 或者在 PATH 中：\nchromedriver --version\n```\n\n### Docker 特定說明\n\n⚠️ **Docker 用戶重要：**\n- Docker 卷掛載方法可能不適用於隱身模式（`undetected_chromedriver`）\n- **解決方案：** 將 ChromeDriver 放在項目根目錄中作為 `./chromedriver`\n- 應用程序將自動檢測並使用此二進制文件\n- 您應該在日誌中看到：`\"Using ChromeDriver from project root: ./chromedriver\"`\n\n### 故障排除提示\n\n1. **仍然遇到版本不匹配？**\n   - 驗證 ChromeDriver 是否可執行：`ls -la ./chromedriver`\n   - 檢查 ChromeDriver 版本：`./chromedriver --version`\n   - 確保它與您的 Chrome 瀏覽器版本匹配\n\n2. **Docker 容器問題？**\n   - 檢查後端日誌：`docker logs backend`\n   - 查找消息：`\"Using ChromeDriver from project root\"`\n   - 如果未找到，請驗證文件是否存在且可執行\n\n3. **Chrome for Testing 版本**\n   - 盡可能使用完全匹配的版本\n   - 對於版本 134.0.6998.88，使用 ChromeDriver 134.0.6998.165（最接近的可用版本）\n   - 主要版本號必須匹配（134 = 134）\n\n### 版本兼容性矩陣\n\n| Chrome 版本 | ChromeDriver 版本 | 狀態 |\n|----------------|---------------------|---------|\n| 134.0.6998.x   | 134.0.6998.165     | ✅ 可用 |\n| 133.0.6943.x   | 133.0.6943.141     | ✅ 可用 |\n| 132.0.6834.x   | 132.0.6834.159     | ✅ 可用 |\n\n*有關最新兼容性，請查看 [Chrome for Testing 儀表板](https://googlechromelabs.github.io/chrome-for-testing/)*\n\n`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113\nCurrent browser version is 134.0.6998.89 with binary path`\n\n如果您的瀏覽器和 chromedriver 版本不匹配，會發生這種情況。\n\n您需要導航到下載最新版本：\n\nhttps://developer.chrome.com/docs/chromedriver/downloads\n\n如果您使用 Chrome 版本 115 或更新版本，請轉到：\n\nhttps://googlechromelabs.github.io/chrome-for-testing/\n\n並下載與您的操作系統匹配的 chromedriver 版本。\n\n![alt text](./media/chromedriver_readme.png)\n\n如果此部分不完整，請提出問題。\n\n##  連接適配器問題\n\n```\nException: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'`（注意：端口可能不同）\n```\n\n*   **原因：** `config.ini` 中 `lm-studio`（或其他類似的本地 OpenAI 兼容服務器）的 `provider_server_address` 缺少 `http://` 前綴或指向錯誤的端口。\n*   **解決方案：**\n    *   確保地址包含 `http://`。LM-Studio 通常默認為 `http://127.0.0.1:1234`。\n    *   正確的 `config.ini`：`provider_server_address = http://127.0.0.1:1234`（或您的實際 LM-Studio 服務器端口）。\n\n## SearxNG 基本 URL 未提供\n\n```\nraise ValueError(\"SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.\")\nValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`\n```\n\n如果您使用錯誤的 searxng 基本 URL 運行 CLI 模式，可能會出現這種情況。\n\nSEARXNG_BASE_URL 應根據您是在 Docker 中運行還是在主機上運行而有所不同：\n\n**在主機上運行**：`SEARXNG_BASE_URL=\"http://localhost:8080\"`\n\n**完全在 Docker 中運行（Web 界面）**：`SEARXNG_BASE_URL=\"http://searxng:8080\"`\n\n## FAQ\n\n**問：我需要什麼硬件？**  \n\n| 模型大小  | GPU  | 評論                                               |\n|-----------|--------|-----------------------------------------------------------|\n| 7B        | 8GB 顯存 | ⚠️ 不推薦。性能差，頻繁出現幻覺，規劃代理可能會失敗。 |\n| 14B        | 12 GB VRAM（例如 RTX 3060） | ✅ 可用於簡單任務。可能在網頁瀏覽和規劃任務方面有困難。 |\n| 32B        | 24+ GB VRAM（例如 RTX 4090） | 🚀 大多數任務成功，可能仍然在任務規劃方面有困難 |\n| 70B+        | 48+ GB 顯存 | 💪 優秀。推薦用於高級用例。 |\n\n**問：我遇到錯誤該怎麼辦？**  \n\n確保本地正在運行（`ollama serve`），您的 `config.ini` 與您的提供商匹配，並且依賴項已安裝。如果都不起作用，請隨時提出問題。\n\n**問：它真的可以 100% 本地運行嗎？**  \n\n是的，使用 Ollama、lm-studio 或服務器提供商，所有語音轉文本、LLM 和文本轉語音模型都在本地運行。非本地選項（OpenAI 或其他 API）是可選的。\n\n**問：當我有 Manus 時，為什麼應該使用 AgenticSeek？**\n\n與 Manus 不同，AgenticSeek 優先考慮獨立於外部系統，給您更多控制、隱私和避免 API 成本。\n\n**問：誰是這個項目的幕後推手？**\n\n這個項目是由我創建的，還有兩個朋友作為維護者和 GitHub 上開源社區的貢獻者。我們只是一群充滿熱情的個人，不是初創公司，也不隸屬於任何組織。\n\nX 上除了我的個人賬戶（https://x.com/Martin993886460）之外的任何 AgenticSeek 賬戶都是冒充的。\n\n## 貢獻\n\n我們正在尋找開發人員來改進 AgenticSeek！查看開放的問題或討論。\n\n[貢獻指南](./docs/CONTRIBUTING.md)\n\n## 贊助商：\n\n想要通過航班搜索、旅行規劃或搶購最佳購物優惠等功能來提升 AgenticSeek 的能力？考慮使用 SerpApi 製作自定義工具，以解鎖更多 Jarvis 般的功能。使用 SerpApi，您可以為專業任務加速您的代理，同時保持完全控制。\n\n<a href=\"https://serpapi.com/\"><img src=\"./media/banners/sponsor_banner_serpapi.png\" height=\"350\" alt=\"SerpApi Banner\" ></a>\n\n查看 [Contributing.md](./docs/CONTRIBUTING.md) 了解如何集成自定義工具！\n\n### **贊助商**：\n\n- [tatra-labs](https://github.com/tatra-labs)\n\n## 維護者：\n\n > [Fosowl](https://github.com/Fosowl) | 巴黎時間 \n\n > [antoineVIVIES](https://github.com/antoineVIVIES) | 台北時間 \n\n## 特別感謝：\n\n > [tcsenpai](https://github.com/tcsenpai) 和 [plitc](https://github.com/plitc) 協助後端 Docker 化\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)\n"
  },
  {
    "path": "README_ES.md",
    "content": "# AgenticSeek: Una Alternativa Privada y Local a Manus\n\n<p align=\"center\">\n<img align=\"center\" src=\"./media/agentic_seek_logo.png\" width=\"300\" height=\"300\" alt=\"Agentic Seek Logo\">\n<p>\n\n  English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)\n\n*Un asistente de IA con capacidad de voz que es una **alternativa 100% local a Manus AI**, navega autónomamente por la web, escribe código y planifica tareas manteniendo todos los datos en tu dispositivo. Diseñado para modelos de razonamiento local, funciona completamente en tu hardware, garantizando privacidad total y cero dependencia de la nube.*\n\n[![Visitar AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)\n\n### ¿Por qué AgenticSeek?\n\n* 🔒 Totalmente Local & Privado - Todo funciona en tu máquina, sin nube, sin compartir datos. Tus archivos, conversaciones y búsquedas permanecen privados.\n\n* 🌐 Navegación Web Inteligente - AgenticSeek puede navegar por Internet de forma autónoma: buscar, leer, extraer información, completar formularios web, todo sin manos.\n\n* 💻 Asistente de Programación Autónomo - ¿Necesitas código? Puede escribir, depurar y ejecutar programas en Python, C, Go, Java y más, sin supervisión.\n\n* 🧠 Selección Inteligente de Agentes - Tú pides, él elige automáticamente el mejor agente para la tarea. Como tener un equipo de expertos siempre disponible.\n\n* 📋 Planifica y Ejecuta Tareas Complejas - Desde planificación de viajes hasta proyectos complejos, puede dividir grandes tareas en pasos y completarlos utilizando múltiples agentes de IA.\n\n* 🎙️ Compatibilidad con Voz - Voz limpia, rápida y futurista con reconocimiento de voz, permitiéndote conversar como si fuera tu IA personal de una película de ciencia ficción. (En desarrollo)\n\n### **Demo**\n\n> *¿Puedes buscar el proyecto agenticSeek, aprender qué habilidades se necesitan, luego abrir CV_candidates.zip y decirme cuáles coinciden mejor con el proyecto?*\n\nhttps://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316\n\nDescargo de responsabilidad: Esta demostración y todos los archivos que aparecen (ej: CV_candidates.zip) son completamente ficticios. No somos una corporación, buscamos colaboradores de código abierto, no candidatos.\n\n> 🛠⚠️️ **Trabajo Activo en Progreso**\n\n> 🙏 Este proyecto comenzó como un proyecto paralelo y no tiene hoja de ruta ni financiación. Creció mucho más allá de lo esperado al aparecer en GitHub Trending. Las contribuciones, comentarios y paciencia son profundamente apreciados.\n\n## Prerrequisitos\n\nAntes de comenzar, asegúrate de tener instalado:\n\n*   **Git:** Para clonar el repositorio. [Descargar Git](https://git-scm.com/downloads)\n*   **Python 3.10.x:** Se recomienda encarecidamente Python 3.10.x. Otras versiones pueden causar errores de dependencia. [Descargar Python 3.10](https://www.python.org/downloads/release/python-3100/) (selecciona la versión 3.10.x).\n*   **Docker Engine & Docker Compose:** Para ejecutar servicios empaquetados como SearxNG.\n    *   Instalar Docker Desktop (incluye Docker Compose V2): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)\n    *   O instalar Docker Engine y Docker Compose por separado en Linux: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (asegúrate de instalar Compose V2, por ejemplo `sudo apt-get install docker-compose-plugin`).\n\n### 1. **Clonar el repositorio y configurar**\n\n```sh\ngit clone https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek\nmv .env.example .env\n```\n\n### 2. Modificar el contenido del archivo .env\n\n```sh\nSEARXNG_BASE_URL=\"http://searxng:8080\" # Si ejecutas en modo CLI en el host, usa http://127.0.0.1:8080\nREDIS_BASE_URL=\"redis://redis:6379/0\"\nWORK_DIR=\"/Users/mlg/Documents/workspace_for_ai\"\nOLLAMA_PORT=\"11434\"\nLM_STUDIO_PORT=\"1234\"\nCUSTOM_ADDITIONAL_LLM_PORT=\"11435\"\nOPENAI_API_KEY='optional'\nDEEPSEEK_API_KEY='optional'\nOPENROUTER_API_KEY='optional'\nTOGETHER_API_KEY='optional'\nGOOGLE_API_KEY='optional'\nANTHROPIC_API_KEY='optional'\n```\n\nActualiza el archivo `.env` según sea necesario:\n\n- **SEARXNG_BASE_URL**: Mantener sin cambios a menos que ejecutes en modo CLI en el host.\n- **REDIS_BASE_URL**: Mantener sin cambios \n- **WORK_DIR**: Ruta al directorio de trabajo local. AgenticSeek podrá leer e interactuar con estos archivos.\n- **OLLAMA_PORT**: Número de puerto para el servicio Ollama.\n- **LM_STUDIO_PORT**: Número de puerto para el servicio LM Studio.\n- **CUSTOM_ADDITIONAL_LLM_PORT**: Puerto para cualquier servicio LLM adicional personalizado.\n\n**Las claves API son completamente opcionales para quienes optan por ejecutar LLM localmente, que es el objetivo principal de este proyecto. Déjalas en blanco si tienes hardware suficiente.**\n\n### 3. **Iniciar Docker**\n\nAsegúrate de que Docker esté instalado y ejecutándose en tu sistema. Puedes iniciar Docker con los siguientes comandos:\n\n- **Linux/macOS:**  \n    Abre una terminal y ejecuta:\n    ```sh\n    sudo systemctl start docker\n    ```\n    O inicia Docker Desktop desde el menú de aplicaciones, si está instalado.\n\n- **Windows:**  \n    Inicia Docker Desktop desde el menú Inicio.\n\nPuedes verificar si Docker se está ejecutando ejecutando:\n```sh\ndocker info\n```\nSi ves información sobre tu instalación de Docker, está funcionando correctamente.\n\nConsulta la [Lista de proveedores locales](#lista-de-proveedores-locales) a continuación para obtener un resumen.\n\nSiguiente paso: [Ejecutar AgenticSeek localmente](#iniciar-servicios-y-ejecutar)\n\n*Si tienes problemas, consulta la sección [Solución de problemas](#solución-de-problemas).*\n*Si tu hardware no puede ejecutar LLM localmente, consulta [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api).*\n*Para explicaciones detalladas de `config.ini`, consulta la [sección Configuración](#configuración).*\n\n---\n\n## Configuración para ejecutar LLM localmente en tu máquina\n\n**Requisitos de hardware:**\n\nPara ejecutar LLM localmente, necesitarás hardware suficiente. Como mínimo, se requiere una GPU capaz de ejecutar Magistral, Qwen o Deepseek 14B. Consulta el FAQ para recomendaciones detalladas de modelo/rendimiento.\n\n**Configura tu proveedor local**  \n\nInicia tu proveedor local, por ejemplo con ollama:\n\n```sh\nollama serve\n```\n\nConsulta la lista de proveedores locales admitidos a continuación.\n\n**Actualizar config.ini**\n\nCambia el archivo config.ini para establecer provider_name en un proveedor admitido y provider_model en un LLM admitido por tu proveedor. Recomendamos modelos de razonamiento como *Magistral* o *Deepseek*.\n\nConsulta el **FAQ** al final del README para el hardware necesario.\n\n```sh\n[MAIN]\nis_local = True # Ya sea que ejecutes localmente o con un proveedor remoto.\nprovider_name = ollama # o lm-studio, openai, etc.\nprovider_model = deepseek-r1:14b # elige un modelo compatible con tu hardware\nprovider_server_address = 127.0.0.1:11434\nagent_name = Jarvis # el nombre de tu IA\nrecover_last_session = True # recuperar sesión anterior\nsave_session = True # recordar sesión actual\nspeak = False # texto a voz\nlisten = False # voz a texto, solo para CLI, experimental\njarvis_personality = False # usar personalidad más \"Jarvis\" (experimental)\nlanguages = en zh # Lista de idiomas, TTS usará el primero de la lista por defecto\n[BROWSER]\nheadless_browser = True # mantener sin cambios a menos que uses CLI en el host.\nstealth_mode = True # Usa selenium indetectable para reducir la detección del navegador\n```\n\n**Advertencia**:\n\n- El formato del archivo `config.ini` no admite comentarios.\nNo copies y pegues la configuración de ejemplo directamente, ya que los comentarios causarán errores. En su lugar, modifica manualmente el archivo `config.ini` con tu configuración deseada, sin comentarios.\n\n- *NO* establezcas provider_name como `openai` si estás usando LM-studio para ejecutar LLM. Úsalo como `lm-studio`.\n\n- Algunos proveedores (ej: lm-studio) requieren `http://` antes de la IP. Ejemplo: `http://127.0.0.1:1234`\n\n**Lista de proveedores locales**\n\n| Proveedor  | ¿Local? | Descripción                                               |\n|-----------|--------|-----------------------------------------------------------|\n| ollama    | Sí    | Ejecuta LLM localmente fácilmente usando ollama |\n| lm-studio  | Sí    | Ejecuta LLM localmente con LM studio (establecer `provider_name` = `lm-studio`)|\n| openai    | Sí     |  Usa API compatible con openai (ej: servidor llama.cpp)  |\n\nSiguiente paso: [Iniciar servicios y ejecutar AgenticSeek](#iniciar-servicios-y-ejecutar)  \n\n*Si tienes problemas, consulta la sección [Solución de problemas](#solución-de-problemas).*\n*Si tu hardware no puede ejecutar LLM localmente, consulta [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api).*\n*Para explicaciones detalladas de `config.ini`, consulta la [sección Configuración](#configuración).*\n\n## Configuración para ejecutar con una API\n\nEsta configuración utiliza proveedores de LLM externos basados en la nube. Necesitarás obtener claves API del servicio elegido.\n\n**1. Elige un proveedor de API y obtén una clave API:**\n\nConsulta la [Lista de proveedores de API](#lista-de-proveedores-de-api) a continuación. Visita sus sitios web para registrarte y obtener claves API.\n\n**2. Establece tu clave API como variable de entorno:**\n\n*   **Linux/macOS:**\n    Abre una terminal y usa el comando `export`. Es mejor agregarlo al archivo de configuración de tu shell (ej: `~/.bashrc`, `~/.zshrc`) para que sea persistente.\n    ```sh\n    export PROVIDER_API_KEY=\"your_api_key_here\" \n    # Reemplaza PROVIDER_API_KEY con el nombre de variable específico, ej: OPENAI_API_KEY, GOOGLE_API_KEY\n    ```\n    Ejemplo de TogetherAI:\n    ```sh\n    export TOGETHER_API_KEY=\"xxxxxxxxxxxxxxxxxxxxxx\"\n    ```\n*   **Windows:**\n    *   **Símbolo del sistema (temporal para la sesión actual):**\n        ```cmd\n        set PROVIDER_API_KEY=your_api_key_here\n        ```\n    *   **PowerShell (temporal para la sesión actual):**\n        ```powershell\n        $env:PROVIDER_API_KEY=\"your_api_key_here\"\n        ```\n    *   **Permanente:** Busca \"variables de entorno\" en la barra de búsqueda de Windows, haz clic en \"Editar las variables de entorno del sistema\", luego en el botón \"Variables de entorno...\". Agrega una nueva variable de usuario con el nombre apropiado (ej: `OPENAI_API_KEY`) y tu clave como valor.\n\n    *(Para más detalles, consulta el FAQ: [¿Cómo configuro una clave API?](#cómo-configuro-una-clave-api)).*\n\n\n**3. Actualiza `config.ini`:**\n```ini\n[MAIN]\nis_local = False\nprovider_name = openai # o google, deepseek, togetherAI, huggingface\nprovider_model = gpt-3.5-turbo # o gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1, etc.\nprovider_server_address = # Cuando is_local = False, generalmente se ignora o puede dejarse en blanco para la mayoría de las API\n# ... otras configuraciones ...\n```\n*Advertencia:* Asegúrate de que no haya espacios al final de los valores en config.\n\n**Lista de proveedores de API**\n\n| Proveedor     | `provider_name` | ¿Local? | Descripción                                       | Enlace de clave API (ejemplo)                     |\n|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|\n| OpenAI       | `openai`        | No     | Usa modelos ChatGPT a través de la API de OpenAI.              | [platform.openai.com/signup](https://platform.openai.com/signup) |\n| Google Gemini| `google`        | No     | Usa modelos Google Gemini a través de Google AI Studio.    | [aistudio.google.com/keys](https://aistudio.google.com/keys) |\n| Deepseek     | `deepseek`      | No     | Usa modelos Deepseek a través de su API.                | [platform.deepseek.com](https://platform.deepseek.com) |\n| Hugging Face | `huggingface`   | No     | Usa modelos del Hugging Face Inference API.       | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |\n| TogetherAI   | `togetherAI`    | No     | Usa varios modelos de código abierto a través de la API de TogetherAI.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |\n\n*Nota:*\n*   No recomendamos usar `gpt-4o` u otros modelos OpenAI para navegación web compleja y planificación de tareas, ya que la optimización actual de prompts está dirigida a modelos como Deepseek.\n*   Las tareas de codificación/bash pueden fallar con Gemini, ya que tiende a ignorar nuestro formato de prompt optimizado para Deepseek r1.\n*   Cuando `is_local = False`, `provider_server_address` en `config.ini` generalmente no se usa, ya que los endpoints de API suelen estar codificados en las bibliotecas del proveedor correspondiente.\n\nSiguiente paso: [Iniciar servicios y ejecutar AgenticSeek](#iniciar-servicios-y-ejecutar)\n\n*Si tienes problemas, consulta la sección **Problemas conocidos***\n\n*Para explicaciones detalladas del archivo de configuración, consulta la **sección Configuración**.*\n\n---\n\n## Iniciar servicios y ejecutar\n\nPor defecto, AgenticSeek se ejecuta completamente en Docker.\n\n**Opción 1:** Ejecutar en Docker con interfaz web:\n\nInicia los servicios necesarios. Esto iniciará todos los servicios del docker-compose.yml, incluyendo:\n    - searxng\n    - redis (requerido para searxng)\n    - frontend\n    - backend (si usas `full` para la interfaz web)\n\n```sh\n./start_services.sh full # MacOS\nstart start_services.cmd full # Windows\n```\n\n**Advertencia:** Este paso descargará y cargará todas las imágenes de Docker, lo que puede tardar hasta 30 minutos. Después de iniciar los servicios, espera hasta que el servicio backend esté completamente ejecutándose (deberías ver **backend: \"GET /health HTTP/1.1\" 200 OK** en el registro) antes de enviar cualquier mensaje. En la primera ejecución, el servicio backend puede tardar 5 minutos en iniciarse.\n\nVe a `http://localhost:3000/` y deberías ver la interfaz web.\n\n*Solución de problemas de inicio de servicios:* Si estos scripts fallan, asegúrate de que Docker Engine esté ejecutándose y que Docker Compose (V2, `docker compose`) esté correctamente instalado. Revisa los mensajes de error en la salida de la terminal. Consulta [FAQ: ¡Ayuda! Obtengo errores al ejecutar AgenticSeek o sus scripts.](#faq-solución-de-problemas)\n\n**Opción 2:** Modo CLI:\n\nPara ejecutar con la interfaz CLI, debes instalar los paquetes en el host:\n\n```sh\n./install.sh\n./install.bat # windows\n```\n\nLuego debes cambiar SEARXNG_BASE_URL en `config.ini` a:\n\n```sh\nSEARXNG_BASE_URL=\"http://localhost:8080\"\n```\n\nInicia los servicios necesarios. Esto iniciará algunos servicios del docker-compose.yml, incluyendo:\n    - searxng\n    - redis (requerido para searxng)\n    - frontend\n\n```sh\n./start_services.sh # MacOS\nstart start_services.cmd # Windows\n```\n\nEjecuta: uv run: `uv run python -m ensurepip` para asegurarte de que uv tenga pip habilitado.\n\nUsa CLI: `uv run cli.py`\n\n---\n\n## Uso\n\nAsegúrate de que los servicios estén ejecutándose con `./start_services.sh full` y luego ve a `localhost:3000` para la interfaz web.\n\nTambién puedes usar voz a texto configurando `listen = True`. Solo para modo CLI.\n\nPara salir, simplemente di/escribe `goodbye`.\n\nAlgunos ejemplos de uso:\n\n> *¡Haz un juego de la serpiente en python!*\n\n> *Busca en la web los mejores cafés en Rennes, Francia, y guarda una lista de tres con sus direcciones en rennes_cafes.txt.*\n\n> *Escribe un programa Go para calcular el factorial de un número, guárdalo como factorial.go en tu workspace*\n\n> *Busca en la carpeta summer_pictures todos los archivos JPG, renómbralos con la fecha de hoy y guarda la lista de archivos renombrados en photos_list.txt*\n\n> *Busca en línea películas de ciencia ficción populares de 2024 y elige tres para ver esta noche. Guarda la lista en movie_night.txt.*\n\n> *Busca en la web los últimos artículos de noticias de IA de 2025, selecciona tres y escribe un script Python para extraer títulos y resúmenes. Guarda el script como news_scraper.py y los resúmenes en ai_news.txt en /home/projects*\n\n> *Viernes, busca en la web una API gratuita de precios de acciones, regístrate con supersuper7434567@gmail.com y escribe un script Python para obtener los precios diarios de Tesla usando la API, guardando los resultados en stock_prices.csv*\n\n*Ten en cuenta que el llenado de formularios sigue siendo experimental y puede fallar.*\n\nDespués de ingresar tu consulta, AgenticSeek asignará el mejor agente para la tarea.\n\nComo este es un prototipo inicial, el sistema de enrutamiento de agentes puede no asignar siempre el agente correcto a tu consulta.\n\nPor lo tanto, sé muy explícito sobre lo que quieres y cómo la IA podría proceder, por ejemplo, si quieres que realice una búsqueda web, no digas:\n\n`¿Conoces algunos buenos países para viajar solo?`\n\nEn su lugar, di:\n\n`Realiza una búsqueda web y descubre cuáles son los mejores países para viajar solo`\n\n---\n\n## **Configuración para ejecutar LLM en tu propio servidor**\n\nSi tienes una computadora potente o un servidor al que puedes acceder, pero quieres usarlo desde tu laptop, puedes optar por ejecutar el LLM en un servidor remoto usando nuestro servidor llm personalizado.\n\nEn tu \"servidor\" que ejecutará el modelo de IA, obtén la dirección IP\n\n```sh\nip a | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # IP local\ncurl https://ipinfo.io/ip # IP pública\n```\n\nNota: Para Windows o macOS, usa ipconfig o ifconfig para encontrar la dirección IP.\n\nClona el repositorio y entra en la carpeta `server/`.\n\n```sh\ngit clone --depth 1 https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek/llm_server/\n```\n\nInstala los requisitos específicos del servidor:\n\n```sh\npip3 install -r requirements.txt\n```\n\nEjecuta el script del servidor.\n\n```sh\npython3 app.py --provider ollama --port 3333\n```\n\nPuedes elegir entre usar `ollama` y `llamacpp` como servicio LLM.\n\nAhora en tu computadora personal:\n\nCambia el archivo `config.ini` para establecer `provider_name` como `server` y `provider_model` como `deepseek-r1:xxb`.\nEstablece `provider_server_address` a la dirección IP de la máquina que ejecutará el modelo.\n\n```sh\n[MAIN]\nis_local = False\nprovider_name = server\nprovider_model = deepseek-r1:70b\nprovider_server_address = http://x.x.x.x:3333\n```\n\nSiguiente paso: [Iniciar servicios y ejecutar AgenticSeek](#iniciar-servicios-y-ejecutar)  \n\n---\n\n## Voz a Texto\n\nAdvertencia: La voz a texto solo funciona en modo CLI en este momento.\n\nTen en cuenta que la voz a texto solo funciona en inglés en este momento.\n\nLa funcionalidad de voz a texto está deshabilitada por defecto. Para habilitarla, establece listen en True en el archivo config.ini:\n\n```\nlisten = True\n```\n\nCuando está habilitado, la función de voz a texto escucha una palabra clave de activación, que es el nombre del agente, antes de procesar tu entrada. Puedes personalizar el nombre del agente actualizando el valor `agent_name` en *config.ini*:\n\n```\nagent_name = Friday\n```\n\nPara un mejor reconocimiento, recomendamos usar un nombre común en inglés como \"John\" o \"Emma\" como nombre de agente.\n\nUna vez que veas que comienza a aparecer la transcripción, di el nombre del agente en voz alta para activarlo (ej: \"Friday\").\n\nDi tu consulta claramente.\n\nTermina tu solicitud con una frase de confirmación para indicar al sistema que proceda. Ejemplos de frases de confirmación incluyen:\n```\n\"do it\", \"go ahead\", \"execute\", \"run\", \"start\", \"thanks\", \"would ya\", \"please\", \"okay?\", \"proceed\", \"continue\", \"go on\", \"do that\", \"go it\", \"do you understand?\"\n```\n\n## Configuración\n\nEjemplo de configuración:\n```\n[MAIN]\nis_local = True\nprovider_name = ollama\nprovider_model = deepseek-r1:32b\nprovider_server_address = http://127.0.0.1:11434 # Ejemplo de Ollama; LM-Studio usa http://127.0.0.1:1234\nagent_name = Friday\nrecover_last_session = False\nsave_session = False\nspeak = False\nlisten = False\n\njarvis_personality = False\nlanguages = en zh # Lista de idiomas para TTS y enrutamiento potencial.\n[BROWSER]\nheadless_browser = False\nstealth_mode = False\n```\n\n**Explicación de la configuración de `config.ini`**:\n\n*   **Sección `[MAIN]`:**\n    *   `is_local`: `True` si usas proveedores de LLM locales (Ollama, LM-Studio, servidor local compatible con OpenAI) o la opción de servidor autoalojado. `False` si usas API basadas en la nube (OpenAI, Google, etc.).\n    *   `provider_name`: Especifica el proveedor de LLM.\n        *   Opciones locales: `ollama`, `lm-studio`, `openai` (para servidor local compatible con OpenAI), `server` (para configuración de servidor autoalojado).\n        *   Opciones de API: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.\n    *   `provider_model`: Nombre o ID específico del modelo del proveedor seleccionado (ej: `deepseekcoder:6.7b` para Ollama, `gpt-3.5-turbo` para API de OpenAI, `mistralai/Mixtral-8x7B-Instruct-v0.1` para TogetherAI).\n    *   `provider_server_address`: La dirección de tu proveedor de LLM.\n        *   Para proveedores locales: ej: `http://127.0.0.1:11434` para Ollama, `http://127.0.0.1:1234` para LM-Studio.\n        *   Para el tipo de proveedor `server`: La dirección de tu servidor LLM autoalojado (ej: `http://your_server_ip:3333`).\n        *   Para API en la nube (`is_local = False`): Esto generalmente se ignora o puede dejarse en blanco, ya que los endpoints de API suelen ser manejados por las bibliotecas del cliente.\n    *   `agent_name`: El nombre del asistente de IA (ej: Friday). Si está habilitado, se utiliza como palabra de activación para voz a texto.\n    *   `recover_last_session`: `True` para intentar recuperar el estado de la sesión anterior, `False` para comenzar de nuevo.\n    *   `save_session`: `True` para guardar el estado de la sesión actual para una posible recuperación, `False` en caso contrario.\n    *   `speak`: `True` para habilitar la salida de voz de texto a voz, `False` para deshabilitar.\n    *   `listen`: `True` para habilitar la entrada de voz de voz a texto (solo modo CLI), `False` para deshabilitar.\n    *   `work_dir`: **Crítico:** El directorio donde AgenticSeek leerá/escribirá archivos. **Asegúrate de que esta ruta sea válida y accesible en tu sistema.**\n    *   `jarvis_personality`: `True` para usar prompts del sistema más al estilo \"Jarvis\" (experimental), `False` para usar prompts estándar.\n    *   `languages`: Lista de idiomas separados por comas (ej: `en, zh, fr`). Se utiliza para la selección de voz TTS (predeterminado el primero) y puede ayudar al enrutador LLM. Para evitar ineficiencias del enrutador, evita usar demasiados idiomas o idiomas muy similares.\n*   **Sección `[BROWSER]`:**\n    *   `headless_browser`: `True` para ejecutar el navegador automatizado sin una ventana visible (recomendado para interfaz web o uso no interactivo). `False` para mostrar la ventana del navegador (útil para modo CLI o depuración).\n    *   `stealth_mode`: `True` para habilitar medidas que dificultan la detección de la automatización del navegador. Puede requerir la instalación manual de extensiones del navegador como anticaptcha.\n\nEsta sección resume los tipos de proveedores de LLM admitidos. Configúralos en `config.ini`.\n\n**Proveedores locales (ejecutándose en tu propio hardware):**\n\n| Nombre del proveedor en config.ini | `is_local` | Descripción                                                                 | Sección de configuración                                                    |\n|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|\n| `ollama`                      | `True`     | Proporciona LLM localmente fácilmente usando Ollama.                                             | [Configuración para ejecutar LLM localmente en tu máquina](#configuración-para-ejecutar-llm-localmente-en-tu-máquina) |\n| `lm-studio`                   | `True`     | Proporciona LLM localmente con LM-Studio.                                          | [Configuración para ejecutar LLM localmente en tu máquina](#configuración-para-ejecutar-llm-localmente-en-tu-máquina) |\n| `openai` (para servidor local)   | `True`     | Conéctate a un servidor local que exponga una API compatible con OpenAI (ej: llama.cpp). | [Configuración para ejecutar LLM localmente en tu máquina](#configuración-para-ejecutar-llm-localmente-en-tu-máquina) |\n| `server`                      | `False`    | Conéctate al servidor LLM autoalojado de AgenticSeek que se ejecuta en otra máquina. | [Configuración para ejecutar LLM en tu propio servidor](#configuración-para-ejecutar-llm-en-tu-propio-servidor) |\n\n**Proveedores de API (basados en la nube):**\n\n| Nombre del proveedor en config.ini | `is_local` | Descripción                                      | Sección de configuración                                       |\n|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|\n| `openai`                      | `False`    | Usa la API oficial de OpenAI (ej: GPT-3.5, GPT-4). | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |\n| `google`                      | `False`    | Usa modelos Google Gemini a través de API.              | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |\n| `deepseek`                    | `False`    | Usa la API oficial de Deepseek.                     | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |\n| `huggingface`                 | `False`    | Usa Hugging Face Inference API.                  | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |\n| `togetherAI`                  | `False`    | Usa varios modelos abiertos a través de la API de TogetherAI.    | [Configuración para ejecutar con una API](#configuración-para-ejecutar-con-una-api) |\n\n---\n## Solución de problemas\n\nSi encuentras problemas, esta sección proporciona orientación.\n\n# Problemas conocidos\n\n## Problemas de ChromeDriver\n\n**Ejemplo de error:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`\n\n### Causa principal\nLa incompatibilidad de versión de ChromeDriver ocurre cuando:\n1. La versión de ChromeDriver que instalaste no coincide con la versión del navegador Chrome\n2. En entornos Docker, `undetected_chromedriver` puede descargar su propia versión de ChromeDriver, evitando los binarios montados\n\n### Pasos de solución\n\n#### 1. Verifica tu versión de Chrome\nAbre Google Chrome → `Configuración > Acerca de Chrome` para encontrar tu versión (ej: \"Versión 134.0.6998.88\")\n\n#### 2. Descarga ChromeDriver coincidente\n\n**Para Chrome 115 y versiones más recientes:** Usa [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)\n- Visita el panel de disponibilidad de Chrome for Testing\n- Encuentra tu versión de Chrome o la coincidencia disponible más cercana\n- Descarga ChromeDriver para tu sistema operativo (usa Linux64 para entornos Docker)\n\n**Para versiones antiguas de Chrome:** Usa [Descargas heredadas de ChromeDriver](https://chromedriver.chromium.org/downloads)\n\n![Descargar ChromeDriver desde Chrome for Testing](./media/chromedriver_readme.png)\n\n#### 3. Instala ChromeDriver (elige un método)\n\n**Método A: Directorio raíz del proyecto (recomendado para Docker)**\n```bash\n# Coloca el binario de chromedriver descargado en el directorio raíz del proyecto\ncp path/to/downloaded/chromedriver ./chromedriver\nchmod +x ./chromedriver  # Hazlo ejecutable en Linux/macOS\n```\n\n**Método B: PATH del sistema**\n```bash\n# Linux/macOS\nsudo mv chromedriver /usr/local/bin/\nsudo chmod +x /usr/local/bin/chromedriver\n\n# Windows: Coloca chromedriver.exe en una carpeta en PATH\n```\n\n#### 4. Verifica la instalación\n```bash\n# Prueba la versión de ChromeDriver\n./chromedriver --version\n# O si está en PATH:\nchromedriver --version\n```\n\n### Instrucciones específicas de Docker\n\n⚠️ **Importante para usuarios de Docker:**\n- El método de montaje de volúmenes de Docker puede no funcionar con el modo sigiloso (`undetected_chromedriver`)\n- **Solución:** Coloca ChromeDriver en el directorio raíz del proyecto como `./chromedriver`\n- La aplicación lo detectará automáticamente y usará este binario\n- Deberías ver en los registros: `\"Using ChromeDriver from project root: ./chromedriver\"`\n\n### Consejos para solución de problemas\n\n1. **¿Sigues teniendo incompatibilidad de versión?**\n   - Verifica que ChromeDriver sea ejecutable: `ls -la ./chromedriver`\n   - Comprueba la versión de ChromeDriver: `./chromedriver --version`\n   - Asegúrate de que coincida con tu versión del navegador Chrome\n\n2. **¿Problemas con el contenedor Docker?**\n   - Revisa los registros del backend: `docker logs backend`\n   - Busca el mensaje: `\"Using ChromeDriver from project root\"`\n   - Si no se encuentra, verifica que el archivo exista y sea ejecutable\n\n3. **Versiones de Chrome for Testing**\n   - Usa una coincidencia exacta cuando sea posible\n   - Para la versión 134.0.6998.88, usa ChromeDriver 134.0.6998.165 (la versión disponible más cercana)\n   - El número de versión principal debe coincidir (134 = 134)\n\n### Matriz de compatibilidad de versiones\n\n| Versión de Chrome | Versión de ChromeDriver | Estado |\n|----------------|---------------------|---------|\n| 134.0.6998.x   | 134.0.6998.165     | ✅ Disponible |\n| 133.0.6943.x   | 133.0.6943.141     | ✅ Disponible |\n| 132.0.6834.x   | 132.0.6834.159     | ✅ Disponible |\n\n*Para la compatibilidad más reciente, consulta el [Panel de Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/)*\n\n`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113\nCurrent browser version is 134.0.6998.89 with binary path`\n\nEsto sucede si tu navegador y la versión de chromedriver no coinciden.\n\nNecesitas navegar para descargar la versión más reciente:\n\nhttps://developer.chrome.com/docs/chromedriver/downloads\n\nSi usas Chrome versión 115 o superior, ve a:\n\nhttps://googlechromelabs.github.io/chrome-for-testing/\n\ny descarga la versión de chromedriver que coincida con tu sistema operativo.\n\n![alt text](./media/chromedriver_readme.png)\n\nSi esta sección está incompleta, abre un issue.\n\n##  Problemas de adaptadores de conexión\n\n```\nException: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (nota: el puerto puede variar)\n```\n\n*   **Causa:** Falta el prefijo `http://` en `provider_server_address` para `lm-studio` (u otro servidor local compatible con OpenAI similar) en `config.ini`, o apunta al puerto incorrecto.\n*   **Solución:**\n    *   Asegúrate de que la dirección incluya `http://`. LM-Studio normalmente usa `http://127.0.0.1:1234` por defecto.\n    *   `config.ini` correcto: `provider_server_address = http://127.0.0.1:1234` (o tu puerto real del servidor LM-Studio).\n\n## URL base de SearxNG no proporcionada\n\n```\nraise ValueError(\"SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.\")\nValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`\n```\n\nEsto puede ocurrir si ejecutas el modo CLI con la URL base de searxng incorrecta.\n\nSEARXNG_BASE_URL debe diferir según si ejecutas en Docker o en el host:\n\n**Ejecutando en el host:** `SEARXNG_BASE_URL=\"http://localhost:8080\"`\n\n**Ejecutando completamente en Docker (interfaz web):** `SEARXNG_BASE_URL=\"http://searxng:8080\"`\n\n## FAQ\n\n**P: ¿Qué hardware necesito?**  \n\n| Tamaño del modelo  | GPU  | Comentarios                                               |\n|-----------|--------|-----------------------------------------------------------|\n| 7B        | 8GB VRAM | ⚠️ No recomendado. Rendimiento pobre, alucinaciones frecuentes, los agentes de planificación pueden fallar. |\n| 14B        | 12 GB VRAM (ej: RTX 3060) | ✅ Utilizable para tareas simples. Puede tener dificultades con la navegación web y la planificación de tareas. |\n| 32B        | 24+ GB VRAM (ej: RTX 4090) | 🚀 Éxito en la mayoría de las tareas, aún puede tener dificultades con la planificación de tareas |\n| 70B+        | 48+ GB VRAM | 💪 Excelente. Recomendado para casos de uso avanzados. |\n\n**P: ¿Qué hago si encuentro errores?**  \n\nAsegúrate de que lo local esté ejecutándose (`ollama serve`), que tu `config.ini` coincida con tu proveedor y que las dependencias estén instaladas. Si nada funciona, no dudes en abrir un issue.\n\n**P: ¿Realmente puede ejecutarse 100% localmente?**  \n\nSí, con proveedores Ollama, lm-studio o server, todos los modelos de voz a texto, LLM y texto a voz se ejecutan localmente. Las opciones no locales (OpenAI u otras API) son opcionales.\n\n**P: ¿Por qué debería usar AgenticSeek cuando tengo Manus?**\n\nA diferencia de Manus, AgenticSeek prioriza la independencia de los sistemas externos, dándote más control, privacidad y evitando costos de API.\n\n**P: ¿Quién está detrás de este proyecto?**\n\nEste proyecto fue creado por mí, con dos amigos como mantenedores y contribuyentes de la comunidad de código abierto en GitHub. Solo somos individuos apasionados, no una startup, ni estamos afiliados a ninguna organización.\n\nCualquier cuenta de AgenticSeek en X además de mi cuenta personal (https://x.com/Martin993886460) es impostora.\n\n## Contribuir\n\n¡Buscamos desarrolladores para mejorar AgenticSeek! Revisa los issues abiertos o discusiones.\n\n[Guía de contribución](./docs/CONTRIBUTING.md)\n\n## Patrocinadores:\n\n¿Quieres mejorar las capacidades de AgenticSeek con funciones como búsqueda de vuelos, planificación de viajes o obtención de las mejores ofertas de compras? Considera usar SerpApi para crear herramientas personalizadas que desbloqueen más funcionalidades al estilo Jarvis. Con SerpApi, puedes acelerar tu agente para tareas profesionales mientras mantienes el control total.\n\n<a href=\"https://serpapi.com/\"><img src=\"./media/banners/sponsor_banner_serpapi.png\" height=\"350\" alt=\"SerpApi Banner\" ></a>\n\n¡Consulta [Contributing.md](./docs/CONTRIBUTING.md) para aprender cómo integrar herramientas personalizadas!\n\n### **Patrocinadores**:\n\n- [tatra-labs](https://github.com/tatra-labs)\n\n## Mantenedores:\n\n > [Fosowl](https://github.com/Fosowl) | Hora de París \n\n > [antoineVIVIES](https://github.com/antoineVIVIES) | Hora de Taipei \n\n## Agradecimientos especiales:\n\n > [tcsenpai](https://github.com/tcsenpai) y [plitc](https://github.com/plitc) por ayudar con la dockerización del backend\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)\n"
  },
  {
    "path": "README_FR.md",
    "content": "# AgenticSeek : Une Alternative Privée et Locale à Manus\n\n<p align=\"center\">\n<img align=\"center\" src=\"./media/agentic_seek_logo.png\" width=\"300\" height=\"300\" alt=\"Agentic Seek Logo\">\n<p>\n\n  English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)\n\n*Un assistant IA avec reconnaissance vocale qui est une **alternative 100% locale à Manus AI**, navigue de manière autonome sur le web, écrit du code et planifie des tâches tout en gardant toutes les données sur votre appareil. Conçu pour des modèles de raisonnement locaux, il fonctionne entièrement sur votre matériel, garantissant une confidentialité totale et zéro dépendance au cloud.*\n\n[![Visiter AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)\n\n### Pourquoi choisir AgenticSeek ?\n\n* 🔒 Totalement Local & Privé - Tout fonctionne sur votre machine, sans cloud, sans partage de données. Vos fichiers, conversations et recherches restent privés.\n\n* 🌐 Navigation Web Intelligente - AgenticSeek peut naviguer sur Internet de manière autonome : rechercher, lire, extraire des informations, remplir des formulaires web, le tout sans intervention manuelle.\n\n* 💻 Assistant de Programmation Autonome - Besoin de code ? Il peut écrire, déboguer et exécuter des programmes en Python, C, Go, Java et plus encore, sans supervision.\n\n* 🧠 Sélection Intelligente d'Agents - Vous demandez, il choisit automatiquement le meilleur agent pour la tâche. Comme avoir une équipe d'experts toujours disponible.\n\n* 📋 Planifie et Exécute des Tâches Complexes - De la planification de voyage aux projets complexes, il peut décomposer de grandes tâches en étapes et les compléter en utilisant plusieurs agents IA.\n\n* 🎙️ Prise en Charge Vocale - Voix claire, rapide et futuriste avec reconnaissance vocale, vous permettant de converser comme avec votre IA personnelle de film de science-fiction. (En développement)\n\n### **Démo**\n\n> *Peux-tu rechercher le projet agenticSeek, apprendre quelles compétences sont nécessaires, puis ouvrir CV_candidates.zip et me dire lesquels correspondent le mieux au projet ?*\n\nhttps://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316\n\nAvertissement : Cette démonstration et tous les fichiers qui apparaissent (ex: CV_candidates.zip) sont entièrement fictifs. Nous ne sommes pas une entreprise, nous recherchons des contributeurs open source, pas des candidats.\n\n> 🛠⚠️️ **Travail Actif en Cours**\n\n> 🙏 Ce projet a commencé comme un projet parallèle et n'a ni feuille de route ni financement. Il a grandi bien au-delà des attentes en apparaissant dans GitHub Trending. Les contributions, commentaires et de la patience sont profondément appréciés.\n\n## Prérequis\n\nAvant de commencer, assurez-vous d'avoir installé :\n\n*   **Git:** Pour cloner le dépôt. [Télécharger Git](https://git-scm.com/downloads)\n*   **Python 3.10.x:** Python 3.10.x est fortement recommandé. D'autres versions peuvent causer des erreurs de dépendance. [Télécharger Python 3.10](https://www.python.org/downloads/release/python-3100/) (sélectionnez la version 3.10.x).\n*   **Docker Engine & Docker Compose:** Pour exécuter des services empaquetés comme SearxNG.\n    *   Installer Docker Desktop (inclut Docker Compose V2): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)\n    *   Ou installer Docker Engine et Docker Compose séparément sur Linux: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (assurez-vous d'installer Compose V2, par exemple `sudo apt-get install docker-compose-plugin`).\n\n### 1. **Cloner le dépôt et configurer**\n\n```sh\ngit clone https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek\nmv .env.example .env\n```\n\n### 2. Modifier le contenu du fichier .env\n\n```sh\nSEARXNG_BASE_URL=\"http://searxng:8080\" # Si vous exécutez en mode CLI sur l'hôte, utilisez http://127.0.0.1:8080\nREDIS_BASE_URL=\"redis://redis:6379/0\"\nWORK_DIR=\"/Users/mlg/Documents/workspace_for_ai\"\nOLLAMA_PORT=\"11434\"\nLM_STUDIO_PORT=\"1234\"\nCUSTOM_ADDITIONAL_LLM_PORT=\"11435\"\nOPENAI_API_KEY='optional'\nDEEPSEEK_API_KEY='optional'\nOPENROUTER_API_KEY='optional'\nTOGETHER_API_KEY='optional'\nGOOGLE_API_KEY='optional'\nANTHROPIC_API_KEY='optional'\n```\n\nMettez à jour le fichier `.env` selon vos besoins :\n\n- **SEARXNG_BASE_URL**: Gardez inchangé sauf si vous exécutez en mode CLI sur l'hôte.\n- **REDIS_BASE_URL**: Gardez inchangé \n- **WORK_DIR**: Chemin vers le répertoire de travail local. AgenticSeek pourra lire et interagir avec ces fichiers.\n- **OLLAMA_PORT**: Numéro de port pour le service Ollama.\n- **LM_STUDIO_PORT**: Numéro de port pour le service LM Studio.\n- **CUSTOM_ADDITIONAL_LLM_PORT**: Port pour tout service LLM personnalisé supplémentaire.\n\n**Les clés API sont complètement optionnelles pour ceux qui choisissent d'exécuter LLM localement, ce qui est l'objectif principal de ce projet. Laissez-les vides si vous avez du matériel suffisant.**\n\n### 3. **Démarrer Docker**\n\nAssurez-vous que Docker est installé et fonctionne sur votre système. Vous pouvez démarrer Docker avec les commandes suivantes :\n\n- **Linux/macOS:**  \n    Ouvrez un terminal et exécutez :\n    ```sh\n    sudo systemctl start docker\n    ```\n    Ou démarrez Docker Desktop depuis le menu des applications, s'il est installé.\n\n- **Windows:**  \n    Démarrez Docker Desktop depuis le menu Démarrer.\n\nVous pouvez vérifier si Docker fonctionne en exécutant :\n```sh\ndocker info\n```\nSi vous voyez des informations sur votre installation Docker, cela fonctionne correctement.\n\nConsultez la [Liste des fournisseurs locaux](#liste-des-fournisseurs-locaux) ci-dessous pour un résumé.\n\nProchaine étape: [Exécuter AgenticSeek localement](#démarrer-les-services-et-exécuter)\n\n*Si vous rencontrez des problèmes, consultez la section [Dépannage](#dépannage).*\n*Si votre matériel ne peut pas exécuter LLM localement, consultez [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api).*\n*Pour des explications détaillées de `config.ini`, consultez la [section Configuration](#configuration).*\n\n---\n\n## Configuration pour exécuter LLM localement sur votre machine\n\n**Exigences matérielles:**\n\nPour exécuter LLM localement, vous aurez besoin de matériel suffisant. Au minimum, une GPU capable d'exécuter Magistral, Qwen ou Deepseek 14B est requise. Consultez la FAQ pour des recommandations détaillées de modèle/performance.\n\n**Configurez votre fournisseur local**  \n\nDémarrez votre fournisseur local, par exemple avec ollama:\n\n```sh\nollama serve\n```\n\nConsultez la liste des fournisseurs locaux pris en charge ci-dessous.\n\n**Mettre à jour config.ini**\n\nChangez le fichier config.ini pour définir provider_name sur un fournisseur pris en charge et provider_model sur un LLM pris en charge par votre fournisseur. Nous recommandons des modèles de raisonnement comme *Magistral* ou *Deepseek*.\n\nConsultez la **FAQ** à la fin du README pour le matériel nécessaire.\n\n```sh\n[MAIN]\nis_local = True # Que vous exécutiez localement ou avec un fournisseur distant.\nprovider_name = ollama # ou lm-studio, openai, etc.\nprovider_model = deepseek-r1:14b # choisissez un modèle compatible avec votre matériel\nprovider_server_address = 127.0.0.1:11434\nagent_name = Jarvis # le nom de votre IA\nrecover_last_session = True # récupérer la session précédente\nsave_session = True # mémoriser la session actuelle\nspeak = False # texte vers parole\nlisten = False # parole vers texte, uniquement pour CLI, expérimental\njarvis_personality = False # utiliser une personnalité plus \"Jarvis\" (expérimental)\nlanguages = en zh # Liste des langues, TTS utilisera la première de la liste par défaut\n[BROWSER]\nheadless_browser = True # garder inchangé sauf si vous utilisez CLI sur l'hôte.\nstealth_mode = True # Utilise selenium indétectable pour réduire la détection du navigateur\n```\n\n**Avertissement**:\n\n- Le format du fichier `config.ini` ne prend pas en charge les commentaires.\nNe copiez et collez pas directement la configuration d'exemple, car les commentaires causeront des erreurs. Modifiez plutôt manuellement le fichier `config.ini` avec votre configuration souhaitée, sans commentaires.\n\n- *NE* définissez PAS provider_name sur `openai` si vous utilisez LM-studio pour exécuter LLM. Utilisez `lm-studio`.\n\n- Certains fournisseurs (ex: lm-studio) nécessitent `http://` avant l'IP. Exemple: `http://127.0.0.1:1234`\n\n**Liste des fournisseurs locaux**\n\n| Fournisseur  | Local ? | Description                                               |\n|-----------|--------|-----------------------------------------------------------|\n| ollama    | Oui    | Exécute LLM localement facilement en utilisant ollama |\n| lm-studio  | Oui    | Exécute LLM localement avec LM studio (définir `provider_name` = `lm-studio`)|\n| openai    | Oui     |  Utilise une API compatible avec openai (ex: serveur llama.cpp)  |\n\nProchaine étape: [Démarrer les services et exécuter AgenticSeek](#démarrer-les-services-et-exécuter)  \n\n*Si vous rencontrez des problèmes, consultez la section [Dépannage](#dépannage).*\n*Si votre matériel ne peut pas exécuter LLM localement, consultez [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api).*\n*Pour des explications détaillées de `config.ini`, consultez la [section Configuration](#configuration).*\n\n## Configuration pour exécuter avec une API\n\nCette configuration utilise des fournisseurs de LLM externes basés sur le cloud. Vous devrez obtenir des clés API du service choisi.\n\n**1. Choisissez un fournisseur d'API et obtenez une clé API:**\n\nConsultez la [Liste des fournisseurs d'API](#liste-des-fournisseurs-dapi) ci-dessous. Visitez leurs sites web pour vous inscrire et obtenir des clés API.\n\n**2. Définissez votre clé API comme variable d'environnement:**\n\n*   **Linux/macOS:**\n    Ouvrez un terminal et utilisez la commande `export`. Il est préférable de l'ajouter au fichier de configuration de votre shell (ex: `~/.bashrc`, `~/.zshrc`) pour qu'elle soit persistante.\n    ```sh\n    export PROVIDER_API_KEY=\"your_api_key_here\" \n    # Remplacez PROVIDER_API_KEY par le nom de variable spécifique, ex: OPENAI_API_KEY, GOOGLE_API_KEY\n    ```\n    Exemple TogetherAI:\n    ```sh\n    export TOGETHER_API_KEY=\"xxxxxxxxxxxxxxxxxxxxxx\"\n    ```\n*   **Windows:**\n    *   **Invite de commandes (temporaire pour la session actuelle):**\n        ```cmd\n        set PROVIDER_API_KEY=your_api_key_here\n        ```\n    *   **PowerShell (temporaire pour la session actuelle):**\n        ```powershell\n        $env:PROVIDER_API_KEY=\"your_api_key_here\"\n        ```\n    *   **Permanent:** Recherchez \"variables d'environnement\" dans la barre de recherche Windows, cliquez sur \"Modifier les variables d'environnement système\", puis sur le bouton \"Variables d'environnement...\". Ajoutez une nouvelle variable utilisateur avec le nom approprié (ex: `OPENAI_API_KEY`) et votre clé comme valeur.\n\n    *(Pour plus de détails, consultez la FAQ: [Comment configurer une clé API ?](#comment-configurer-une-clé-api)).*\n\n\n**3. Mettez à jour `config.ini`:**\n```ini\n[MAIN]\nis_local = False\nprovider_name = openai # ou google, deepseek, togetherAI, huggingface\nprovider_model = gpt-3.5-turbo # ou gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1, etc.\nprovider_server_address = # Lorsque is_local = False, généralement ignoré ou peut être laissé vide pour la plupart des API\n# ... autres configurations ...\n```\n*Avertissement:* Assurez-vous qu'il n'y a pas d'espaces à la fin des valeurs dans config.\n\n**Liste des fournisseurs d'API**\n\n| Fournisseur     | `provider_name` | Local ? | Description                                       | Lien de clé API (exemple)                     |\n|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|\n| OpenAI       | `openai`        | Non     | Utilise les modèles ChatGPT via l'API OpenAI.              | [platform.openai.com/signup](https://platform.openai.com/signup) |\n| Google Gemini| `google`        | Non     | Utilise les modèles Google Gemini via Google AI Studio.    | [aistudio.google.com/keys](https://aistudio.google.com/keys) |\n| Deepseek     | `deepseek`      | Non     | Utilise les modèles Deepseek via leur API.                | [platform.deepseek.com](https://platform.deepseek.com) |\n| Hugging Face | `huggingface`   | Non     | Utilise les modèles du Hugging Face Inference API.       | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |\n| TogetherAI   | `togetherAI`    | Non     | Utilise divers modèles open source via l'API TogetherAI.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |\n\n*Note:*\n*   Nous ne recommandons pas d'utiliser `gpt-4o` ou d'autres modèles OpenAI pour la navigation web complexe et la planification de tâches, car l'optimisation actuelle des prompts cible des modèles comme Deepseek.\n*   Les tâches de codage/bash peuvent échouer avec Gemini, car il a tendance à ignorer notre format de prompt optimisé pour Deepseek r1.\n*   Lorsque `is_local = False`, `provider_server_address` dans `config.ini` n'est généralement pas utilisé, car les endpoints d'API sont généralement gérés par les bibliothèques du fournisseur correspondant.\n\nProchaine étape: [Démarrer les services et exécuter AgenticSeek](#démarrer-les-services-et-exécuter)\n\n*Si vous rencontrez des problèmes, consultez la section **Problèmes connus***\n\n*Pour des explications détaillées du fichier de configuration, consultez la **section Configuration**.*\n\n---\n\n## Démarrer les services et exécuter\n\nPar défaut, AgenticSeek s'exécute entièrement dans Docker.\n\n**Option 1:** Exécuter dans Docker avec interface web:\n\nDémarrez les services nécessaires. Cela démarrera tous les services du docker-compose.yml, y compris:\n    - searxng\n    - redis (requis pour searxng)\n    - frontend\n    - backend (si vous utilisez `full` pour l'interface web)\n\n```sh\n./start_services.sh full # MacOS\nstart start_services.cmd full # Windows\n```\n\n**Avertissement:** Cette étape téléchargera et chargera toutes les images Docker, ce qui peut prendre jusqu'à 30 minutes. Après avoir démarré les services, attendez que le service backend soit complètement opérationnel (vous devriez voir **backend: \"GET /health HTTP/1.1\" 200 OK** dans les logs) avant d'envoyer des messages. Lors du premier démarrage, le service backend peut prendre 5 minutes pour démarrer.\n\nAllez à `http://localhost:3000/` et vous devriez voir l'interface web.\n\n*Dépannage du démarrage des services:* Si ces scripts échouent, assurez-vous que Docker Engine fonctionne et que Docker Compose (V2, `docker compose`) est correctement installé. Vérifiez les messages d'erreur dans la sortie du terminal. Consultez [FAQ: Aide ! J'obtiens des erreurs lors de l'exécution d'AgenticSeek ou de ses scripts.](#faq-dépannage)\n\n**Option 2:** Mode CLI:\n\nPour exécuter avec l'interface CLI, vous devez installer les packages sur l'hôte:\n\n```sh\n./install.sh\n./install.bat # windows\n```\n\nEnsuite, vous devez changer SEARXNG_BASE_URL dans `config.ini` en:\n\n```sh\nSEARXNG_BASE_URL=\"http://localhost:8080\"\n```\n\nDémarrez les services nécessaires. Cela démarrera certains services du docker-compose.yml, y compris:\n    - searxng\n    - redis (requis pour searxng)\n    - frontend\n\n```sh\n./start_services.sh # MacOS\nstart start_services.cmd # Windows\n```\n\nExécutez: uv run: `uv run python -m ensurepip` pour vous assurer que uv a pip activé.\n\nUtilisez CLI: `uv run cli.py`\n\n---\n\n## Utilisation\n\nAssurez-vous que les services fonctionnent avec `./start_services.sh full` puis allez à `localhost:3000` pour l'interface web.\n\nVous pouvez également utiliser la parole vers texte en définissant `listen = True`. Uniquement pour le mode CLI.\n\nPour quitter, dites/tapez simplement `goodbye`.\n\nQuelques exemples d'utilisation:\n\n> *Fais un jeu de serpent en python !*\n\n> *Recherche sur le web les meilleurs cafés à Rennes, France, et sauvegarde une liste de trois avec leurs adresses dans rennes_cafes.txt.*\n\n> *Écris un programme Go pour calculer la factorielle d'un nombre, sauvegarde-le comme factorial.go dans ton workspace*\n\n> *Recherche dans le dossier summer_pictures tous les fichiers JPG, renomme-les avec la date d'aujourd'hui et sauvegarde la liste des fichiers renommés dans photos_list.txt*\n\n> *Recherche en ligne les films de science-fiction populaires de 2024 et choisis-en trois à regarder ce soir. Sauvegarde la liste dans movie_night.txt.*\n\n> *Recherche sur le web les derniers articles d'actualité sur l'IA de 2025, sélectionne-en trois et écris un script Python pour extraire les titres et résumés. Sauvegarde le script comme news_scraper.py et les résumés dans ai_news.txt dans /home/projects*\n\n> *Vendredi, recherche sur le web une API gratuite de prix d'actions, inscris-toi avec supersuper7434567@gmail.com et écris un script Python pour obtenir les prix quotidiens de Tesla en utilisant l'API, en sauvegardant les résultats dans stock_prices.csv*\n\n*Notez que le remplissage de formulaires est toujours expérimental et peut échouer.*\n\nAprès avoir saisi votre requête, AgenticSeek attribuera le meilleur agent pour la tâche.\n\nComme il s'agit d'un prototype initial, le système de routage des agents peut ne pas toujours attribuer l'agent correct à votre requête.\n\nPar conséquent, soyez très explicite sur ce que vous voulez et comment l'IA pourrait procéder, par exemple si vous voulez qu'elle effectue une recherche web, ne dites pas:\n\n`Connais-tu de bons pays pour voyager seul ?`\n\nDites plutôt:\n\n`Effectue une recherche web et découvre quels sont les meilleurs pays pour voyager seul`\n\n---\n\n## **Configuration pour exécuter LLM sur votre propre serveur**\n\nSi vous avez un ordinateur puissant ou un serveur auquel vous pouvez accéder, mais que vous voulez l'utiliser depuis votre ordinateur portable, vous pouvez choisir d'exécuter le LLM sur un serveur distant en utilisant notre serveur llm personnalisé.\n\nSur votre \"serveur\" qui exécutera le modèle d'IA, obtenez l'adresse IP\n\n```sh\nip a | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # IP locale\ncurl https://ipinfo.io/ip # IP publique\n```\n\nNote: Pour Windows ou macOS, utilisez ipconfig ou ifconfig pour trouver l'adresse IP.\n\nClonez le dépôt et entrez dans le dossier `server/`.\n\n```sh\ngit clone --depth 1 https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek/llm_server/\n```\n\nInstallez les exigences spécifiques au serveur:\n\n```sh\npip3 install -r requirements.txt\n```\n\nExécutez le script du serveur.\n\n```sh\npython3 app.py --provider ollama --port 3333\n```\n\nVous pouvez choisir d'utiliser `ollama` et `llamacpp` comme service LLM.\n\nMaintenant sur votre ordinateur personnel:\n\nChangez le fichier `config.ini` pour définir `provider_name` sur `server` et `provider_model` sur `deepseek-r1:xxb`.\nDéfinissez `provider_server_address` sur l'adresse IP de la machine qui exécutera le modèle.\n\n```sh\n[MAIN]\nis_local = False\nprovider_name = server\nprovider_model = deepseek-r1:70b\nprovider_server_address = http://x.x.x.x:3333\n```\n\nProchaine étape: [Démarrer les services et exécuter AgenticSeek](#démarrer-les-services-et-exécuter)  \n\n---\n\n## Parole vers Texte\n\nAvertissement: La speech-to-text ne fonctionne qu'en mode CLI pour le moment.\n\nNotez que la parole vers texte ne fonctionne qu'en anglais pour le moment.\n\nLa fonctionnalité de parole vers texte est désactivée par défaut. Pour l'activer, définissez listen sur True dans le fichier config.ini:\n\n```\nlisten = True\n```\n\nLorsqu'elle est activée, la fonction de parole vers texte écoute un mot-clé de déclenchement, qui est le nom de l'agent, avant de traiter votre entrée. Vous pouvez personnaliser le nom de l'agent en mettant à jour la valeur `agent_name` dans *config.ini*:\n\n```\nagent_name = Friday\n```\n\nPour une meilleure reconnaissance, nous recommandons d'utiliser un nom commun en anglais comme \"John\" ou \"Emma\" comme nom d'agent.\n\nUne fois que vous voyez la transcription commencer à apparaître, dites le nom de l'agent à haute voix pour le réveiller (ex: \"Friday\").\n\nDites votre requête clairement.\n\nTerminez votre demande par une phrase de confirmation pour indiquer au système de continuer. Les exemples de phrases de confirmation incluent:\n```\n\"do it\", \"go ahead\", \"execute\", \"run\", \"start\", \"thanks\", \"would ya\", \"please\", \"okay?\", \"proceed\", \"continue\", \"go on\", \"do that\", \"go it\", \"do you understand?\"\n```\n\n## Configuration\n\nExemple de configuration:\n```\n[MAIN]\nis_local = True\nprovider_name = ollama\nprovider_model = deepseek-r1:32b\nprovider_server_address = http://127.0.0.1:11434 # Exemple Ollama; LM-Studio utilise http://127.0.0.1:1234\nagent_name = Friday\nrecover_last_session = False\nsave_session = False\nspeak = False\nlisten = False\n\njarvis_personality = False\nlanguages = en zh # Liste des langues pour TTS et routage potentiel.\n[BROWSER]\nheadless_browser = False\nstealth_mode = False\n```\n\n**Explication des paramètres de `config.ini`**:\n\n*   **Section `[MAIN]`:**\n    *   `is_local`: `True` si vous utilisez des fournisseurs de LLM locaux (Ollama, LM-Studio, serveur local compatible OpenAI) ou l'option de serveur auto-hébergé. `False` si vous utilisez des API basées sur le cloud (OpenAI, Google, etc.).\n    *   `provider_name`: Spécifie le fournisseur de LLM.\n        *   Options locales: `ollama`, `lm-studio`, `openai` (pour serveur local compatible OpenAI), `server` (pour configuration de serveur auto-hébergé).\n        *   Options d'API: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.\n    *   `provider_model`: Nom ou ID spécifique du modèle du fournisseur sélectionné (ex: `deepseekcoder:6.7b` pour Ollama, `gpt-3.5-turbo` pour API OpenAI, `mistralai/Mixtral-8x7B-Instruct-v0.1` pour TogetherAI).\n    *   `provider_server_address`: L'adresse de votre fournisseur de LLM.\n        *   Pour les fournisseurs locaux: ex: `http://127.0.0.1:11434` pour Ollama, `http://127.0.0.1:1234` pour LM-Studio.\n        *   Pour le type de fournisseur `server`: L'adresse de votre serveur LLM auto-hébergé (ex: `http://your_server_ip:3333`).\n        *   Pour les API cloud (`is_local = False`): Ceci est généralement ignoré ou peut être laissé vide, car les endpoints d'API sont généralement gérés par les bibliothèques clientes.\n    *   `agent_name`: Le nom de l'assistant IA (ex: Friday). Si activé, utilisé comme mot de déclenchement pour la parole vers texte.\n    *   `recover_last_session`: `True` pour tenter de récupérer l'état de la session précédente, `False` pour recommencer.\n    *   `save_session`: `True` pour sauvegarder l'état de la session actuelle pour une récupération potentielle, `False` sinon.\n    *   `speak`: `True` pour activer la sortie vocale de texte vers parole, `False` pour désactiver.\n    *   `listen`: `True` pour activer l'entrée vocale de parole vers texte (uniquement mode CLI), `False` pour désactiver.\n    *   `work_dir`: **Critique:** Le répertoire où AgenticSeek lira/écrira des fichiers. **Assurez-vous que ce chemin est valide et accessible sur votre système.**\n    *   `jarvis_personality`: `True` pour utiliser des invites système plus \"Jarvis-like\" (expérimental), `False` pour utiliser des invites standard.\n    *   `languages`: Liste de langues séparées par des virgules (ex: `en, zh, fr`). Utilisé pour la sélection de voix TTS (première par défaut) et peut aider le routeur LLM. Pour éviter les inefficacités du routeur, évitez d'utiliser trop de langues ou des langues très similaires.\n*   **Section `[BROWSER]`:**\n    *   `headless_browser`: `True` pour exécuter le navigateur automatisé sans fenêtre visible (recommandé pour l'interface web ou l'utilisation non interactive). `False` pour afficher la fenêtre du navigateur (utile pour le mode CLI ou le débogage).\n    *   `stealth_mode`: `True` pour activer des mesures qui rendent plus difficile la détection de l'automatisation du navigateur. Peut nécessiter l'installation manuelle d'extensions de navigateur comme anticaptcha.\n\nCette section résume les types de fournisseurs de LLM pris en charge. Configurez-les dans `config.ini`.\n\n**Fournisseurs locaux (fonctionnant sur votre propre matériel):**\n\n| Nom du fournisseur dans config.ini | `is_local` | Description                                                                 | Section de configuration                                                    |\n|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|\n| `ollama`                      | `True`     | Fournit LLM localement facilement en utilisant Ollama.                                             | [Configuration pour exécuter LLM localement sur votre machine](#configuration-pour-exécuter-llm-localement-sur-votre-machine) |\n| `lm-studio`                   | `True`     | Fournit LLM localement avec LM-Studio.                                          | [Configuration pour exécuter LLM localement sur votre machine](#configuration-pour-exécuter-llm-localement-sur-votre-machine) |\n| `openai` (pour serveur local)   | `True`     | Connectez-vous à un serveur local exposant une API compatible OpenAI (ex: llama.cpp). | [Configuration pour exécuter LLM localement sur votre machine](#configuration-pour-exécuter-llm-localement-sur-votre-machine) |\n| `server`                      | `False`    | Connectez-vous au serveur LLM auto-hébergé d'AgenticSeek fonctionnant sur une autre machine. | [Configuration pour exécuter LLM sur votre propre serveur](#configuration-pour-exécuter-llm-sur-votre-propre-serveur) |\n\n**Fournisseurs d'API (basés sur le cloud):**\n\n| Nom du fournisseur dans config.ini | `is_local` | Description                                      | Section de configuration                                       |\n|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|\n| `openai`                      | `False`    | Utilise l'API officielle d'OpenAI (ex: GPT-3.5, GPT-4). | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |\n| `google`                      | `False`    | Utilise les modèles Google Gemini via API.              | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |\n| `deepseek`                    | `False`    | Utilise l'API officielle de Deepseek.                     | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |\n| `huggingface`                 | `False`    | Utilise Hugging Face Inference API.                  | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |\n| `togetherAI`                  | `False`    | Utilise divers modèles ouverts via l'API TogetherAI.    | [Configuration pour exécuter avec une API](#configuration-pour-exécuter-avec-une-api) |\n\n---\n## Dépannage\n\nSi vous rencontrez des problèmes, cette section fournit des conseils.\n\n# Problèmes connus\n\n## Problèmes de ChromeDriver\n\n**Exemple d'erreur:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`\n\n### Cause racine\nL'incompatibilité de version de ChromeDriver se produit lorsque:\n1. La version de ChromeDriver que vous avez installée ne correspond pas à la version du navigateur Chrome\n2. Dans les environnements Docker, `undetected_chromedriver` peut télécharger sa propre version de ChromeDriver, contournant les binaires montés\n\n### Étapes de résolution\n\n#### 1. Vérifiez votre version de Chrome\nOuvrez Google Chrome → `Paramètres > À propos de Chrome` pour trouver votre version (ex: \"Version 134.0.6998.88\")\n\n#### 2. Téléchargez ChromeDriver correspondant\n\n**Pour Chrome 115 et versions ultérieures:** Utilisez [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)\n- Visitez le tableau de disponibilité de Chrome for Testing\n- Trouvez votre version de Chrome ou la correspondance disponible la plus proche\n- Téléchargez ChromeDriver pour votre système d'exploitation (utilisez Linux64 pour les environnements Docker)\n\n**Pour les anciennes versions de Chrome:** Utilisez [Téléchargements hérités de ChromeDriver](https://chromedriver.chromium.org/downloads)\n\n![Télécharger ChromeDriver depuis Chrome for Testing](./media/chromedriver_readme.png)\n\n#### 3. Installez ChromeDriver (choisissez une méthode)\n\n**Méthode A: Répertoire racine du projet (recommandé pour Docker)**\n```bash\n# Placez le binaire chromedriver téléchargé dans le répertoire racine du projet\ncp path/to/downloaded/chromedriver ./chromedriver\nchmod +x ./chromedriver  # Rendez-le exécutable sur Linux/macOS\n```\n\n**Méthode B: PATH système**\n```bash\n# Linux/macOS\nsudo mv chromedriver /usr/local/bin/\nsudo chmod +x /usr/local/bin/chromedriver\n\n# Windows: Placez chromedriver.exe dans un dossier du PATH\n```\n\n#### 4. Vérifiez l'installation\n```bash\n# Testez la version de ChromeDriver\n./chromedriver --version\n# Ou s'il est dans PATH:\nchromedriver --version\n```\n\n### Instructions spécifiques à Docker\n\n⚠️ **Important pour les utilisateurs de Docker:**\n- La méthode de montage de volumes Docker peut ne pas fonctionner avec le mode furtif (`undetected_chromedriver`)\n- **Solution:** Placez ChromeDriver dans le répertoire racine du projet en tant que `./chromedriver`\n- L'application le détectera automatiquement et utilisera ce binaire\n- Vous devriez voir dans les logs: `\"Using ChromeDriver from project root: ./chromedriver\"`\n\n### Conseils de dépannage\n\n1. **Toujours une incompatibilité de version ?**\n   - Vérifiez que ChromeDriver est exécutable: `ls -la ./chromedriver`\n   - Vérifiez la version de ChromeDriver: `./chromedriver --version`\n   - Assurez-vous qu'elle correspond à votre version du navigateur Chrome\n\n2. **Problèmes avec le conteneur Docker ?**\n   - Vérifiez les logs du backend: `docker logs backend`\n   - Recherchez le message: `\"Using ChromeDriver from project root\"`\n   - S'il n'est pas trouvé, vérifiez que le fichier existe et est exécutable\n\n3. **Versions de Chrome for Testing**\n   - Utilisez une correspondance exacte lorsque possible\n   - Pour la version 134.0.6998.88, utilisez ChromeDriver 134.0.6998.165 (la version disponible la plus proche)\n   - Le numéro de version principal doit correspondre (134 = 134)\n\n### Matrice de compatibilité des versions\n\n| Version de Chrome | Version de ChromeDriver | Statut |\n|----------------|---------------------|---------|\n| 134.0.6998.x   | 134.0.6998.165     | ✅ Disponible |\n| 133.0.6943.x   | 133.0.6943.141     | ✅ Disponible |\n| 132.0.6834.x   | 132.0.6834.159     | ✅ Disponible |\n\n*Pour la compatibilité la plus récente, consultez le [Tableau de Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/)*\n\n`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113\nCurrent browser version is 134.0.6998.89 with binary path`\n\nCela se produit si votre navigateur et la version de chromedriver ne correspondent pas.\n\nVous devez naviguer pour télécharger la dernière version:\n\nhttps://developer.chrome.com/docs/chromedriver/downloads\n\nSi vous utilisez Chrome version 115 ou supérieure, allez à:\n\nhttps://googlechromelabs.github.io/chrome-for-testing/\n\net téléchargez la version de chromedriver correspondant à votre système d'exploitation.\n\n![alt text](./media/chromedriver_readme.png)\n\nSi cette section est incomplète, ouvrez un issue.\n\n##  Problèmes d'adaptateurs de connexion\n\n```\nException: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (note: le port peut varier)\n```\n\n*   **Cause:** Il manque le préfixe `http://` dans `provider_server_address` pour `lm-studio` (ou un autre serveur local compatible OpenAI similaire) dans `config.ini`, ou il pointe vers le mauvais port.\n*   **Solution:**\n    *   Assurez-vous que l'adresse inclut `http://`. LM-Studio utilise généralement `http://127.0.0.1:1234` par défaut.\n    *   `config.ini` correct: `provider_server_address = http://127.0.0.1:1234` (ou votre port réel du serveur LM-Studio).\n\n## URL de base de SearxNG non fournie\n\n```\nraise ValueError(\"SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.\")\nValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`\n```\n\nCela peut se produire si vous exécutez le mode CLI avec une URL de base de searxng incorrecte.\n\nSEARXNG_BASE_URL doit différer selon que vous exécutez dans Docker ou sur l'hôte:\n\n**Exécution sur l'hôte:** `SEARXNG_BASE_URL=\"http://localhost:8080\"`\n\n**Exécution complètement dans Docker (interface web):** `SEARXNG_BASE_URL=\"http://searxng:8080\"`\n\n## FAQ\n\n**Q: De quel matériel ai-je besoin ?**  \n\n| Taille du modèle  | GPU  | Commentaires                                               |\n|-----------|--------|-----------------------------------------------------------|\n| 7B        | 8GB VRAM | ⚠️ Non recommandé. Performances médiocres, hallucinations fréquentes, les agents de planification peuvent échouer. |\n| 14B        | 12 GB VRAM (ex: RTX 3060) | ✅ Utilisable pour des tâches simples. Peut avoir des difficultés avec la navigation web et la planification de tâches. |\n| 32B        | 24+ GB VRAM (ex: RTX 4090) | 🚀 Réussit la plupart des tâches, peut encore avoir des difficultés avec la planification de tâches |\n| 70B+        | 48+ GB VRAM | 💪 Excellent. Recommandé pour les cas d'utilisation avancés. |\n\n**Q: Que faire si je rencontre des erreurs ?**  \n\nAssurez-vous que le local fonctionne (`ollama serve`), que votre `config.ini` correspond à votre fournisseur et que les dépendances sont installées. Si rien ne fonctionne, n'hésitez pas à ouvrir un issue.\n\n**Q: Peut-il vraiment fonctionner à 100% localement ?**  \n\nOui, avec les fournisseurs Ollama, lm-studio ou server, tous les modèles de parole vers texte, LLM et texte vers parole fonctionnent localement. Les options non locales (OpenAI ou autres API) sont optionnelles.\n\n**Q: Pourquoi devrais-je utiliser AgenticSeek quand j'ai Manus ?**\n\nContrairement à Manus, AgenticSeek privilégie l'indépendance des systèmes externes, vous donnant plus de contrôle, de confidentialité et évitant les coûts d'API.\n\n**Q: Qui est derrière ce projet ?**\n\nCe projet a été créé par moi, avec deux amis comme mainteneurs et des contributeurs de la communauté open source sur GitHub. Nous sommes juste des individus passionnés, pas une startup, ni affiliés à aucune organisation.\n\nTout compte AgenticSeek sur X autre que mon compte personnel (https://x.com/Martin993886460) est un imposteur.\n\n## Contribuer\n\nNous recherchons des développeurs pour améliorer AgenticSeek ! Consultez les problèmes ouverts ou les discussions.\n\n[Guide de contribution](./docs/CONTRIBUTING.md)\n\n## Sponsors:\n\nVous voulez améliorer les capacités d'AgenticSeek avec des fonctionnalités comme la recherche de vols, la planification de voyages ou l'obtention des meilleures offres d'achat ? Envisagez d'utiliser SerpApi pour créer des outils personnalisés qui débloquent plus de fonctionnalités de type Jarvis. Avec SerpApi, vous pouvez accélérer votre agent pour des tâches professionnelles tout en gardant le contrôle total.\n\n<a href=\"https://serpapi.com/\"><img src=\"./media/banners/sponsor_banner_serpapi.png\" height=\"350\" alt=\"SerpApi Banner\" ></a>\n\nConsultez [Contributing.md](./docs/CONTRIBUTING.md) pour apprendre comment intégrer des outils personnalisés !\n\n### **Sponsors**:\n\n- [tatra-labs](https://github.com/tatra-labs)\n\n## Mainteneurs:\n\n > [Fosowl](https://github.com/Fosowl) | Heure de Paris \n\n > [antoineVIVIES](https://github.com/antoineVIVIES) | Heure de Taipei \n\n## Remerciements spéciaux:\n\n > [tcsenpai](https://github.com/tcsenpai) et [plitc](https://github.com/plitc) pour avoir aidé à la dockerisation du backend\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)\n"
  },
  {
    "path": "README_JP.md",
    "content": "# AgenticSeek: Manusのプライベートでローカルな代替品\n\n<p align=\"center\">\n<img align=\"center\" src=\"./media/agentic_seek_logo.png\" width=\"300\" height=\"300\" alt=\"Agentic Seek Logo\">\n<p>\n\n  English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)\n\n*音声対応のAIアシスタントで、**100%ローカルで動作するManus AIの代替品**です。自律的にウェブを閲覧し、コードを書き、タスクを計画し、すべてのデータをデバイス上に保持します。ローカル推論モデル向けに設計されており、完全にあなたのハードウェア上で動作し、プライバシーを保証し、クラウドへの依存をゼロにします。*\n\n[![AgenticSeekを訪問](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)\n\n### なぜAgenticSeekを選ぶのか？\n\n* 🔒 完全にローカル＆プライベート - すべてがあなたのマシン上で動作し、クラウドなし、データ共有なし。あなたのファイル、会話、検索はプライベートのままです。\n\n* 🌐 インテリジェントなウェブブラウジング - AgenticSeekは自律的にインターネットを閲覧できます：検索、読み取り、情報抽出、ウェブフォーム入力、すべて手動操作なしで。\n\n* 💻 自律的なプログラミングアシスタント - コードが必要ですか？Python、C、Go、Javaなどのプログラムを監督なしで書き、デバッグし、実行できます。\n\n* 🧠 インテリジェントなエージェント選択 - あなたが要求すると、自動的に最適なエージェントがタスクに割り当てられます。常に利用可能な専門家チームを持っているようなものです。\n\n* 📋 複雑なタスクの計画と実行 - 旅行計画から複雑なプロジェクトまで、大きなタスクをステップに分解し、複数のAIエージェントを使用して完了できます。\n\n* 🎙️ 音声サポート - クリーンで高速で未来的な音声と音声認識機能により、SF映画のようなパーソナルAIと会話できます。（開発中）\n\n### **デモ**\n\n> *agenticSeekプロジェクトを検索して必要なスキルを学び、CV_candidates.zipを開いて、どの候補がプロジェクトに最も適しているか教えてくれますか？*\n\nhttps://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316\n\n免責事項：このデモと表示されるすべてのファイル（例：CV_candidates.zip）は完全に架空のものです。私たちは企業ではなく、候補者ではなくオープンソースの貢献者を求めています。\n\n> 🛠⚠️️ **アクティブな開発中**\n\n> 🙏 このプロジェクトはサイドプロジェクトとして始まり、ロードマップも資金もありませんでした。GitHub Trendingに登場して予想以上に成長しました。貢献、フィードバック、忍耐に深く感謝します。\n\n## 前提条件\n\n始める前に、以下がインストールされていることを確認してください：\n\n*   **Git:** リポジトリをクローンするため。[Gitをダウンロード](https://git-scm.com/downloads)\n*   **Python 3.10.x:** Python 3.10.xを強く推奨します。他のバージョンでは依存関係エラーが発生する可能性があります。[Python 3.10をダウンロード](https://www.python.org/downloads/release/python-3100/)（3.10.xバージョンを選択）。\n*   **Docker Engine & Docker Compose:** SearxNGなどのパッケージ化されたサービスを実行するため。\n    *   Docker Desktopをインストール（Docker Compose V2を含む）：[Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)\n    *   またはLinuxでDocker EngineとDocker Composeを別々にインストール：[Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/)（Compose V2をインストールしていることを確認、例：`sudo apt-get install docker-compose-plugin`）。\n\n### 1. **リポジトリをクローンして設定**\n\n```sh\ngit clone https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek\nmv .env.example .env\n```\n\n### 2. .envファイルの内容を変更\n\n```sh\nSEARXNG_BASE_URL=\"http://searxng:8080\" # ホストでCLIモードを実行する場合はhttp://127.0.0.1:8080を使用\nREDIS_BASE_URL=\"redis://redis:6379/0\"\nWORK_DIR=\"/Users/mlg/Documents/workspace_for_ai\"\nOLLAMA_PORT=\"11434\"\nLM_STUDIO_PORT=\"1234\"\nCUSTOM_ADDITIONAL_LLM_PORT=\"11435\"\nOPENAI_API_KEY='optional'\nDEEPSEEK_API_KEY='optional'\nOPENROUTER_API_KEY='optional'\nTOGETHER_API_KEY='optional'\nGOOGLE_API_KEY='optional'\nANTHROPIC_API_KEY='optional'\n```\n\n必要に応じて`.env`ファイルを更新してください：\n\n- **SEARXNG_BASE_URL**: ホストでCLIモードを実行する場合を除き、変更しないでください。\n- **REDIS_BASE_URL**: 変更しないでください \n- **WORK_DIR**: ローカル作業ディレクトリへのパス。AgenticSeekはこれらのファイルを読み取り、操作できます。\n- **OLLAMA_PORT**: Ollamaサービスのポート番号。\n- **LM_STUDIO_PORT**: LM Studioサービスのポート番号。\n- **CUSTOM_ADDITIONAL_LLM_PORT**: 追加のカスタムLLMサービスのポート。\n\n**APIキーは、ローカルでLLMを実行することを選択するユーザーには完全にオプションであり、これがこのプロジェクトの主な目的です。ハードウェアが十分にある場合は空のままにしてください。**\n\n### 3. **Dockerを起動**\n\nDockerがインストールされ、システム上で実行されていることを確認してください。以下のコマンドでDockerを起動できます：\n\n- **Linux/macOS:**  \n    ターミナルを開いて実行：\n    ```sh\n    sudo systemctl start docker\n    ```\n    または、インストールされている場合はアプリケーションメニューからDocker Desktopを起動。\n\n- **Windows:**  \n    スタートメニューからDocker Desktopを起動。\n\nDockerが実行されているかは以下で確認できます：\n```sh\ndocker info\n```\nDockerインストール情報が表示されれば正常に動作しています。\n\n要約については以下の[ローカルプロバイダーリスト](#ローカルプロバイダーリスト)を参照してください。\n\n次のステップ：[ローカルでAgenticSeekを実行](#サービスを起動して実行)\n\n*問題が発生した場合は、[トラブルシューティング](#トラブルシューティング)セクションを参照してください。*\n*ハードウェアがローカルでLLMを実行できない場合は、[APIを使用した実行設定](#apiを使用した実行設定)を参照してください。*\n*詳細な`config.ini`の説明については、[設定セクション](#設定)を参照してください。*\n\n---\n\n## マシン上でローカルにLLMを実行する設定\n\n**ハードウェア要件:**\n\nLLMをローカルで実行するには、十分なハードウェアが必要です。少なくともMagistral、Qwen、またはDeepseek 14Bを実行できるGPUが必要です。詳細なモデル/パフォーマンスの推奨事項についてはFAQを参照してください。\n\n**ローカルプロバイダーを設定**  \n\n例えばollamaを使用してローカルプロバイダーを起動：\n\n```sh\nollama serve\n```\n\nサポートされているローカルプロバイダーのリストは以下を参照してください。\n\n**config.iniを更新**\n\nconfig.iniファイルを変更して、provider_nameをサポートされているプロバイダーに、provider_modelをプロバイダーがサポートするLLMに設定します。*Magistral*や*Deepseek*などの推論モデルをお勧めします。\n\n必要なハードウェアについては、READMEの最後にある**FAQ**を参照してください。\n\n```sh\n[MAIN]\nis_local = True # ローカルで実行するかリモートプロバイダーを使用するか\nprovider_name = ollama # またはlm-studio、openaiなど\nprovider_model = deepseek-r1:14b # ハードウェアに互換性のあるモデルを選択\nprovider_server_address = 127.0.0.1:11434\nagent_name = Jarvis # AIの名前\nrecover_last_session = True # 前のセッションを復元\nsave_session = True # 現在のセッションを記憶\nspeak = False # テキスト読み上げ\nlisten = False # 音声認識、CLIのみ、実験的\njarvis_personality = False # より「Jarvis」的な性格を使用（実験的）\nlanguages = en zh # 言語リスト、TTSはデフォルトでリストの最初を使用\n[BROWSER]\nheadless_browser = True # ホストでCLIを使用する場合を除き変更しない\nstealth_mode = True # 検出されにくいseleniumを使用してブラウザ検出を減らす\n```\n\n**警告**:\n\n- `config.ini`ファイル形式はコメントをサポートしていません。\nコメントがエラーを引き起こすため、サンプル設定を直接コピー＆ペーストしないでください。代わりに、コメントなしで希望の設定で`config.ini`ファイルを手動で変更してください。\n\n- LM-studioを使用してLLMを実行する場合、provider_nameを`openai`に設定*しない*でください。`lm-studio`として使用してください。\n\n- 一部のプロバイダー（例：lm-studio）では、IPの前に`http://`が必要です。例：`http://127.0.0.1:1234`\n\n**ローカルプロバイダーリスト**\n\n| プロバイダー  | ローカル？ | 説明                                               |\n|-----------|--------|-----------------------------------------------------------|\n| ollama    | はい    | ollamaを使用して簡単にローカルでLLMを実行 |\n| lm-studio  | はい    | LM studioでローカルにLLMを実行（`provider_name` = `lm-studio`に設定）|\n| openai    | はい     |  OpenAI互換API（例：llama.cppサーバー）を使用  |\n\n次のステップ：[サービスを起動してAgenticSeekを実行](#サービスを起動して実行)  \n\n*問題が発生した場合は、[トラブルシューティング](#トラブルシューティング)セクションを参照してください。*\n*ハードウェアがローカルでLLMを実行できない場合は、[APIを使用した実行設定](#apiを使用した実行設定)を参照してください。*\n*詳細な`config.ini`の説明については、[設定セクション](#設定)を参照してください。*\n\n## APIを使用した実行設定\n\nこの設定では、外部のクラウドベースのLLMプロバイダーを使用します。選択したサービスからAPIキーを取得する必要があります。\n\n**1. APIプロバイダーを選択し、APIキーを取得:**\n\n以下の[APIプロバイダーリスト](#apiプロバイダーリスト)を参照してください。ウェブサイトにアクセスして登録し、APIキーを取得してください。\n\n**2. APIキーを環境変数として設定:**\n\n*   **Linux/macOS:**\n    ターミナルを開き、`export`コマンドを使用します。永続的にするにはシェルの設定ファイル（例：`~/.bashrc`、`~/.zshrc`）に追加するのがベストです。\n    ```sh\n    export PROVIDER_API_KEY=\"your_api_key_here\" \n    # PROVIDER_API_KEYを特定の変数名に置き換えてください、例：OPENAI_API_KEY、GOOGLE_API_KEY\n    ```\n    TogetherAIの例：\n    ```sh\n    export TOGETHER_API_KEY=\"xxxxxxxxxxxxxxxxxxxxxx\"\n    ```\n*   **Windows:**\n    *   **コマンドプロンプト（現在のセッション限定）:**\n        ```cmd\n        set PROVIDER_API_KEY=your_api_key_here\n        ```\n    *   **PowerShell（現在のセッション限定）:**\n        ```powershell\n        $env:PROVIDER_API_KEY=\"your_api_key_here\"\n        ```\n    *   **永続的:** Windowsの検索バーで「環境変数」を検索し、「システムの環境変数を編集」をクリックしてから「環境変数...」ボタンをクリックします。適切な名前（例：`OPENAI_API_KEY`）とキーを値として新しいユーザー変数を追加します。\n\n    *(詳細については、FAQを参照してください：[APIキーを設定する方法？](#apiキーを設定する方法))。*\n\n\n**3. `config.ini`を更新:**\n```ini\n[MAIN]\nis_local = False\nprovider_name = openai # またはgoogle、deepseek、togetherAI、huggingface\nprovider_model = gpt-3.5-turbo # またはgemini-1.5-flash、deepseek-chat、mistralai/Mixtral-8x7B-Instruct-v0.1など\nprovider_server_address = # is_local = Falseの場合、ほとんどのAPIでは無視されるか空にできる\n# ... その他の設定 ...\n```\n*警告:* configの値に末尾のスペースがないことを確認してください。\n\n**APIプロバイダーリスト**\n\n| プロバイダー     | `provider_name` | ローカル？ | 説明                                       | APIキーリンク（例）                     |\n|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|\n| OpenAI       | `openai`        | いいえ     | OpenAIのAPIを通じてChatGPTモデルを使用。              | [platform.openai.com/signup](https://platform.openai.com/signup) |\n| Google Gemini| `google`        | いいえ     | Google AI Studioを通じてGoogle Geminiモデルを使用。    | [aistudio.google.com/keys](https://aistudio.google.com/keys) |\n| Deepseek     | `deepseek`      | いいえ     | 彼らのAPIを通じてDeepseekモデルを使用。                | [platform.deepseek.com](https://platform.deepseek.com) |\n| Hugging Face | `huggingface`   | いいえ     | Hugging Face Inference APIのモデルを使用。       | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |\n| TogetherAI   | `togetherAI`    | いいえ     | TogetherAI APIを通じて様々なオープンソースモデルを使用。| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |\n| OpenRouter   | `openrouter`    | いいえ     | OpenRouter APIを通じて様々なオープンソースモデルを使用。| [openrouter.api](https://openrouter.ai/) |\n\n*注:*\n*   複雑なウェブブラウジングとタスクプランニングには`gpt-4o`や他のOpenAIモデルの使用は推奨しません。現在のプロンプト最適化はDeepseekなどのモデルを対象としているためです。\n*   コーディング/bashタスクはGeminiで失敗する可能性があります。Deepseek r1用に最適化されたプロンプト形式を無視する傾向があるためです。\n*   `is_local = False`の場合、`config.ini`の`provider_server_address`は通常使用されません。APIエンドポイントは通常、対応するプロバイダーのライブラリで処理されるためです。\n\n次のステップ：[サービスを起動してAgenticSeekを実行](#サービスを起動して実行)\n\n*問題が発生した場合は、**既知の問題**セクションを参照してください*\n\n*詳細な設定ファイルの説明については、**設定セクション**を参照してください。*\n\n---\n\n## サービスを起動して実行\n\nデフォルトでは、AgenticSeekは完全にDocker内で実行されます。\n\n**オプション1:** DockerでWebインターフェースを使用して実行：\n\n必要なサービスを起動します。これにより、docker-compose.ymlのすべてのサービスが起動します：\n    - searxng\n    - redis（searxngに必要）\n    - frontend\n    - backend（Webインターフェースに`full`を使用する場合）\n\n```sh\n./start_services.sh full # MacOS\nstart start_services.cmd full # Windows\n```\n\n**警告:** このステップではすべてのDockerイメージがダウンロードされロードされます。最大30分かかる場合があります。サービスを起動した後、メッセージを送信する前にバックエンドサービスが完全に実行されていることを確認してください（ログに**backend: \"GET /health HTTP/1.1\" 200 OK**が表示されるはずです）。初回実行時、バックエンドサービスは起動に5分かかる場合があります。\n\n`http://localhost:3000/`にアクセスすると、Webインターフェースが表示されます。\n\n*サービス起動のトラブルシューティング:* これらのスクリプトが失敗する場合は、Docker Engineが実行中でDocker Compose（V2、`docker compose`）が正しくインストールされていることを確認してください。ターミナル出力のエラーメッセージを確認してください。[FAQ: ヘルプ！AgenticSeekまたはそのスクリプトを実行するとエラーが発生します](#faq-トラブルシューティング)を参照してください。\n\n**オプション2:** CLIモード：\n\nCLIインターフェースで実行するには、ホストにパッケージをインストールする必要があります：\n\n```sh\n./install.sh\n./install.bat # windows\n```\n\n次に、`config.ini`のSEARXNG_BASE_URLを以下に変更する必要があります：\n\n```sh\nSEARXNG_BASE_URL=\"http://localhost:8080\"\n```\n\n必要なサービスを起動します。これにより、docker-compose.ymlの一部のサービスが起動します：\n    - searxng\n    - redis（searxngに必要）\n    - frontend\n\n```sh\n./start_services.sh # MacOS\nstart start_services.cmd # Windows\n```\n\n実行：uv run: `uv run python -m ensurepip` でuvがpipを有効にしていることを確認します。\n\nCLIを使用：`uv run cli.py`\n\n---\n\n## 使用方法\n\nサービスが`./start_services.sh full`で実行されていることを確認し、`localhost:3000`にアクセスしてWebインターフェースを使用します。\n\n`listen = True`を設定することで音声認識も使用できます。CLIモードのみ。\n\n終了するには、単に`goodbye`と言う/入力します。\n\n使用例：\n\n> *Pythonでスネークゲームを作って！*\n\n> *ウェブでフランスのレンヌの最高のカフェを検索し、3つとその住所をrennes_cafes.txtに保存して*\n\n> *階乗を計算するGoプログラムを書き、factorial.goとしてワークスペースに保存して*\n\n> *summer_picturesフォルダ内のすべてのJPGファイルを検索し、今日の日付で名前を変更し、名前変更されたファイルのリストをphotos_list.txtに保存して*\n\n> *オンラインで2024年の人気SF映画を検索し、今夜見るために3つ選び、movie_night.txtに保存して*\n\n> *ウェブで2025年の最新AIニュース記事を検索し、3つ選び、タイトルと要約を抽出するPythonスクリプトを書き、スクリプトをnews_scraper.pyとして保存し、要約をai_news.txtに保存（/home/projects）*\n\n> *金曜日、無料の株価APIをウェブ検索し、supersuper7434567@gmail.comで登録し、APIを使用してテスラの日次株価を取得するPythonスクリプトを書き、結果をstock_prices.csvに保存して*\n\n*フォーム入力はまだ実験的であり、失敗する可能性があることに注意してください。*\n\nクエリを入力すると、AgenticSeekが最適なエージェントをタスクに割り当てます。\n\nこれは初期プロトタイプであるため、エージェントルーティングシステムは常にクエリに正しいエージェントを割り当てられるとは限りません。\n\nしたがって、あなたが何を望んでいるか、そしてAIがどのように進めるかを非常に明確に表現する必要があります。例えば、ウェブ検索をしてほしい場合は、次のように言わないでください：\n\n`一人旅に適した国を知っていますか？`\n\n代わりに、次のように言ってください：\n\n`ウェブ検索を実行し、一人旅に最適な国を見つけてください`\n\n---\n\n## **独自のサーバーでLLMを実行する設定**\n\n強力なコンピューターやアクセス可能なサーバーを持っているが、ラップトップから使用したい場合は、カスタムllmサーバーを使用してリモートサーバーでLLMを実行することを選択できます。\n\nAIモデルを実行する「サーバー」で、IPアドレスを取得します\n\n```sh\nip a | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # ローカルIP\ncurl https://ipinfo.io/ip # パブリックIP\n```\n\n注：WindowsまたはmacOSでは、IPアドレスを見つけるためにipconfigまたはifconfigを使用してください。\n\nリポジトリをクローンし、`server/`フォルダに移動します。\n\n```sh\ngit clone --depth 1 https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek/llm_server/\n```\n\nサーバー固有の要件をインストールします：\n\n```sh\npip3 install -r requirements.txt\n```\n\nサーバースクリプトを実行します。\n\n```sh\npython3 app.py --provider ollama --port 3333\n```\n\nLLMサービスとして`ollama`と`llamacpp`のどちらを使用するか選択できます。\n\n次に、あなたのパーソナルコンピューターで：\n\n`config.ini`ファイルを変更して、`provider_name`を`server`に、`provider_model`を`deepseek-r1:xxb`に設定します。\n`provider_server_address`をモデルを実行するマシンのIPアドレスに設定します。\n\n```sh\n[MAIN]\nis_local = False\nprovider_name = server\nprovider_model = deepseek-r1:70b\nprovider_server_address = http://x.x.x.x:3333\n```\n\n次のステップ：[サービスを起動してAgenticSeekを実行](#サービスを起動して実行)  \n\n---\n\n## 音声認識\n\n警告：現在、音声認識はCLIモードでのみ機能します。\n\n現在、音声認識は英語でのみ機能することに注意してください。\n\n音声認識機能はデフォルトで無効になっています。有効にするには、config.iniファイルでlistenオプションをTrueに設定します：\n\n```\nlisten = True\n```\n\n有効にすると、音声認識機能はトリガーワード、つまりエージェントの名前をリッスンし、その後入力を処理し始めます。*config.ini*ファイルの`agent_name`値を更新することでエージェントの名前をカスタマイズできます：\n\n```\nagent_name = Friday\n```\n\n最高の認識のためには、エージェント名として「John」や「Emma」などの一般的な英語名を使用することをお勧めします。\n\n文字起こしが表示され始めたら、エージェントの名前を大声で言って起動します（例：「Friday」）。\n\nクエリを明確に言います。\n\n確認フレーズでリクエストを終了して、システムに続行するように指示します。確認フレーズの例：\n```\n\"do it\", \"go ahead\", \"execute\", \"run\", \"start\", \"thanks\", \"would ya\", \"please\", \"okay?\", \"proceed\", \"continue\", \"go on\", \"do that\", \"go it\", \"do you understand?\"\n```\n\n## 設定\n\n設定例：\n```\n[MAIN]\nis_local = True\nprovider_name = ollama\nprovider_model = deepseek-r1:32b\nprovider_server_address = http://127.0.0.1:11434 # Ollama例；LM-Studioはhttp://127.0.0.1:1234を使用\nagent_name = Friday\nrecover_last_session = False\nsave_session = False\nspeak = False\nlisten = False\n\njarvis_personality = False\nlanguages = en zh # TTSおよび潜在的なルーティングの言語リスト。\n[BROWSER]\nheadless_browser = False\nstealth_mode = False\n```\n\n**`config.ini`設定の説明**：\n\n*   **`[MAIN]`セクション：**\n    *   `is_local`: ローカルLLMプロバイダー（Ollama、LM-Studio、ローカルOpenAI互換サーバー）またはセルフホストサーバーオプションを使用する場合は`True`。クラウドベースのAPI（OpenAI、Googleなど）を使用する場合は`False`。\n    *   `provider_name`: LLMプロバイダーを指定します。\n        *   ローカルオプション：`ollama`、`lm-studio`、`openai`（ローカルOpenAI互換サーバー用）、`server`（セルフホストサーバー設定用）。\n        *   APIオプション：`openai`、`google`、`deepseek`、`huggingface`、`togetherAI`。\n    *   `provider_model`: 選択したプロバイダーの特定のモデル名またはID（例：Ollamaの`deepseekcoder:6.7b`、OpenAI APIの`gpt-3.5-turbo`、TogetherAIの`mistralai/Mixtral-8x7B-Instruct-v0.1`）。\n    *   `provider_server_address`: あなたのLLMプロバイダーのアドレス。\n        *   ローカルプロバイダー用：例：Ollamaの`http://127.0.0.1:11434`、LM-Studioの`http://127.0.0.1:1234`。\n        *   `server`プロバイダータイプ用：あなたのセルフホストLLMサーバーのアドレス（例：`http://your_server_ip:3333`）。\n        *   クラウドAPI用（`is_local = False`）：これは通常無視されるか空にできます。APIエンドポイントは通常クライアントライブラリで処理されるためです。\n    *   `agent_name`: AIアシスタントの名前（例：Friday）。有効な場合、音声認識のトリガーワードとして使用されます。\n    *   `recover_last_session`: `True`は前のセッションの状態を復元しようとし、`False`は最初から開始します。\n    *   `save_session`: `True`は現在のセッションの状態を潜在的な復元用に保存し、`False`はしません。\n    *   `speak`: `True`はテキスト読み上げ音声出力を有効にし、`False`は無効にします。\n    *   `listen`: `True`は音声認識音声入力を有効にし（CLIモードのみ）、`False`は無効にします。\n    *   `work_dir`: **重要：** AgenticSeekがファイルを読み書きするディレクトリ。**このパスがシステムで有効かつアクセス可能であることを確認してください。**\n    *   `jarvis_personality`: `True`はより「Jarvis-like」なシステムプロンプトを使用（実験的）、`False`は標準プロンプトを使用。\n    *   `languages`: カンマ区切りの言語リスト（例：`en, zh, fr`）。TTS音声選択（デフォルトは最初）に使用され、LLMルーターを支援できます。ルーターの非効率性を避けるため、多すぎる言語や非常に類似した言語の使用は避けてください。\n*   **`[BROWSER]`セクション：**\n    *   `headless_browser`: `True`は可視ウィンドウなしで自動化ブラウザを実行（Webインターフェースまたは非対話的使用に推奨）。`False`はブラウザウィンドウを表示（CLIモードまたはデバッグに有用）。\n    *   `stealth_mode`: `True`はブラウザ自動化の検出を困難にする措置を有効にします。anticaptchaなどのブラウザ拡張機能の手動インストールが必要な場合があります。\n\nこのセクションはサポートされているLLMプロバイダータイプをまとめています。`config.ini`で設定します。\n\n**ローカルプロバイダー（独自のハードウェアで実行）：**\n\n| config.iniのプロバイダー名 | `is_local` | 説明                                                                 | 設定セクション                                                    |\n|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|\n| `ollama`                      | `True`     | Ollamaを使用してローカルでLLMを簡単に提供。                                             | [マシン上でローカルにLLMを実行する設定](#マシン上でローカルにllmを実行する設定) |\n| `lm-studio`                   | `True`     | LM-StudioでローカルにLLMを提供。                                          | [マシン上でローカルにLLMを実行する設定](#マシン上でローカルにllmを実行する設定) |\n| `openai`（ローカルサーバー用）   | `True`     | OpenAI互換APIを公開するローカルサーバー（例：llama.cpp）に接続。 | [マシン上でローカルにLLMを実行する設定](#マシン上でローカルにllmを実行する設定) |\n| `server`                      | `False`    | 別のマシンで実行されているAgenticSeekセルフホストLLMサーバーに接続。 | [独自のサーバーでLLMを実行する設定](#独自のサーバーでllmを実行する設定) |\n\n**APIプロバイダー（クラウドベース）：**\n\n| config.iniのプロバイダー名 | `is_local` | 説明                                      | 設定セクション                                       |\n|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|\n| `openai`                      | `False`    | OpenAIの公式API（例：GPT-3.5、GPT-4）を使用。 | [APIを使用した実行設定](#apiを使用した実行設定) |\n| `google`                      | `False`    | APIを通じてGoogleのGeminiモデルを使用。              | [APIを使用した実行設定](#apiを使用した実行設定) |\n| `deepseek`                    | `False`    | Deepseekの公式APIを使用。                     | [APIを使用した実行設定](#apiを使用した実行設定) |\n| `huggingface`                 | `False`    | Hugging Face Inference APIを使用。                  | [APIを使用した実行設定](#apiを使用した実行設定) |\n| `togetherAI`                  | `False`    | TogetherAIのAPIを通じて様々なオープンモデルを使用。    | [APIを使用した実行設定](#apiを使用した実行設定) |\n\n---\n## トラブルシューティング\n\n問題が発生した場合、このセクションはガイダンスを提供します。\n\n# 既知の問題\n\n## ChromeDriverの問題\n\n**エラー例：** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`\n\n### 根本原因\nChromeDriverのバージョン非互換性は以下で発生します：\n1. インストールしたChromeDriverのバージョンがChromeブラウザのバージョンと一致しない\n2. Docker環境では、`undetected_chromedriver`が独自のChromeDriverバージョンをダウンロードし、マウントされたバイナリを回避する可能性がある\n\n### 解決手順\n\n#### 1. Chromeのバージョンを確認\nGoogle Chromeを開く → `設定 > Chromeについて`でバージョンを確認（例：「バージョン 134.0.6998.88」）\n\n#### 2. 一致するChromeDriverをダウンロード\n\n**Chrome 115以降の場合：** [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)を使用\n- Chrome for Testingの可用性ダッシュボードにアクセス\n- あなたのChromeバージョンまたは最も近い利用可能な一致を見つける\n- オペレーティングシステム用のChromeDriverをダウンロード（Docker環境ではLinux64を使用）\n\n**古いChromeバージョンの場合：** [レガシーChromeDriverダウンロード](https://chromedriver.chromium.org/downloads)を使用\n\n![Chrome for TestingからChromeDriverをダウンロード](./media/chromedriver_readme.png)\n\n#### 3. ChromeDriverをインストール（方法を選択）\n\n**方法A：プロジェクトルートディレクトリ（Docker推奨）**\n```bash\n# ダウンロードしたchromedriverバイナリをプロジェクトルートディレクトリに配置\ncp path/to/downloaded/chromedriver ./chromedriver\nchmod +x ./chromedriver  # Linux/macOSで実行可能にする\n```\n\n**方法B：システムPATH**\n```bash\n# Linux/macOS\nsudo mv chromedriver /usr/local/bin/\nsudo chmod +x /usr/local/bin/chromedriver\n\n# Windows: chromedriver.exeをPATH内のフォルダに配置\n```\n\n#### 4. インストールを確認\n```bash\n# ChromeDriverのバージョンをテスト\n./chromedriver --version\n# またはPATHにある場合：\nchromedriver --version\n```\n\n### Docker固有の指示\n\n⚠️ **Dockerユーザーへの重要：**\n- Dockerボリュームマウント方法はステルスモード（`undetected_chromedriver`）では機能しない可能性があります\n- **解決策：** ChromeDriverをプロジェクトルートディレクトリに`./chromedriver`として配置\n- アプリケーションが自動的に検出し、このバイナリを使用します\n- ログに次のメッセージが表示されるはずです：`\"Using ChromeDriver from project root: ./chromedriver\"`\n\n### トラブルシューティングのヒント\n\n1. **まだバージョンの不一致が発生しますか？**\n   - ChromeDriverが実行可能か確認：`ls -la ./chromedriver`\n   - ChromeDriverのバージョンを確認：`./chromedriver --version`\n   - Chromeブラウザのバージョンと一致することを確認\n\n2. **Dockerコンテナの問題ですか？**\n   - バックエンドログを確認：`docker logs backend`\n   - メッセージを探す：`\"Using ChromeDriver from project root\"`\n   - 見つからない場合は、ファイルが存在し実行可能であることを確認\n\n3. **Chrome for Testingのバージョン**\n   - 可能な限り完全一致を使用\n   - バージョン134.0.6998.88の場合、ChromeDriver 134.0.6998.165を使用（最も近い利用可能バージョン）\n   - メジャーバージョン番号は一致する必要があります（134 = 134）\n\n### バージョン互換性マトリックス\n\n| Chromeバージョン | ChromeDriverバージョン | ステータス |\n|----------------|---------------------|---------|\n| 134.0.6998.x   | 134.0.6998.165     | ✅ 利用可能 |\n| 133.0.6943.x   | 133.0.6943.141     | ✅ 利用可能 |\n| 132.0.6834.x   | 132.0.6834.159     | ✅ 利用可能 |\n\n*最新の互換性については、[Chrome for Testingダッシュボード](https://googlechromelabs.github.io/chrome-for-testing/)を確認*\n\n`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113\nCurrent browser version is 134.0.6998.89 with binary path`\n\nブラウザとchromedriverのバージョンが一致しない場合に発生します。\n\n最新バージョンをダウンロードする必要があります：\n\nhttps://developer.chrome.com/docs/chromedriver/downloads\n\nChromeバージョン115以降を使用している場合は、以下にアクセス：\n\nhttps://googlechromelabs.github.io/chrome-for-testing/\n\nオペレーティングシステムに一致するchromedriverバージョンをダウンロードします。\n\n![alt text](./media/chromedriver_readme.png)\n\nこのセクションが不完全な場合は、issueを開いてください。\n\n##  接続アダプターの問題\n\n```\nException: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'`（注：ポートは異なる場合があります）\n```\n\n*   **原因：** `config.ini`の`lm-studio`（または他の類似のローカルOpenAI互換サーバー）の`provider_server_address`に`http://`プレフィックスが欠けているか、間違ったポートを指している。\n*   **解決策：**\n    *   アドレスに`http://`が含まれていることを確認。LM-Studioは通常デフォルトで`http://127.0.0.1:1234`を使用。\n    *   正しい`config.ini`：`provider_server_address = http://127.0.0.1:1234`（または実際のLM-Studioサーバーポート）。\n\n## SearxNGベースURLが提供されていない\n\n```\nraise ValueError(\"SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.\")\nValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`\n```\n\n間違ったsearxngベースURLでCLIモードを実行すると発生する可能性があります。\n\nSEARXNG_BASE_URLは、Dockerで実行するかホストで実行するかによって異なります：\n\n**ホストで実行：** `SEARXNG_BASE_URL=\"http://localhost:8080\"`\n\n**完全にDocker内で実行（Webインターフェース）：** `SEARXNG_BASE_URL=\"http://searxng:8080\"`\n\n## FAQ\n\n**Q: どのようなハードウェアが必要ですか？**  \n\n| モデルサイズ  | GPU  | コメント                                               |\n|-----------|--------|-----------------------------------------------------------|\n| 7B        | 8GB VRAM | ⚠️ 非推奨。パフォーマンスが低く、頻繁な幻覚、計画エージェントが失敗する可能性があります。 |\n| 14B        | 12 GB VRAM（例：RTX 3060） | ✅ 単純なタスクに使用可能。ウェブブラウジングとタスク計画に困難がある可能性があります。 |\n| 32B        | 24+ GB VRAM（例：RTX 4090） | 🚀 ほとんどのタスクで成功、タスク計画にまだ困難がある可能性があります |\n| 70B+        | 48+ GB VRAM | 💪 優れています。高度な使用例に推奨。 |\n\n**Q: エラーが発生したらどうすればよいですか？**  \n\nローカルが実行されていること（`ollama serve`）、`config.ini`がプロバイダーと一致していること、依存関係がインストールされていることを確認してください。どれも機能しない場合は、遠慮なくissueを開いてください。\n\n**Q: 本当に100%ローカルで実行できますか？**  \n\nはい、Ollama、lm-studio、またはserverプロバイダーを使用すると、すべての音声認識、LLM、テキスト読み上げモデルがローカルで実行されます。非ローカルオプション（OpenAI或其他API）はオプションです。\n\n**Q: Manusがあるのに、なぜAgenticSeekを使用する必要がありますか？**\n\nManusとは異なり、AgenticSeekは外部システムからの独立性を優先し、より多くの制御、プライバシー、APIコストの回避を提供します。\n\n**Q: このプロジェクトの背後には誰がいますか？**\n\nこのプロジェクトは私によって作成され、2人の友人がメンテナーとして、GitHub上のオープンソースコミュニティの貢献者と共に運営されています。私たちは単なる情熱的な個人であり、スタートアップではなく、どの組織にも所属していません。\n\n私の個人アカウント（https://x.com/Martin993886460）以外のX上のAgenticSeekアカウントはすべて偽物です。\n\n## 貢献\n\nAgenticSeekを改善する開発者を探しています！オープンなissueやディスカッションを確認してください。\n\n[貢献ガイド](./docs/CONTRIBUTING.md)\n\n## スポンサー：\n\nフライト検索、旅行計画、または最高の買い物のお得な情報の取得などの機能でAgenticSeekの能力を向上させたいですか？SerpApiを使用してカスタムツールを作成し、より多くのJarvisのような機能を解放することを検討してください。SerpApiを使用すると、プロフェッショナルなタスクのためにエージェントを加速させながら、完全な制御を維持できます。\n\n<a href=\"https://serpapi.com/\"><img src=\"./media/banners/sponsor_banner_serpapi.png\" height=\"350\" alt=\"SerpApi Banner\" ></a>\n\n[Contributing.md](./docs/CONTRIBUTING.md)をチェックして、カスタムツールを統合する方法を学びましょう！\n\n### **スポンサー**：\n\n- [tatra-labs](https://github.com/tatra-labs)\n\n## メンテナー：\n\n > [Fosowl](https://github.com/Fosowl) | パリ時間 \n\n > [antoineVIVIES](https://github.com/antoineVIVIES) | 台北時間 \n\n## 特別な感謝：\n\n > [tcsenpai](https://github.com/tcsenpai) と [plitc](https://github.com/plitc) がバックエンドのDocker化を支援\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)\n"
  },
  {
    "path": "README_PTBR.md",
    "content": "# AgenticSeek: Uma Alternativa Privada e Local ao Manus\n\n<p align=\"center\">\n<img align=\"center\" src=\"./media/agentic_seek_logo.png\" width=\"300\" height=\"300\" alt=\"Agentic Seek Logo\">\n<p>\n\n  English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)\n\n*Um assistente de IA com reconhecimento de voz que é uma **alternativa 100% local ao Manus AI**, navega autonomamente na web, escreve código e planeja tarefas enquanto mantém todos os dados no seu dispositivo. Projetado para modelos de raciocínio local, funciona inteiramente no seu hardware, garantindo total privacidade e zero dependência de nuvem.*\n\n[![Visitar AgenticSeek](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)\n\n### Por que escolher o AgenticSeek?\n\n* 🔒 Totalmente Local & Privado - Tudo funciona na sua máquina, sem nuvem, sem compartilhamento de dados. Seus arquivos, conversas e pesquisas permanecem privados.\n\n* 🌐 Navegação Web Inteligente - O AgenticSeek pode navegar na Internet autonomamente: pesquisar, ler, extrair informações, preencher formulários web, tudo sem intervenção manual.\n\n* 💻 Assistente de Programação Autônomo - Precisa de código? Ele pode escrever, depurar e executar programas em Python, C, Go, Java e muito mais, sem supervisão.\n\n* 🧠 Seleção Inteligente de Agentes - Você pergunta, ele escolhe automaticamente o melhor agente para a tarefa. Como ter uma equipe de especialistas sempre disponível.\n\n* 📋 Planeja e Executa Tarefas Complexas - Desde o planejamento de viagens até projetos complexos, ele pode decompor grandes tarefas em etapas e completá-las usando múltiplos agentes de IA.\n\n* 🎙️ Suporte de Voz - Voz clara, rápida e futurista com reconhecimento de voz, permitindo que você converse como com sua IA pessoal de filme de ficção científica. (Em desenvolvimento)\n\n### **Demo**\n\n> *Você pode pesquisar o projeto agenticSeek, aprender quais habilidades são necessárias e, em seguida, abrir CV_candidates.zip e me dizer quais correspondem melhor ao projeto?*\n\nhttps://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316\n\nAviso: Esta demonstração e todos os arquivos que aparecem (ex: CV_candidates.zip) são totalmente fictícios. Não somos uma empresa, estamos procurando contribuidores de código aberto, não candidatos.\n\n> 🛠⚠️️ **Trabalho Ativo em Andamento**\n\n> 🙏 Este projeto começou como um projeto paralelo e não tem roadmap nem financiamento. Cresceu muito além das expectativas ao aparecer no GitHub Trending. Contribuições, comentários e paciência são profundamente apreciados.\n\n## Pré-requisitos\n\nAntes de começar, certifique-se de ter instalado:\n\n*   **Git:** Para clonar o repositório. [Baixar Git](https://git-scm.com/downloads)\n*   **Python 3.10.x:** Python 3.10.x é altamente recomendado. Outras versões podem causar erros de dependência. [Baixar Python 3.10](https://www.python.org/downloads/release/python-3100/) (selecione a versão 3.10.x).\n*   **Docker Engine & Docker Compose:** Para executar serviços empacotados como SearxNG.\n    *   Instalar Docker Desktop (inclui Docker Compose V2): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)\n    *   Ou instalar Docker Engine e Docker Compose separadamente no Linux: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (certifique-se de instalar Compose V2, por exemplo `sudo apt-get install docker-compose-plugin`).\n\n### 1. **Clonar o repositório e configurar**\n\n```sh\ngit clone https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek\nmv .env.example .env\n```\n\n### 2. Modificar o conteúdo do arquivo .env\n\n```sh\nSEARXNG_BASE_URL=\"http://searxng:8080\" # Se você executar no modo CLI no host, use http://127.0.0.1:8080\nREDIS_BASE_URL=\"redis://redis:6379/0\"\nWORK_DIR=\"/Users/mlg/Documents/workspace_for_ai\"\nOLLAMA_PORT=\"11434\"\nLM_STUDIO_PORT=\"1234\"\nCUSTOM_ADDITIONAL_LLM_PORT=\"11435\"\nOPENAI_API_KEY='optional'\nDEEPSEEK_API_KEY='optional'\nOPENROUTER_API_KEY='optional'\nTOGETHER_API_KEY='optional'\nGOOGLE_API_KEY='optional'\nANTHROPIC_API_KEY='optional'\n```\n\nAtualize o arquivo `.env` conforme necessário:\n\n- **SEARXNG_BASE_URL**: Mantenha inalterado, a menos que você execute no modo CLI no host.\n- **REDIS_BASE_URL**: Mantenha inalterado \n- **WORK_DIR**: Caminho para o diretório de trabalho local. O AgenticSeek poderá ler e interagir com esses arquivos.\n- **OLLAMA_PORT**: Número da porta para o serviço Ollama.\n- **LM_STUDIO_PORT**: Número da porta para o serviço LM Studio.\n- **CUSTOM_ADDITIONAL_LLM_PORT**: Porta para qualquer serviço LLM personalizado adicional.\n\n**As chaves de API são completamente opcionais para aqueles que optam por executar LLM localmente, que é o objetivo principal deste projeto. Deixe-as vazias se você tiver hardware suficiente.**\n\n### 3. **Iniciar o Docker**\n\nCertifique-se de que o Docker está instalado e funcionando no seu sistema. Você pode iniciar o Docker com os seguintes comandos:\n\n- **Linux/macOS:**  \n    Abra um terminal e execute:\n    ```sh\n    sudo systemctl start docker\n    ```\n    Ou inicie o Docker Desktop a partir do menu de aplicativos, se instalado.\n\n- **Windows:**  \n    Inicie o Docker Desktop a partir do menu Iniciar.\n\nVocê pode verificar se o Docker está funcionando executando:\n```sh\ndocker info\n```\nSe você vir informações sobre sua instalação do Docker, ele está funcionando corretamente.\n\nConsulte a [Lista de provedores locais](#lista-de-provedores-locais) abaixo para um resumo.\n\nPróxima etapa: [Executar o AgenticSeek localmente](#iniciar-os-serviços-e-executar)\n\n*Se você encontrar problemas, consulte a seção [Solução de problemas](#solução-de-problemas).*\n*Se seu hardware não puder executar LLM localmente, consulte [Configuração para executar com uma API](#configuração-para-executar-com-uma-api).*\n*Para explicações detalhadas do `config.ini`, consulte a [seção Configuração](#configuração).*\n\n---\n\n## Configuração para executar LLM localmente na sua máquina\n\n**Requisitos de hardware:**\n\nPara executar LLM localmente, você precisará de hardware suficiente. No mínimo, uma GPU capaz de executar Magistral, Qwen ou Deepseek 14B é necessária. Consulte o FAQ para recomendações detalhadas de modelo/desempenho.\n\n**Configure seu provedor local**  \n\nInicie seu provedor local, por exemplo com ollama:\n\n```sh\nollama serve\n```\n\nConsulte a lista de provedores locais suportados abaixo.\n\n**Atualizar config.ini**\n\nAltere o arquivo config.ini para definir provider_name como um provedor suportado e provider_model como um LLM suportado pelo seu provedor. Recomendamos modelos de raciocínio como *Magistral* ou *Deepseek*.\n\nConsulte o **FAQ** no final do README para o hardware necessário.\n\n```sh\n[MAIN]\nis_local = True # Se você está executando localmente ou com um provedor remoto.\nprovider_name = ollama # ou lm-studio, openai, etc.\nprovider_model = deepseek-r1:14b # escolha um modelo compatível com seu hardware\nprovider_server_address = 127.0.0.1:11434\nagent_name = Jarvis # o nome da sua IA\nrecover_last_session = True # recuperar a sessão anterior\nsave_session = True # memorizar a sessão atual\nspeak = False # texto para fala\nlisten = False # fala para texto, apenas para CLI, experimental\njarvis_personality = False # usar uma personalidade mais \"Jarvis\" (experimental)\nlanguages = en zh # Lista de idiomas, TTS usará o primeiro da lista por padrão\n[BROWSER]\nheadless_browser = True # mantenha inalterado, a menos que use CLI no host.\nstealth_mode = True # Use selenium indetectável para reduzir a detecção do navegador\n```\n\n**Aviso**:\n\n- O formato do arquivo `config.ini` não suporta comentários.\nNão copie e cole diretamente a configuração de exemplo, pois os comentários causarão erros. Em vez disso, modifique manualmente o arquivo `config.ini` com sua configuração desejada, sem comentários.\n\n- *NÃO* defina provider_name como `openai` se você estiver usando LM-studio para executar LLM. Use-o como `lm-studio`.\n\n- Alguns provedores (ex: lm-studio) exigem `http://` antes do IP. Exemplo: `http://127.0.0.1:1234`\n\n**Lista de provedores locais**\n\n| Provedor  | Local ? | Descrição                                               |\n|-----------|--------|-----------------------------------------------------------|\n| ollama    | Sim    | Executa LLM localmente facilmente usando ollama |\n| lm-studio  | Sim    | Executa LLM localmente com LM studio (defina `provider_name` = `lm-studio`)|\n| openai    | Sim     |  Use uma API compatível com openai (ex: servidor llama.cpp)  |\n\nPróxima etapa: [Iniciar os serviços e executar o AgenticSeek](#iniciar-os-serviços-e-executar)  \n\n*Se você encontrar problemas, consulte a seção [Solução de problemas](#solução-de-problemas).*\n*Se seu hardware não puder executar LLM localmente, consulte [Configuração para executar com uma API](#configuração-para-executar-com-uma-api).*\n*Para explicações detalhadas do `config.ini`, consulte a [seção Configuração](#configuração).*\n\n## Configuração para executar com uma API\n\nEsta configuração usa provedores de LLM externos baseados em nuvem. Você precisará obter chaves de API do serviço escolhido.\n\n**1. Escolha um provedor de API e obtenha uma chave de API:**\n\nConsulte a [Lista de provedores de API](#lista-de-provedores-de-api) abaixo. Visite seus sites para se inscrever e obter chaves de API.\n\n**2. Defina sua chave de API como variável de ambiente:**\n\n*   **Linux/macOS:**\n    Abra um terminal e use o comando `export`. É melhor adicioná-lo ao arquivo de configuração do seu shell (ex: `~/.bashrc`, `~/.zshrc`) para que seja persistente.\n    ```sh\n    export PROVIDER_API_KEY=\"your_api_key_here\" \n    # Substitua PROVIDER_API_KEY pelo nome de variável específico, ex: OPENAI_API_KEY, GOOGLE_API_KEY\n    ```\n    Exemplo TogetherAI:\n    ```sh\n    export TOGETHER_API_KEY=\"xxxxxxxxxxxxxxxxxxxxxx\"\n    ```\n*   **Windows:**\n    *   **Prompt de comando (temporário para a sessão atual):**\n        ```cmd\n        set PROVIDER_API_KEY=your_api_key_here\n        ```\n    *   **PowerShell (temporário para a sessão atual):**\n        ```powershell\n        $env:PROVIDER_API_KEY=\"your_api_key_here\"\n        ```\n    *   **Permanente:** Pesquise \"variáveis de ambiente\" na barra de pesquisa do Windows, clique em \"Editar variáveis de ambiente do sistema\" e depois no botão \"Variáveis de ambiente...\". Adicione uma nova variável de usuário com o nome apropriado (ex: `OPENAI_API_KEY`) e sua chave como valor.\n\n    *(Para mais detalhes, consulte o FAQ: [Como configurar uma chave de API?](#como-configurar-uma-chave-de-api)).*\n\n\n**3. Atualize `config.ini`:**\n```ini\n[MAIN]\nis_local = False\nprovider_name = openai # ou google, deepseek, togetherAI, huggingface\nprovider_model = gpt-3.5-turbo # ou gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1, etc.\nprovider_server_address = # Quando is_local = False, geralmente ignorado ou pode ser deixado vazio para a maioria das APIs\n# ... outras configurações ...\n```\n*Aviso:* Certifique-se de que não há espaços no final dos valores no config.\n\n**Lista de provedores de API**\n\n| Provedor     | `provider_name` | Local ? | Descrição                                       | Link da chave de API (exemplo)                     |\n|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|\n| OpenAI       | `openai`        | Não     | Use os modelos ChatGPT via API OpenAI.              | [platform.openai.com/signup](https://platform.openai.com/signup) |\n| Google Gemini| `google`        | Não     | Use os modelos Google Gemini via Google AI Studio.    | [aistudio.google.com/keys](https://aistudio.google.com/keys) |\n| Deepseek     | `deepseek`      | Não     | Use os modelos Deepseek via sua API.                | [platform.deepseek.com](https://platform.deepseek.com) |\n| Hugging Face | `huggingface`   | Não     | Use modelos do Hugging Face Inference API.       | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |\n| TogetherAI   | `togetherAI`    | Não     | Use vários modelos open source via API TogetherAI.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |\n\n*Nota:*\n*   Não recomendamos usar `gpt-4o` ou outros modelos OpenAI para navegação web complexa e planejamento de tarefas, pois a otimização atual de prompts visa modelos como Deepseek.\n*   Tarefas de codificação/bash podem falhar com Gemini, pois tende a ignorar nosso formato de prompt otimizado para Deepseek r1.\n*   Quando `is_local = False`, `provider_server_address` no `config.ini` geralmente não é usado, pois os endpoints de API são geralmente gerenciados pelas bibliotecas do provedor correspondente.\n\nPróxima etapa: [Iniciar os serviços e executar o AgenticSeek](#iniciar-os-serviços-e-executar)\n\n*Se você encontrar problemas, consulte a seção **Problemas conhecidos***\n\n*Para explicações detalhadas do arquivo de configuração, consulte a **seção Configuração**.*\n\n---\n\n## Iniciar os serviços e executar\n\nPor padrão, o AgenticSeek é executado inteiramente no Docker.\n\n**Opção 1:** Executar no Docker com interface web:\n\nInicie os serviços necessários. Isso iniciará todos os serviços do docker-compose.yml, incluindo:\n    - searxng\n    - redis (necessário para searxng)\n    - frontend\n    - backend (se você usar `full` para a interface web)\n\n```sh\n./start_services.sh full # MacOS\nstart start_services.cmd full # Windows\n```\n\n**Aviso:** Esta etapa baixará e carregará todas as imagens do Docker, o que pode levar até 30 minutos. Depois de iniciar os serviços, aguarde até que o serviço backend esteja totalmente operacional (você deve ver **backend: \"GET /health HTTP/1.1\" 200 OK** nos logs) antes de enviar mensagens. Na primeira inicialização, o serviço backend pode levar 5 minutos para iniciar.\n\nVá para `http://localhost:3000/` e você deve ver a interface web.\n\n*Solução de problemas de inicialização de serviços:* Se esses scripts falharem, certifique-se de que o Docker Engine está funcionando e que o Docker Compose (V2, `docker compose`) está instalado corretamente. Verifique as mensagens de erro na saída do terminal. Consulte [FAQ: Ajuda! Estou recebendo erros ao executar o AgenticSeek ou seus scripts.](#faq-solução-de-problemas)\n\n**Opção 2:** Modo CLI:\n\nPara executar com a interface CLI, você precisa instalar os pacotes no host:\n\n```sh\n./install.sh\n./install.bat # windows\n```\n\nEm seguida, você precisa alterar SEARXNG_BASE_URL no `config.ini` para:\n\n```sh\nSEARXNG_BASE_URL=\"http://localhost:8080\"\n```\n\nInicie os serviços necessários. Isso iniciará alguns serviços do docker-compose.yml, incluindo:\n    - searxng\n    - redis (necessário para searxng)\n    - frontend\n\n```sh\n./start_services.sh # MacOS\nstart start_services.cmd # Windows\n```\n\nExecute: uv run: `uv run python -m ensurepip` para garantir que o uv tenha o pip ativado.\n\nUse CLI: `uv run cli.py`\n\n---\n\n## Uso\n\nCertifique-se de que os serviços estão funcionando com `./start_services.sh full` e vá para `localhost:3000` para a interface web.\n\nVocê também pode usar fala para texto definindo `listen = True`. Apenas para o modo CLI.\n\nPara sair, basta dizer/digitar `goodbye`.\n\nAlguns exemplos de uso:\n\n> *Faça um jogo da cobra em python!*\n\n> *Pesquise na web os melhores cafés em Rennes, França, e salve uma lista de três com seus endereços em rennes_cafes.txt.*\n\n> *Escreva um programa Go para calcular o fatorial de um número, salve-o como factorial.go em seu workspace*\n\n> *Pesquise na pasta summer_pictures todos os arquivos JPG, renomeie-os com a data de hoje e salve a lista de arquivos renomeados em photos_list.txt*\n\n> *Pesquise online os filmes de ficção científica populares de 2024 e escolha três para assistir esta noite. Salve a lista em movie_night.txt.*\n\n> *Pesquise na web os últimos artigos de notícias sobre IA de 2025, selecione três e escreva um script Python para extrair os títulos e resumos. Salve o script como news_scraper.py e os resumos em ai_news.txt em /home/projects*\n\n> *Sexta-feira, pesquise na web uma API gratuita de preços de ações, inscreva-se com supersuper7434567@gmail.com e escreva um script Python para obter os preços diários da Tesla usando a API, salvando os resultados em stock_prices.csv*\n\n*Observe que o preenchimento de formulários ainda é experimental e pode falhar.*\n\nDepois de inserir sua consulta, o AgenticSeek atribuirá o melhor agente para a tarefa.\n\nComo este é um protótipo inicial, o sistema de roteamento de agentes pode nem sempre atribuir o agente correto à sua consulta.\n\nPortanto, seja muito explícito sobre o que você quer e como a IA pode proceder, por exemplo, se você quiser que ela faça uma pesquisa na web, não diga:\n\n`Você conhece bons países para viajar sozinho?`\n\nEm vez disso, diga:\n\n`Execute uma pesquisa na web e descubra quais são os melhores países para viajar sozinho`\n\n---\n\n## **Configuração para executar LLM em seu próprio servidor**\n\nSe você tem um computador poderoso ou um servidor que pode acessar, mas quer usá-lo do seu laptop, você pode optar por executar o LLM em um servidor remoto usando nosso servidor llm personalizado.\n\nNo seu \"servidor\" que executará o modelo de IA, obtenha o endereço IP\n\n```sh\nip a | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # IP local\ncurl https://ipinfo.io/ip # IP público\n```\n\nNota: Para Windows ou macOS, use ipconfig ou ifconfig para encontrar o endereço IP.\n\nClone o repositório e entre na pasta `server/`.\n\n```sh\ngit clone --depth 1 https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek/llm_server/\n```\n\nInstale os requisitos específicos do servidor:\n\n```sh\npip3 install -r requirements.txt\n```\n\nExecute o script do servidor.\n\n```sh\npython3 app.py --provider ollama --port 3333\n```\n\nVocê pode escolher usar `ollama` e `llamacpp` como serviço LLM.\n\nAgora no seu computador pessoal:\n\nAltere o arquivo `config.ini` para definir `provider_name` como `server` e `provider_model` como `deepseek-r1:xxb`.\nDefina `provider_server_address` como o endereço IP da máquina que executará o modelo.\n\n```sh\n[MAIN]\nis_local = False\nprovider_name = server\nprovider_model = deepseek-r1:70b\nprovider_server_address = http://x.x.x.x:3333\n```\n\nPróxima etapa: [Iniciar os serviços e executar o AgenticSeek](#iniciar-os-serviços-e-executar)  \n\n---\n\n## Fala para Texto\n\nAviso: Fala para texto funciona apenas no modo CLI no momento.\n\nObserve que a fala para texto funciona apenas em inglês no momento.\n\nA funcionalidade de fala para texto está desativada por padrão. Para ativá-la, defina listen como True no arquivo config.ini:\n\n```\nlisten = True\n```\n\nQuando ativada, a funcionalidade de fala para texto ouve uma palavra-chave de gatilho, que é o nome do agente, antes de processar sua entrada. Você pode personalizar o nome do agente atualizando o valor `agent_name` em *config.ini*:\n\n```\nagent_name = Friday\n```\n\nPara melhor reconhecimento, recomendamos usar um nome comum em inglês como \"John\" ou \"Emma\" como nome do agente.\n\nAssim que você vir a transcrição começar a aparecer, diga o nome do agente em voz alta para acordá-lo (ex: \"Friday\").\n\nDiga sua consulta claramente.\n\nTermine sua solicitação com uma frase de confirmação para indicar ao sistema para continuar. Exemplos de frases de confirmação incluem:\n```\n\"do it\", \"go ahead\", \"execute\", \"run\", \"start\", \"thanks\", \"would ya\", \"please\", \"okay?\", \"proceed\", \"continue\", \"go on\", \"do that\", \"go it\", \"do you understand?\"\n```\n\n## Configuração\n\nExemplo de configuração:\n```\n[MAIN]\nis_local = True\nprovider_name = ollama\nprovider_model = deepseek-r1:32b\nprovider_server_address = http://127.0.0.1:11434 # Exemplo Ollama; LM-Studio usa http://127.0.0.1:1234\nagent_name = Friday\nrecover_last_session = False\nsave_session = False\nspeak = False\nlisten = False\n\njarvis_personality = False\nlanguages = en zh # Lista de idiomas para TTS e roteamento potencial.\n[BROWSER]\nheadless_browser = False\nstealth_mode = False\n```\n\n**Explicação das configurações de `config.ini`**:\n\n*   **Seção `[MAIN]`:**\n    *   `is_local`: `True` se você estiver usando provedores de LLM locais (Ollama, LM-Studio, servidor local compatível com OpenAI) ou a opção de servidor auto-hospedado. `False` se você estiver usando APIs baseadas em nuvem (OpenAI, Google, etc.).\n    *   `provider_name`: Especifica o provedor de LLM.\n        *   Opções locais: `ollama`, `lm-studio`, `openai` (para servidor local compatível com OpenAI), `server` (para configuração de servidor auto-hospedado).\n        *   Opções de API: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.\n    *   `provider_model`: Nome ou ID específico do modelo do provedor selecionado (ex: `deepseekcoder:6.7b` para Ollama, `gpt-3.5-turbo` para API OpenAI, `mistralai/Mixtral-8x7B-Instruct-v0.1` para TogetherAI).\n    *   `provider_server_address`: O endereço do seu provedor de LLM.\n        *   Para provedores locais: ex: `http://127.0.0.1:11434` para Ollama, `http://127.0.0.1:1234` para LM-Studio.\n        *   Para o tipo de provedor `server`: O endereço do seu servidor LLM auto-hospedado (ex: `http://your_server_ip:3333`).\n        *   Para APIs em nuvem (`is_local = False`): Isso geralmente é ignorado ou pode ser deixado em branco, pois os endpoints da API são geralmente gerenciados pelas bibliotecas do provedor correspondente.\n    *   `agent_name`: O nome do assistente de IA (ex: Friday). Se ativado, usado como palavra de gatilho para fala para texto.\n    *   `recover_last_session`: `True` para tentar recuperar o estado da sessão anterior, `False` para começar do zero.\n    *   `save_session`: `True` para salvar o estado da sessão atual para possível recuperação, `False` caso contrário.\n    *   `speak`: `True` para ativar a saída de voz de texto para fala, `False` para desativar.\n    *   `listen`: `True` para ativar a entrada de voz de fala para texto (apenas modo CLI), `False` para desativar.\n    *   `work_dir`: **Crítico:** O diretório onde o AgenticSeek lerá/escreverá arquivos. **Certifique-se de que este caminho é válido e acessível no seu sistema.**\n    *   `jarvis_personality`: `True` para usar prompts de sistema mais \"Jarvis-like\" (experimental), `False` para usar prompts padrão.\n    *   `languages`: Lista de idiomas separados por vírgulas (ex: `en, zh, fr`). Usado para seleção de voz TTS (primeira por padrão) e pode ajudar o roteador LLM. Para evitar ineficiências do roteador, evite usar muitos idiomas ou idiomas muito semelhantes.\n*   **Seção `[BROWSER]`:**\n    *   `headless_browser`: `True` para executar o navegador automatizado sem janela visível (recomendado para interface web ou uso não interativo). `False` para exibir a janela do navegador (útil para modo CLI ou depuração).\n    *   `stealth_mode`: `True` para ativar medidas que tornam mais difícil a detecção da automação do navegador. Pode exigir instalação manual de extensões de navegador como anticaptcha.\n\nEsta seção resume os tipos de provedores de LLM suportados. Configure-os em `config.ini`.\n\n**Provedores locais (executando em seu próprio hardware):**\n\n| Nome do provedor em config.ini | `is_local` | Descrição                                                                 | Seção de configuração                                                    |\n|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|\n| `ollama`                      | `True`     | Fornece LLM localmente facilmente usando Ollama.                                             | [Configuração para executar LLM localmente na sua máquina](#configuração-para-executar-llm-localmente-na-sua-máquina) |\n| `lm-studio`                   | `True`     | Fornece LLM localmente com LM-Studio.                                          | [Configuração para executar LLM localmente na sua máquina](#configuração-para-executar-llm-localmente-na-sua-máquina) |\n| `openai` (para servidor local)   | `True`     | Conecte-se a um servidor local expondo uma API compatível com OpenAI (ex: llama.cpp). | [Configuração para executar LLM localmente na sua máquina](#configuração-para-executar-llm-localmente-na-sua-máquina) |\n| `server`                      | `False`    | Conecte-se ao servidor LLM auto-hospedado do AgenticSeek em execução em outra máquina. | [Configuração para executar LLM em seu próprio servidor](#configuração-para-executar-llm-em-seu-próprio-servidor) |\n\n**Provedores de API (baseados em nuvem):**\n\n| Nome do provedor em config.ini | `is_local` | Descrição                                      | Seção de configuração                                       |\n|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|\n| `openai`                      | `False`    | Use a API oficial da OpenAI (ex: GPT-3.5, GPT-4). | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |\n| `google`                      | `False`    | Use os modelos Google Gemini via API.              | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |\n| `deepseek`                    | `False`    | Use a API oficial da Deepseek.                     | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |\n| `huggingface`                 | `False`    | Use Hugging Face Inference API.                  | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |\n| `togetherAI`                  | `False`    | Use vários modelos abertos via API TogetherAI.    | [Configuração para executar com uma API](#configuração-para-executar-com-uma-api) |\n\n---\n## Solução de problemas\n\nSe você encontrar problemas, esta seção fornece orientações.\n\n# Problemas conhecidos\n\n## Problemas do ChromeDriver\n\n**Exemplo de erro:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`\n\n### Causa raiz\nA incompatibilidade de versão do ChromeDriver ocorre quando:\n1. A versão do ChromeDriver que você instalou não corresponde à versão do navegador Chrome\n2. Em ambientes Docker, `undetected_chromedriver` pode baixar sua própria versão do ChromeDriver, contornando os binários montados\n\n### Etapas de solução\n\n#### 1. Verifique sua versão do Chrome\nAbra o Google Chrome → `Configurações > Sobre o Chrome` para encontrar sua versão (ex: \"Versão 134.0.6998.88\")\n\n#### 2. Baixe o ChromeDriver correspondente\n\n**Para Chrome 115 e superior:** Use [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/)\n- Visite o painel de disponibilidade do Chrome for Testing\n- Encontre sua versão do Chrome ou a correspondência disponível mais próxima\n- Baixe o ChromeDriver para seu sistema operacional (use Linux64 para ambientes Docker)\n\n**Para versões mais antigas do Chrome:** Use [Downloads legados do ChromeDriver](https://chromedriver.chromium.org/downloads)\n\n![Baixar ChromeDriver do Chrome for Testing](./media/chromedriver_readme.png)\n\n#### 3. Instale o ChromeDriver (escolha um método)\n\n**Método A: Diretório raiz do projeto (recomendado para Docker)**\n```bash\n# Coloque o binário chromedriver baixado no diretório raiz do projeto\ncp path/to/downloaded/chromedriver ./chromedriver\nchmod +x ./chromedriver  # Torne-o executável no Linux/macOS\n```\n\n**Método B: PATH do sistema**\n```bash\n# Linux/macOS\nsudo mv chromedriver /usr/local/bin/\nsudo chmod +x /usr/local/bin/chromedriver\n\n# Windows: Coloque chromedriver.exe em uma pasta do PATH\n```\n\n#### 4. Verifique a instalação\n```bash\n# Teste a versão do ChromeDriver\n./chromedriver --version\n# Ou se estiver no PATH:\nchromedriver --version\n```\n\n### Instruções específicas do Docker\n\n⚠️ **Importante para usuários do Docker:**\n- O método de montagem de volumes do Docker pode não funcionar com o modo furtivo (`undetected_chromedriver`)\n- **Solução:** Coloque o ChromeDriver no diretório raiz do projeto como `./chromedriver`\n- O aplicativo o detectará automaticamente e usará este binário\n- Você deve ver nos logs: `\"Using ChromeDriver from project root: ./chromedriver\"`\n\n### Dicas de solução de problemas\n\n1. **Ainda há incompatibilidade de versão?**\n   - Verifique se o ChromeDriver é executável: `ls -la ./chromedriver`\n   - Verifique a versão do ChromeDriver: `./chromedriver --version`\n   - Certifique-se de que corresponde à versão do seu navegador Chrome\n\n2. **Problemas com o contêiner Docker?**\n   - Verifique os logs do backend: `docker logs backend`\n   - Procure a mensagem: `\"Using ChromeDriver from project root\"`\n   - Se não for encontrado, verifique se o arquivo existe e é executável\n\n3. **Versões do Chrome for Testing**\n   - Use uma correspondência exata quando possível\n   - Para a versão 134.0.6998.88, use o ChromeDriver 134.0.6998.165 (a versão disponível mais próxima)\n   - O número da versão principal deve corresponder (134 = 134)\n\n### Matriz de compatibilidade de versões\n\n| Versão do Chrome | Versão do ChromeDriver | Status |\n|----------------|---------------------|---------|\n| 134.0.6998.x   | 134.0.6998.165     | ✅ Disponível |\n| 133.0.6943.x   | 133.0.6943.141     | ✅ Disponível |\n| 132.0.6834.x   | 132.0.6834.159     | ✅ Disponível |\n\n*Para a compatibilidade mais recente, consulte o [Painel do Chrome for Testing](https://googlechromelabs.github.io/chrome-for-testing/)*\n\n`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113\nCurrent browser version is 134.0.6998.89 with binary path`\n\nIsso acontece se seu navegador e a versão do chromedriver não corresponderem.\n\nVocê precisa navegar para baixar a versão mais recente:\n\nhttps://developer.chrome.com/docs/chromedriver/downloads\n\nSe você estiver usando o Chrome versão 115 ou superior, vá para:\n\nhttps://googlechromelabs.github.io/chrome-for-testing/\n\ne baixe a versão do chromedriver correspondente ao seu sistema operacional.\n\n![alt text](./media/chromedriver_readme.png)\n\nSe esta seção estiver incompleta, abra um issue.\n\n##  Problemas de adaptadores de conexão\n\n```\nException: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (nota: a porta pode variar)\n```\n\n*   **Causa:** Falta o prefixo `http://` em `provider_server_address` para `lm-studio` (ou outro servidor local compatível com OpenAI semelhante) no `config.ini`, ou ele aponta para a porta errada.\n*   **Solução:**\n    *   Certifique-se de que o endereço inclui `http://`. O LM-Studio geralmente usa `http://127.0.0.1:1234` por padrão.\n    *   `config.ini` correto: `provider_server_address = http://127.0.0.1:1234` (ou sua porta real do servidor LM-Studio).\n\n## URL base do SearxNG não fornecida\n\n```\nraise ValueError(\"SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.\")\nValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`\n```\n\nIsso pode acontecer se você executar o modo CLI com uma URL base do searxng incorreta.\n\nSEARXNG_BASE_URL deve diferir dependendo se você está executando no Docker ou no host:\n\n**Execução no host:** `SEARXNG_BASE_URL=\"http://localhost:8080\"`\n\n**Execução completamente no Docker (interface web):** `SEARXNG_BASE_URL=\"http://searxng:8080\"`\n\n## FAQ\n\n**P: De qual hardware eu preciso?**  \n\n| Tamanho do modelo  | GPU  | Comentários                                               |\n|-----------|--------|-----------------------------------------------------------|\n| 7B        | 8GB VRAM | ⚠️ Não recomendado. Desempenho ruim, alucinações frequentes, agentes de planejamento podem falhar. |\n| 14B        | 12 GB VRAM (ex: RTX 3060) | ✅ Utilizável para tarefas simples. Pode ter dificuldades com navegação web e planejamento de tarefas. |\n| 32B        | 24+ GB VRAM (ex: RTX 4090) | 🚀 Consegue a maioria das tarefas, ainda pode ter dificuldades com planejamento de tarefas |\n| 70B+        | 48+ GB VRAM | 💪 Excelente. Recomendado para casos de uso avançados. |\n\n**P: O que fazer se eu encontrar erros?**  \n\nCertifique-se de que o local está funcionando (`ollama serve`), que seu `config.ini` corresponde ao seu provedor e que as dependências estão instaladas. Se nada funcionar, sinta-se à vontade para abrir um issue.\n\n**P: Ele pode realmente funcionar 100% localmente?**  \n\nSim, com os provedores Ollama, lm-studio ou server, todos os modelos de fala para texto, LLM e texto para fala funcionam localmente. As opções não locais (OpenAI ou outras APIs) são opcionais.\n\n**P: Por que eu deveria usar o AgenticSeek quando tenho o Manus?**\n\nAo contrário do Manus, o AgenticSeek prioriza a independência de sistemas externos, dando a você mais controle, privacidade e evitando custos de API.\n\n**P: Quem está por trás deste projeto?**\n\nEste projeto foi criado por mim, com dois amigos como mantenedores e contribuidores da comunidade de código aberto no GitHub. Somos apenas indivíduos apaixonados, não uma startup, nem afiliados a qualquer organização.\n\nQualquer conta AgenticSeek no X diferente da minha conta pessoal (https://x.com/Martin993886460) é um impostor.\n\n## Contribuir\n\nEstamos procurando desenvolvedores para melhorar o AgenticSeek! Verifique os problemas abertos ou discussões.\n\n[Guia de contribuição](./docs/CONTRIBUTING.md)\n\n## Patrocinadores:\n\nVocê quer melhorar as capacidades do AgenticSeek com recursos como pesquisa de voos, planejamento de viagens ou obtenção das melhores ofertas de compra? Considere usar o SerpApi para criar ferramentas personalizadas que desbloqueiem mais recursos do tipo Jarvis. Com o SerpApi, você pode acelerar seu agente para tarefas profissionais enquanto mantém o controle total.\n\n<a href=\"https://serpapi.com/\"><img src=\"./media/banners/sponsor_banner_serpapi.png\" height=\"350\" alt=\"SerpApi Banner\" ></a>\n\nConfira [Contributing.md](./docs/CONTRIBUTING.md) para aprender como integrar ferramentas personalizadas!\n\n### **Patrocinadores**:\n\n- [tatra-labs](https://github.com/tatra-labs)\n\n## Mantenedores:\n\n > [Fosowl](https://github.com/Fosowl) | Horário de Paris \n\n > [antoineVIVIES](https://github.com/antoineVIVIES) | Horário de Taipei \n\n## Agradecimentos especiais:\n\n > [tcsenpai](https://github.com/tcsenpai) e [plitc](https://github.com/plitc) por ajudar na dockerização do backend\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)\n"
  },
  {
    "path": "README_TR.md",
    "content": "# AgenticSeek: Gizlilik Odaklı, Yerel Manus Alternatifi\n\n<p align=\"center\">\n<img align=\"center\" src=\"./media/agentic_seek_logo.png\" width=\"300\" height=\"300\" alt=\"Agentic Seek Logo\">\n<p>\n\n  English | [中文](./README_CHS.md) | [繁體中文](./README_CHT.md) | [Français](./README_FR.md) | [日本語](./README_JP.md) | [Português (Brasil)](./README_PTBR.md) | [Español](./README_ES.md) | [Türkçe](./README_TR.md)\n\n*Sesli komut destekli bu yapay zeka asistanı, **Manus AI'ya %100 yerel bir alternatiftir**. Web'de otonom olarak gezinir, kod yazar ve görevleri planlar; tüm verilerinizi cihazınızda tutar. Yerel akıl yürütme modelleri için tasarlanmış olup tamamen kendi donanımınızda çalışır, eksiksiz gizlilik ve sıfır bulut bağımlılığı sağlar.*\n\n[![AgenticSeek'i Ziyaret Et](https://img.shields.io/static/v1?label=Website&message=AgenticSeek&color=blue&style=flat-square)](https://fosowl.github.io/agenticSeek.html) ![License](https://img.shields.io/badge/license-GPL--3.0-green) [![Discord](https://img.shields.io/badge/Discord-Join%20Us-7289DA?logo=discord&logoColor=white)](https://discord.gg/8hGDaME3TC) [![Twitter](https://img.shields.io/twitter/url/https/twitter.com/fosowl.svg?style=social&label=Update%20%40Fosowl)](https://x.com/Martin993886460) [![GitHub stars](https://img.shields.io/github/stars/Fosowl/agenticSeek?style=social)](https://github.com/Fosowl/agenticSeek/stargazers)\n\n### Neden AgenticSeek?\n\n* 🔒 Tamamen Yerel ve Gizli - Her şey kendi makinenizde çalışır — bulut yok, veri paylaşımı yok. Dosyalarınız, konuşmalarınız ve aramalarınız gizli kalır.\n\n* 🌐 Akıllı Web Tarama - AgenticSeek internette kendi başına gezinebilir — arama yapar, okur, bilgi çıkarır, web formlarını doldurur — tamamen eller serbest.\n\n* 💻 Otonom Kodlama Asistanı - Koda mı ihtiyacınız var? Python, C, Go, Java ve daha fazlasında program yazabilir, hata ayıklayabilir ve çalıştırabilir — denetim olmadan.\n\n* 🧠 Akıllı Ajan Seçimi - Siz sorarsınız, o otomatik olarak iş için en uygun ajanı belirler. Elinizin altında uzmanlardan oluşan bir ekip gibi.\n\n* 📋 Karmaşık Görevleri Planlar ve Yürütür - Seyahat planlamasından karmaşık projelere kadar — büyük görevleri adımlara bölebilir ve birden fazla yapay zeka ajanı kullanarak işleri tamamlayabilir.\n\n* 🎙️ Ses Desteği - Temiz, hızlı, fütüristik ses ve konuşmadan metne dönüştürme ile bilim kurgu filmlerindeki kişisel yapay zekanızla konuşuyormuş gibi etkileşim kurabilirsiniz. (Geliştirme aşamasında)\n\n### **Demo**\n\n> *AgenticSeek projesini arayabilir misin, hangi becerilerin gerektiğini öğrenip ardından CV_candidates.zip dosyasını açarak projeye en uygun adayları söyleyebilir misin?*\n\nhttps://github.com/user-attachments/assets/b8ca60e9-7b3b-4533-840e-08f9ac426316\n\nUyarı: Bu demo ve görünen tüm dosyalar (ör: CV_candidates.zip) tamamen kurgusaldır. Bir şirket değiliz, aday değil açık kaynak katkıda bulunanlar arıyoruz.\n\n> 🛠⚠️️ **Aktif Olarak Geliştirilmektedir**\n\n> 🙏 Bu proje bir yan proje olarak başladı ve sıfır yol haritası, sıfır finansmanla geliştirilmektedir. GitHub Trending'e girerek beklentilerin çok ötesine geçti. Katkılar, geri bildirimler ve sabır derinden takdir edilmektedir.\n\n## Ön Gereksinimler\n\nBaşlamadan önce aşağıdaki yazılımların yüklü olduğundan emin olun:\n\n*   **Git:** Depoyu klonlamak için. [Git İndir](https://git-scm.com/downloads)\n*   **Python 3.10.x:** Python 3.10.x sürümünü kullanmanızı şiddetle tavsiye ederiz. Diğer sürümler bağımlılık hatalarına yol açabilir. [Python 3.10 İndir](https://www.python.org/downloads/release/python-3100/) (3.10.x sürümünü seçin).\n*   **Docker Engine ve Docker Compose:** SearxNG gibi paketlenmiş servisleri çalıştırmak için.\n    *   Docker Desktop yükleyin (Docker Compose V2 dahildir): [Windows](https://docs.docker.com/desktop/install/windows-install/) | [Mac](https://docs.docker.com/desktop/install/mac-install/) | [Linux](https://docs.docker.com/desktop/install/linux-install/)\n    *   Alternatif olarak, Linux üzerinde Docker Engine ve Docker Compose'u ayrı ayrı yükleyin: [Docker Engine](https://docs.docker.com/engine/install/) | [Docker Compose](https://docs.docker.com/compose/install/) (Compose V2 yüklediğinizden emin olun, ör: `sudo apt-get install docker-compose-plugin`).\n\n### 1. **Depoyu klonlayın ve kurulumu yapın**\n\n```sh\ngit clone https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek\nmv .env.example .env\n```\n\n### 2. .env dosyasının içeriğini değiştirin\n\n```sh\nSEARXNG_BASE_URL=\"http://searxng:8080\" # CLI modunda çalıştırıyorsanız http://127.0.0.1:8080 kullanın\nREDIS_BASE_URL=\"redis://redis:6379/0\"\nWORK_DIR=\"/Users/mlg/Documents/workspace_for_ai\"\nOLLAMA_PORT=\"11434\"\nLM_STUDIO_PORT=\"1234\"\nCUSTOM_ADDITIONAL_LLM_PORT=\"11435\"\nOPENAI_API_KEY='optional'\nDEEPSEEK_API_KEY='optional'\nOPENROUTER_API_KEY='optional'\nTOGETHER_API_KEY='optional'\nGOOGLE_API_KEY='optional'\nANTHROPIC_API_KEY='optional'\n```\n\n`.env` dosyasını ihtiyaçlarınıza göre güncelleyin:\n\n- **SEARXNG_BASE_URL**: CLI modunda çalışmıyorsanız değiştirmeyin.\n- **REDIS_BASE_URL**: Değiştirmeyin.\n- **WORK_DIR**: Yerel makinenizdeki çalışma dizininin yolu. AgenticSeek bu dosyaları okuyabilir ve onlarla etkileşim kurabilir.\n- **OLLAMA_PORT**: Ollama servisi için port numarası.\n- **LM_STUDIO_PORT**: LM Studio servisi için port numarası.\n- **CUSTOM_ADDITIONAL_LLM_PORT**: Ek özel LLM servisi için port.\n\n**API anahtarları, LLM'yi yerel olarak çalıştırmayı tercih eden kullanıcılar için tamamen isteğe bağlıdır. Bu projenin birincil amacı da budur. Yeterli donanımınız varsa boş bırakın.**\n\n### 3. **Docker'ı Başlatın**\n\nDocker'ın sisteminizde yüklü ve çalışır durumda olduğundan emin olun. Docker'ı aşağıdaki komutlarla başlatabilirsiniz:\n\n- **Linux/macOS:**\n    Terminal açın ve çalıştırın:\n    ```sh\n    sudo systemctl start docker\n    ```\n    Veya yüklüyse Docker Desktop'ı uygulama menüsünden başlatın.\n\n- **Windows:**\n    Başlat menüsünden Docker Desktop'ı başlatın.\n\nDocker'ın çalıştığını doğrulamak için:\n```sh\ndocker info\n```\nDocker kurulumunuz hakkında bilgi görüyorsanız, düzgün çalışıyor demektir.\n\nÖzet için aşağıdaki [Yerel Sağlayıcılar](#yerel-sağlayıcılar-listesi) tablosuna bakın.\n\nSonraki adım: [AgenticSeek'i yerel olarak çalıştırın](#servisleri-başlatın-ve-çalıştırın)\n\n*Sorun yaşıyorsanız [Sorun Giderme](#sorun-giderme) bölümüne bakın.*\n*Donanımınız LLM'leri yerel olarak çalıştıramıyorsa [API ile Çalıştırma Kurulumu](#api-ile-çalıştırma-kurulumu) bölümüne bakın.*\n*Ayrıntılı `config.ini` açıklamaları için [Yapılandırma](#yapılandırma) bölümüne bakın.*\n\n---\n\n## LLM'yi Makinenizde Yerel Olarak Çalıştırma Kurulumu\n\n**Donanım Gereksinimleri:**\n\nLLM'leri yerel olarak çalıştırmak için yeterli donanıma ihtiyacınız olacaktır. En azından Magistral, Qwen veya Deepseek 14B çalıştırabilecek bir GPU gereklidir. Ayrıntılı model/performans önerileri için SSS bölümüne bakın.\n\n**Yerel sağlayıcınızı ayarlayın**\n\nYerel sağlayıcınızı başlatın (örneğin ollama ile):\n\nAgenticSeek'i ana makinede (CLI modu) çalıştırmayacaksanız, sağlayıcı dinleme adresini ayarlayın:\n\n```sh\nexport OLLAMA_HOST=0.0.0.0:11434\n```\n\nArdından sağlayıcınızı başlatın:\n\n```sh\nollama serve\n```\n\nDesteklenen yerel sağlayıcıların listesi için aşağıya bakın.\n\n**config.ini dosyasını güncelleyin**\n\nconfig.ini dosyasında provider_name'i desteklenen bir sağlayıcıya ve provider_model'i sağlayıcınızın desteklediği bir LLM'e ayarlayın. *Magistral* veya *Deepseek* gibi akıl yürütme modellerini öneriyoruz.\n\nGerekli donanım için README sonundaki **SSS** bölümüne bakın.\n\n```sh\n[MAIN]\nis_local = True # Yerel mi yoksa uzak sağlayıcı ile mi çalıştırıyorsunuz.\nprovider_name = ollama # veya lm-studio, openai, vb.\nprovider_model = deepseek-r1:14b # donanımınıza uygun bir model seçin\nprovider_server_address = 127.0.0.1:11434\nagent_name = Jarvis # yapay zekanızın adı\nrecover_last_session = True # önceki oturumu kurtarıp kurtarmayacağı\nsave_session = True # mevcut oturumu hatırlayıp hatırlamayacağı\nspeak = False # metinden sese dönüştürme\nlisten = False # sesten metne dönüştürme, yalnızca CLI için, deneysel\njarvis_personality = False # daha \"Jarvis\" benzeri bir kişilik kullanıp kullanmayacağı (deneysel)\nlanguages = en zh # Dil listesi, metinden sese varsayılan olarak listedeki ilk dili kullanır\n[BROWSER]\nheadless_browser = True # CLI modunda değilseniz değiştirmeyin.\nstealth_mode = True # Tarayıcı algılamasını azaltmak için gizli selenium kullanır\n```\n\n**Uyarı**:\n\n- `config.ini` dosya biçimi yorum satırlarını desteklemez.\nÖrnek yapılandırmayı doğrudan kopyalayıp yapıştırmayın, çünkü yorum satırları hatalara neden olur. Bunun yerine `config.ini` dosyasını yorum satırları olmadan istediğiniz ayarlarla manuel olarak düzenleyin.\n\n- LLM çalıştırmak için LM-studio kullanıyorsanız provider_name'i `openai` olarak *AYARLAMAYIN*. `lm-studio` olarak ayarlayın.\n\n- Bazı sağlayıcılar (ör: lm-studio) IP'nin önünde `http://` gerektirir. Örneğin: `http://127.0.0.1:1234`\n\n**Yerel Sağlayıcılar Listesi**\n\n| Sağlayıcı  | Yerel mi? | Açıklama                                               |\n|-----------|--------|-----------------------------------------------------------|\n| ollama    | Evet    | Ollama kullanarak LLM'leri kolayca yerel olarak çalıştırın |\n| lm-studio  | Evet    | LM Studio ile LLM'leri yerel olarak çalıştırın (`provider_name` değerini `lm-studio` olarak ayarlayın)|\n| openai    | Evet     |  OpenAI uyumlu API kullanın (ör: llama.cpp sunucusu)  |\n\nSonraki adım: [Servisleri başlatın ve AgenticSeek'i çalıştırın](#servisleri-başlatın-ve-çalıştırın)\n\n*Sorun yaşıyorsanız [Sorun Giderme](#sorun-giderme) bölümüne bakın.*\n*Donanımınız LLM'leri yerel olarak çalıştıramıyorsa [API ile Çalıştırma Kurulumu](#api-ile-çalıştırma-kurulumu) bölümüne bakın.*\n*Ayrıntılı `config.ini` açıklamaları için [Yapılandırma](#yapılandırma) bölümüne bakın.*\n\n## API ile Çalıştırma Kurulumu\n\nBu kurulum harici, bulut tabanlı LLM sağlayıcılarını kullanır. Seçtiğiniz servisten bir API anahtarına ihtiyacınız olacaktır.\n\n**1. Bir API Sağlayıcısı Seçin ve API Anahtarı Alın:**\n\nAşağıdaki [API Sağlayıcıları Listesi](#api-sağlayıcıları-listesi) bölümüne bakın. Kaydolmak ve API anahtarı almak için web sitelerini ziyaret edin.\n\n**2. API Anahtarınızı Ortam Değişkeni Olarak Ayarlayın:**\n\n*   **Linux/macOS:**\n    Terminal açın ve `export` komutunu kullanın. Kalıcılık için bunu shell profil dosyanıza (ör: `~/.bashrc`, `~/.zshrc`) eklemeniz önerilir.\n    ```sh\n    export PROVIDER_API_KEY=\"api_anahtarınız\"\n    # PROVIDER_API_KEY'i ilgili değişken adıyla değiştirin, ör: OPENAI_API_KEY, GOOGLE_API_KEY\n    ```\n    TogetherAI örneği:\n    ```sh\n    export TOGETHER_API_KEY=\"xxxxxxxxxxxxxxxxxxxxxx\"\n    ```\n*   **Windows:**\n    *   **Komut İstemi (Geçerli oturum için geçici):**\n        ```cmd\n        set PROVIDER_API_KEY=api_anahtarınız\n        ```\n    *   **PowerShell (Geçerli oturum için geçici):**\n        ```powershell\n        $env:PROVIDER_API_KEY=\"api_anahtarınız\"\n        ```\n    *   **Kalıcı:** Windows arama çubuğunda \"ortam değişkenleri\" arayın, \"Sistem ortam değişkenlerini düzenle\" seçeneğine tıklayın, ardından \"Ortam Değişkenleri...\" düğmesine tıklayın. Uygun adla (ör: `OPENAI_API_KEY`) yeni bir Kullanıcı değişkeni ekleyin ve değer olarak anahtarınızı girin.\n\n    *(Daha fazla ayrıntı için SSS: [API anahtarlarını nasıl ayarlarım?](#api-anahtarlarını-nasıl-ayarlarım) bölümüne bakın.)*\n\n\n**3. `config.ini` Dosyasını Güncelleyin:**\n```ini\n[MAIN]\nis_local = False\nprovider_name = openai # Veya google, deepseek, togetherAI, huggingface\nprovider_model = gpt-3.5-turbo # Veya gemini-1.5-flash, deepseek-chat, mistralai/Mixtral-8x7B-Instruct-v0.1 vb.\nprovider_server_address = # is_local = False olduğunda çoğu API için genellikle yok sayılır veya boş bırakılabilir\n# ... diğer ayarlar ...\n```\n*Uyarı:* config.ini değerlerinin sonunda boşluk olmadığından emin olun.\n\n**API Sağlayıcıları Listesi**\n\n| Sağlayıcı     | `provider_name` | Yerel mi? | Açıklama                                       | API Anahtarı Bağlantısı (Örnekler)                     |\n|--------------|-----------------|--------|---------------------------------------------------|---------------------------------------------|\n| OpenAI       | `openai`        | Hayır     | OpenAI API'si üzerinden ChatGPT modellerini kullanın.              | [platform.openai.com/signup](https://platform.openai.com/signup) |\n| Google Gemini| `google`        | Hayır     | Google AI Studio üzerinden Google Gemini modellerini kullanın.    | [aistudio.google.com/keys](https://aistudio.google.com/keys) |\n| Deepseek     | `deepseek`      | Hayır     | Deepseek API'si üzerinden Deepseek modellerini kullanın.                | [platform.deepseek.com](https://platform.deepseek.com) |\n| Hugging Face | `huggingface`   | Hayır     | Hugging Face Inference API'den modelleri kullanın.       | [huggingface.co/settings/tokens](https://huggingface.co/settings/tokens) |\n| TogetherAI   | `togetherAI`    | Hayır     | TogetherAI API'si üzerinden çeşitli açık kaynak modelleri kullanın.| [api.together.ai/settings/api-keys](https://api.together.ai/settings/api-keys) |\n| OpenRouter   | `openrouter`    | Hayır     | OpenRouter Modellerini kullanın| [https://openrouter.ai/](https://openrouter.ai/) |\n\n*Not:*\n*   Karmaşık web tarama ve görev planlama için `gpt-4o` veya diğer OpenAI modellerini kullanmanızı önermiyoruz, çünkü mevcut prompt optimizasyonları Deepseek gibi modellere yöneliktir.\n*   Kodlama/bash görevleri Gemini ile sorun yaşayabilir, çünkü Deepseek için optimize edilmiş biçimlendirme talimatlarına kesinlikle uymayabilir.\n*   `is_local = False` olduğunda `config.ini` içindeki `provider_server_address` genellikle kullanılmaz, çünkü API uç noktaları genellikle ilgili sağlayıcı kütüphanesinde sabit kodlanmıştır.\n\nSonraki adım: [Servisleri başlatın ve AgenticSeek'i çalıştırın](#servisleri-başlatın-ve-çalıştırın)\n\n*Sorun yaşıyorsanız **Bilinen Sorunlar** bölümüne bakın*\n\n*Ayrıntılı yapılandırma dosyası açıklamaları için **Yapılandırma** bölümüne bakın.*\n\n---\n\n## Servisleri Başlatın ve Çalıştırın\n\nVarsayılan olarak AgenticSeek tamamen Docker içinde çalıştırılır.\n\n**Seçenek 1:** Docker'da çalıştırın, web arayüzünü kullanın:\n\nGerekli servisleri başlatın. Bu, docker-compose.yml'deki tüm servisleri başlatacaktır:\n    - searxng\n    - redis (searxng için gerekli)\n    - frontend\n    - backend (web arayüzü kullanırken `full` parametresi ile)\n\n```sh\n./start_services.sh full # MacOS\nstart start_services.cmd full # Windows\n```\n\n**Uyarı:** Bu adım tüm Docker imajlarını indirip yükleyecektir, bu işlem 30 dakikaya kadar sürebilir. Servisleri başlattıktan sonra, herhangi bir mesaj göndermeden önce backend servisinin tamamen çalışır duruma gelmesini bekleyin (loglarda **backend: \"GET /health HTTP/1.1\" 200 OK** mesajını görmelisiniz). İlk çalıştırmada backend servisinin başlaması 5 dakika sürebilir.\n\n`http://localhost:3000/` adresine gidin ve web arayüzünü görmelisiniz.\n\n*Servis başlatma sorun giderme:* Bu betikler başarısız olursa, Docker Engine'in çalıştığından ve Docker Compose'un (V2, `docker compose`) doğru şekilde yüklendiğinden emin olun. Hata mesajları için terminal çıktısını kontrol edin. Bkz. [SSS: AgenticSeek'i veya betiklerini çalıştırırken hata alıyorum.](#sss-sorun-giderme)\n\n**Seçenek 2:** CLI modu:\n\nCLI arayüzü ile çalıştırmak için paketleri ana makineye yüklemeniz gerekir:\n\n```sh\n./install.sh\n./install.bat # windows\n```\n\nArdından `config.ini` içindeki SEARXNG_BASE_URL değerini şu şekilde değiştirmelisiniz:\n\n```sh\nSEARXNG_BASE_URL=\"http://localhost:8080\"\n```\n\nGerekli servisleri başlatın. Bu, docker-compose.yml'deki bazı servisleri başlatacaktır:\n    - searxng\n    - redis (searxng için gerekli)\n    - frontend\n\n```sh\n./start_services.sh # MacOS\nstart start_services.cmd # Windows\n```\n\nÇalıştırın: `uv run python -m ensurepip` komutu ile uv'nin pip'i etkin olduğundan emin olun.\n\nCLI'yi kullanın: `uv run cli.py`\n\n---\n\n## Kullanım\n\nServislerin `./start_services.sh full` ile çalıştığından emin olun ve web arayüzü için `localhost:3000` adresine gidin.\n\nYapılandırmada `listen = True` ayarlayarak konuşmadan metne dönüştürmeyi de kullanabilirsiniz. Yalnızca CLI modu için.\n\nÇıkmak için `goodbye` yazın/söyleyin.\n\nİşte bazı kullanım örnekleri:\n\n> *Python'da bir yılan oyunu yap!*\n\n> *Rennes, Fransa'daki en iyi kafeleri internette ara ve adres bilgileriyle birlikte üçünü rennes_cafes.txt dosyasına kaydet.*\n\n> *Bir sayının faktöriyelini hesaplayan bir Go programı yaz, çalışma alanına factorial.go olarak kaydet*\n\n> *summer_pictures klasöründeki tüm JPG dosyalarını ara, bugünün tarihiyle yeniden adlandır ve yeniden adlandırılan dosyaların listesini photos_list.txt dosyasına kaydet*\n\n> *2024'ün popüler bilim kurgu filmlerini internette ara ve bu gece izlemek için üçünü seç. Listeyi movie_night.txt dosyasına kaydet.*\n\n> *2025'in en son yapay zeka haberleri makalelerini internette ara, üçünü seç ve başlıklarını ve özetlerini kazımak için bir Python betiği yaz. Betiği news_scraper.py olarak ve özetleri /home/projects içinde ai_news.txt olarak kaydet*\n\n> *Cuma, internette ücretsiz bir hisse senedi fiyat API'si ara, supersuper7434567@gmail.com ile kaydol ve ardından API'yi kullanarak Tesla'nın günlük fiyatlarını çekmek için bir Python betiği yaz, sonuçları stock_prices.csv dosyasına kaydet*\n\n*Form doldurma yeteneklerinin hâlâ deneysel olduğunu ve başarısız olabileceğini unutmayın.*\n\nSorgunuzu yazdıktan sonra AgenticSeek göreve en uygun ajanı atayacaktır.\n\nBu erken bir prototip olduğundan, ajan yönlendirme sistemi sorgunuza göre her zaman doğru ajanı atamayabilir.\n\nBu nedenle, ne istediğiniz ve yapay zekanın nasıl ilerlemesi gerektiği konusunda çok açık olun. Örneğin, web araması yapmasını istiyorsanız şunu demeyin:\n\n`Solo seyahat için iyi ülkeler biliyor musun?`\n\nBunun yerine şöyle sorun:\n\n`Web araması yap ve solo seyahat için en iyi ülkeleri bul`\n\n---\n\n## **LLM'yi Kendi Sunucunuzda Çalıştırma Kurulumu**\n\nGüçlü bir bilgisayarınız veya kullanabileceğiniz bir sunucunuz varsa, ancak dizüstü bilgisayarınızdan kullanmak istiyorsanız, özel LLM sunucumuzu kullanarak LLM'yi uzak bir sunucuda çalıştırma seçeneğiniz vardır.\n\nYapay zeka modelini çalıştıracak \"sunucunuzda\" IP adresini alın\n\n```sh\nip a | grep \"inet \" | grep -v 127.0.0.1 | awk '{print $2}' | cut -d/ -f1 # yerel IP\ncurl https://ipinfo.io/ip # genel IP\n```\n\nNot: Windows veya macOS için IP adresini bulmak üzere sırasıyla ipconfig veya ifconfig kullanın.\n\nDepoyu klonlayın ve `server/` klasörüne girin.\n\n```sh\ngit clone --depth 1 https://github.com/Fosowl/agenticSeek.git\ncd agenticSeek/llm_server/\n```\n\nSunucuya özel gereksinimleri yükleyin:\n\n```sh\npip3 install -r requirements.txt\n```\n\nSunucu betiğini çalıştırın.\n\n```sh\npython3 app.py --provider ollama --port 3333\n```\n\nLLM servisi olarak `ollama` veya `llamacpp` arasında seçim yapabilirsiniz.\n\nŞimdi kişisel bilgisayarınızda:\n\n`config.ini` dosyasında `provider_name` değerini `server` ve `provider_model` değerini `deepseek-r1:xxb` olarak ayarlayın.\n`provider_server_address` değerini modeli çalıştıracak makinenin IP adresine ayarlayın.\n\n```sh\n[MAIN]\nis_local = False\nprovider_name = server\nprovider_model = deepseek-r1:70b\nprovider_server_address = http://x.x.x.x:3333\n```\n\nSonraki adım: [Servisleri başlatın ve AgenticSeek'i çalıştırın](#servisleri-başlatın-ve-çalıştırın)\n\n---\n\n## Konuşmadan Metne\n\nUyarı: Konuşmadan metne özelliği şu anda yalnızca CLI modunda çalışmaktadır.\n\nKonuşmadan metne özelliğinin şu anda yalnızca İngilizce dilinde çalıştığını lütfen unutmayın.\n\nKonuşmadan metne işlevi varsayılan olarak devre dışıdır. Etkinleştirmek için config.ini dosyasında listen seçeneğini True olarak ayarlayın:\n\n```\nlisten = True\n```\n\nEtkinleştirildiğinde, konuşmadan metne özelliği girdinizi işlemeye başlamadan önce bir tetikleyici anahtar kelimeyi (ajanın adı) dinler. Ajanın adını *config.ini* dosyasındaki `agent_name` değerini güncelleyerek özelleştirebilirsiniz:\n\n```\nagent_name = Friday\n```\n\nEn iyi tanıma performansı için ajan adı olarak \"John\" veya \"Emma\" gibi yaygın bir İngilizce isim kullanmanızı öneririz.\n\nTranskript görünmeye başladığında, uyandırmak için ajanın adını yüksek sesle söyleyin (ör: \"Friday\").\n\nSorgunuzu net bir şekilde söyleyin.\n\nSisteme devam etmesi gerektiğini bildirmek için isteğinizi bir onay ifadesiyle bitirin. Onay ifadesi örnekleri:\n```\n\"do it\", \"go ahead\", \"execute\", \"run\", \"start\", \"thanks\", \"would ya\", \"please\", \"okay?\", \"proceed\", \"continue\", \"go on\", \"do that\", \"go it\", \"do you understand?\"\n```\n\n## Yapılandırma\n\nÖrnek yapılandırma:\n```\n[MAIN]\nis_local = True\nprovider_name = ollama\nprovider_model = deepseek-r1:32b\nprovider_server_address = http://127.0.0.1:11434 # Ollama örneği; LM-Studio için http://127.0.0.1:1234 kullanın\nagent_name = Friday\nrecover_last_session = False\nsave_session = False\nspeak = False\nlisten = False\n\njarvis_personality = False\nlanguages = en zh # TTS ve potansiyel yönlendirme için dil listesi.\n[BROWSER]\nheadless_browser = False\nstealth_mode = False\n```\n\n**`config.ini` Ayarlarının Açıklaması**:\n\n*   **`[MAIN]` Bölümü:**\n    *   `is_local`: Yerel LLM sağlayıcısı (Ollama, LM-Studio, yerel OpenAI uyumlu sunucu) veya kendi barındırdığınız sunucu seçeneğini kullanıyorsanız `True`. Bulut tabanlı API (OpenAI, Google, vb.) kullanıyorsanız `False`.\n    *   `provider_name`: LLM sağlayıcısını belirtir.\n        *   Yerel seçenekler: `ollama`, `lm-studio`, `openai` (yerel OpenAI uyumlu sunucular için), `server` (kendi barındırdığınız sunucu kurulumu için).\n        *   API seçenekleri: `openai`, `google`, `deepseek`, `huggingface`, `togetherAI`.\n    *   `provider_model`: Seçilen sağlayıcı için belirli model adı veya kimliği (ör: Ollama için `deepseekcoder:6.7b`, OpenAI API için `gpt-3.5-turbo`, TogetherAI için `mistralai/Mixtral-8x7B-Instruct-v0.1`).\n    *   `provider_server_address`: LLM sağlayıcınızın adresi.\n        *   Yerel sağlayıcılar için: ör: Ollama için `http://127.0.0.1:11434`, LM-Studio için `http://127.0.0.1:1234`.\n        *   `server` sağlayıcı türü için: Kendi barındırdığınız LLM sunucunuzun adresi (ör: `http://sunucu_ip_adresiniz:3333`).\n        *   Bulut API'leri (`is_local = False`) için: Genellikle yok sayılır veya boş bırakılabilir, çünkü API uç noktası genellikle istemci kütüphanesi tarafından işlenir.\n    *   `agent_name`: Yapay zeka asistanının adı (ör: Friday). Etkinleştirilmişse konuşmadan metne için tetikleyici kelime olarak kullanılır.\n    *   `recover_last_session`: Önceki oturumun durumunu kurtarmaya çalışmak için `True`, yeni başlamak için `False`.\n    *   `save_session`: Mevcut oturumun durumunu olası kurtarma için kaydetmek için `True`, aksi takdirde `False`.\n    *   `speak`: Metinden sese sesli çıktıyı etkinleştirmek için `True`, devre dışı bırakmak için `False`.\n    *   `listen`: Konuşmadan metne sesli girdiyi etkinleştirmek için `True` (yalnızca CLI modu), devre dışı bırakmak için `False`.\n    *   `work_dir`: **Kritik:** AgenticSeek'in dosya okuyacağı/yazacağı dizin. **Bu yolun sisteminizde geçerli ve erişilebilir olduğundan emin olun.**\n    *   `jarvis_personality`: Daha \"Jarvis-benzeri\" bir sistem istemi kullanmak için `True` (deneysel), standart istem için `False`.\n    *   `languages`: Virgülle ayrılmış dil listesi (ör: `en, zh, fr`). TTS ses seçimi için kullanılır (varsayılan olarak ilki) ve LLM yönlendiricisine yardımcı olabilir. Yönlendirici verimliliği için çok fazla veya çok benzer dil kullanmaktan kaçının.\n*   **`[BROWSER]` Bölümü:**\n    *   `headless_browser`: Otomatik tarayıcıyı görünür pencere olmadan çalıştırmak için `True` (web arayüzü veya etkileşimsiz kullanım için önerilir). Tarayıcı penceresini göstermek için `False` (CLI modu veya hata ayıklama için kullanışlıdır).\n    *   `stealth_mode`: Tarayıcı otomasyonunun tespit edilmesini zorlaştıran önlemleri etkinleştirmek için `True`. Anticaptcha gibi tarayıcı eklentilerinin manuel olarak yüklenmesini gerektirebilir.\n\nBu bölüm desteklenen LLM sağlayıcı türlerini özetler. `config.ini` dosyasında yapılandırın.\n\n**Yerel Sağlayıcılar (Kendi Donanımınızda Çalışır):**\n\n| `config.ini`'deki Sağlayıcı Adı | `is_local` | Açıklama                                                                 | Kurulum Bölümü                                                    |\n|-------------------------------|------------|-----------------------------------------------------------------------------|------------------------------------------------------------------|\n| `ollama`                      | `True`     | Ollama kullanarak yerel LLM'leri sunun.                                             | [LLM'yi yerel olarak çalıştırma kurulumu](#llmyi-makinenizde-yerel-olarak-çalıştırma-kurulumu) |\n| `lm-studio`                   | `True`     | LM-Studio kullanarak yerel LLM'leri sunun.                                          | [LLM'yi yerel olarak çalıştırma kurulumu](#llmyi-makinenizde-yerel-olarak-çalıştırma-kurulumu) |\n| `openai` (yerel sunucu için)   | `True`     | OpenAI uyumlu API sunan yerel bir sunucuya bağlanın (ör: llama.cpp). | [LLM'yi yerel olarak çalıştırma kurulumu](#llmyi-makinenizde-yerel-olarak-çalıştırma-kurulumu) |\n| `server`                      | `False`    | Başka bir makinede çalışan AgenticSeek kendi barındırmalı LLM sunucusuna bağlanın. | [LLM'yi kendi sunucunuzda çalıştırma kurulumu](#llmyi-kendi-sunucunuzda-çalıştırma-kurulumu) |\n\n**API Sağlayıcıları (Bulut Tabanlı):**\n\n| `config.ini`'deki Sağlayıcı Adı | `is_local` | Açıklama                                      | Kurulum Bölümü                                       |\n|-------------------------------|------------|--------------------------------------------------|-----------------------------------------------------|\n| `openai`                      | `False`    | OpenAI'ın resmi API'sini kullanın (ör: GPT-3.5, GPT-4). | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |\n| `google`                      | `False`    | Google Gemini modellerini API üzerinden kullanın.              | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |\n| `deepseek`                    | `False`    | Deepseek'in resmi API'sini kullanın.                     | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |\n| `huggingface`                 | `False`    | Hugging Face Inference API'yi kullanın.                  | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |\n| `togetherAI`                  | `False`    | TogetherAI API'si üzerinden çeşitli açık modelleri kullanın.    | [API ile çalıştırma kurulumu](#api-ile-çalıştırma-kurulumu) |\n\n---\n## Sorun Giderme\n\nSorunlarla karşılaşırsanız bu bölüm rehberlik sağlar.\n\n# Bilinen Sorunlar\n\n## ChromeDriver Sorunları\n\n**Hata Örneği:** `SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version XXX`\n\n### Temel Neden\nChromeDriver sürüm uyumsuzluğu şu durumlarda oluşur:\n1. Yüklü ChromeDriver sürümünüz Chrome tarayıcı sürümünüzle eşleşmiyor\n2. Docker ortamlarında `undetected_chromedriver`, bağlanan ikili dosyayı atlayarak kendi ChromeDriver sürümünü indirebilir\n\n### Çözüm Adımları\n\n#### 1. Chrome Sürümünüzü Kontrol Edin\nGoogle Chrome'u açın → `Ayarlar > Chrome Hakkında` bölümünden sürümünüzü bulun (ör: \"Sürüm 134.0.6998.88\")\n\n#### 2. Eşleşen ChromeDriver'ı İndirin\n\n**Chrome 115 ve sonrası için:** [Chrome for Testing API](https://googlechromelabs.github.io/chrome-for-testing/) kullanın\n- Chrome for Testing uygunluk panosunu ziyaret edin\n- Chrome sürümünüzü veya en yakın eşleşmeyi bulun\n- İşletim sisteminiz için ChromeDriver'ı indirin (Docker ortamları için Linux64)\n\n**Eski Chrome sürümleri için:** [Eski ChromeDriver indirmeleri](https://chromedriver.chromium.org/downloads) kullanın\n\n![Chrome for Testing'den ChromeDriver İndirin](./media/chromedriver_readme.png)\n\n#### 3. ChromeDriver'ı Yükleyin (Bir Yöntem Seçin)\n\n**Yöntem A: Proje Kök Dizini (Docker için Önerilir)**\n```bash\n# İndirilen chromedriver ikili dosyasını proje kök dizinine yerleştirin\ncp path/to/downloaded/chromedriver ./chromedriver\nchmod +x ./chromedriver  # Linux/macOS'ta çalıştırılabilir yapın\n```\n\n**Yöntem B: Sistem PATH'i**\n```bash\n# Linux/macOS\nsudo mv chromedriver /usr/local/bin/\nsudo chmod +x /usr/local/bin/chromedriver\n\n# Windows: chromedriver.exe dosyasını PATH'inizdeki bir klasöre yerleştirin\n```\n\n#### 4. Kurulumu Doğrulayın\n```bash\n# ChromeDriver sürümünü test edin\n./chromedriver --version\n# Veya PATH'teyse:\nchromedriver --version\n```\n\n### Docker'a Özel Notlar\n\n⚠️ **Docker Kullanıcıları İçin Önemli:**\n- Docker volume mount yaklaşımı gizli modda (`undetected_chromedriver`) çalışmayabilir\n- **Çözüm**: ChromeDriver'ı proje kök dizinine `./chromedriver` olarak yerleştirin\n- Uygulama bu ikili dosyayı otomatik olarak algılayıp kullanacaktır\n- Loglarda şunu görmelisiniz: `\"Using ChromeDriver from project root: ./chromedriver\"`\n\n### Sorun Giderme İpuçları\n\n1. **Hâlâ sürüm uyumsuzluğu mu var?**\n   - ChromeDriver'ın çalıştırılabilir olduğunu doğrulayın: `ls -la ./chromedriver`\n   - ChromeDriver sürümünü kontrol edin: `./chromedriver --version`\n   - Chrome tarayıcı sürümünüzle eşleştiğinden emin olun\n\n2. **Docker container sorunları mı var?**\n   - Backend loglarını kontrol edin: `docker logs backend`\n   - Şu mesajı arayın: `\"Using ChromeDriver from project root\"`\n   - Bulunamazsa dosyanın var olduğunu ve çalıştırılabilir olduğunu doğrulayın\n\n3. **Chrome for Testing sürümleri**\n   - Mümkün olduğunca tam sürüm eşleşmesi kullanın\n   - 134.0.6998.88 sürümü için ChromeDriver 134.0.6998.165 kullanın (en yakın mevcut sürüm)\n   - Ana sürüm numaraları eşleşmelidir (134 = 134)\n\n### Sürüm Uyumluluk Matrisi\n\n| Chrome Sürümü | ChromeDriver Sürümü | Durum |\n|----------------|---------------------|---------|\n| 134.0.6998.x   | 134.0.6998.165     | ✅ Çalışır |\n| 133.0.6943.x   | 133.0.6943.141     | ✅ Çalışır |\n| 132.0.6834.x   | 132.0.6834.159     | ✅ Çalışır |\n\n*En güncel uyumluluk için [Chrome for Testing panosunu](https://googlechromelabs.github.io/chrome-for-testing/) kontrol edin*\n\n`Exception: Failed to initialize browser: Message: session not created: This version of ChromeDriver only supports Chrome version 113\nCurrent browser version is 134.0.6998.89 with binary path`\n\nBu hata, tarayıcınız ve chromedriver sürümü arasında uyumsuzluk varsa oluşur.\n\nEn son sürümü indirmek için şu adrese gidin:\n\nhttps://developer.chrome.com/docs/chromedriver/downloads\n\nChrome sürüm 115 veya daha yenisini kullanıyorsanız:\n\nhttps://googlechromelabs.github.io/chrome-for-testing/\n\nadresinden işletim sisteminize uygun chromedriver sürümünü indirin.\n\n![alt text](./media/chromedriver_readme.png)\n\nBu bölüm eksikse lütfen bir issue açın.\n\n## Bağlantı Adaptörü Sorunları\n\n```\nException: Provider lm-studio failed: HTTP request failed: No connection adapters were found for '127.0.0.1:1234/v1/chat/completions'` (Not: port değişebilir)\n```\n\n*   **Neden:** `config.ini` dosyasında `lm-studio` (veya benzeri yerel OpenAI uyumlu sunucular) için `provider_server_address` değerinde `http://` öneki eksik veya yanlış porta yönlendiriliyor.\n*   **Çözüm:**\n    *   Adresin `http://` içerdiğinden emin olun. LM-Studio varsayılan olarak genellikle `http://127.0.0.1:1234` kullanır.\n    *   Doğru `config.ini`: `provider_server_address = http://127.0.0.1:1234` (veya gerçek LM-Studio sunucu portunuz).\n\n## SearxNG Temel URL'si Belirtilmemiş\n\n```\nraise ValueError(\"SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.\")\nValueError: SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.`\n```\n\nBu hata, CLI modunu yanlış SearxNG temel URL'si ile çalıştırdığınızda oluşabilir.\n\nSEARXNG_BASE_URL, Docker'da mı yoksa ana makinede mi çalıştırdığınıza göre değişmelidir:\n\n**Ana makinede çalıştırma**: `SEARXNG_BASE_URL=\"http://localhost:8080\"`\n\n**Tamamen Docker'da çalıştırma (web arayüzü)**: `SEARXNG_BASE_URL=\"http://searxng:8080\"`\n\n## SSS\n\n**S: Hangi donanıma ihtiyacım var?**\n\n| Model Boyutu  | GPU  | Yorum                                               |\n|-----------|--------|-----------------------------------------------------------|\n| 7B        | 8GB VRAM | ⚠️ Önerilmez. Düşük performans, sık halüsinasyonlar ve planlayıcı ajanlar büyük olasılıkla başarısız olur. |\n| 14B        | 12 GB VRAM (ör: RTX 3060) | ✅ Basit görevler için kullanılabilir. Web tarama ve planlama görevlerinde zorlanabilir. |\n| 32B        | 24+ GB VRAM (ör: RTX 4090) | 🚀 Çoğu görevde başarılı, görev planlamasında hâlâ zorlanabilir |\n| 70B+        | 48+ GB VRAM | 💪 Mükemmel. Gelişmiş kullanım senaryoları için önerilir. |\n\n**S: Hata alıyorum, ne yapmalıyım?**\n\nYerel sunucunun çalıştığından (`ollama serve`), `config.ini` dosyanızın sağlayıcınızla eşleştiğinden ve bağımlılıkların yüklü olduğundan emin olun. Hiçbiri işe yaramazsa bir issue açmaktan çekinmeyin.\n\n**S: Gerçekten %100 yerel çalışabilir mi?**\n\nEvet, Ollama, lm-studio veya server sağlayıcıları ile tüm konuşmadan metne, LLM ve metinden sese modelleri yerel olarak çalışır. Yerel olmayan seçenekler (OpenAI veya diğer API'ler) isteğe bağlıdır.\n\n**S: Manus varken neden AgenticSeek kullanmalıyım?**\n\nManus'un aksine, AgenticSeek harici sistemlerden bağımsızlığa öncelik verir, size daha fazla kontrol, gizlilik ve API maliyetinden kaçınma imkânı sunar.\n\n**S: Projenin arkasında kim var?**\n\nProje benim tarafımdan, bakımcı olarak görev yapan iki arkadaşım ve GitHub'daki açık kaynak topluluğundan katkıda bulunanlarla birlikte oluşturuldu. Bir startup veya herhangi bir kuruluşla bağlantılı değiliz, sadece tutkulu bireylerden oluşan bir grubuz.\n\nX'te kişisel hesabım (https://x.com/Martin993886460) dışındaki herhangi bir AgenticSeek hesabı taklittir.\n\n## Katkıda Bulunma\n\nAgenticSeek'i geliştirmek için geliştiriciler arıyoruz! Açık issue'lara veya tartışmalara göz atın.\n\n[Katkıda bulunma rehberi](./docs/CONTRIBUTING.md)\n\n\n## Sponsorlar:\n\nAgenticSeek'in yeteneklerini uçuş arama, seyahat planlama veya en iyi alışveriş fırsatlarını yakalama gibi özelliklerle geliştirmek ister misiniz? Daha fazla Jarvis benzeri yetenek açmak için SerpApi ile özel bir araç oluşturmayı düşünün. SerpApi ile, tam kontrolü elinizde tutarken ajanınızı özel görevler için güçlendirebilirsiniz.\n\n<a href=\"https://serpapi.com/\"><img src=\"./media/banners/sponsor_banner_serpapi.png\" height=\"350\" alt=\"SerpApi Banner\" ></a>\n\nÖzel araçları nasıl entegre edeceğinizi öğrenmek için [Contributing.md](./docs/CONTRIBUTING.md) dosyasına bakın!\n\n### **Patron Sponsor**:\n\n- [tatra-labs](https://github.com/tatra-labs)\n\n## Bakımcılar:\n\n > [Fosowl](https://github.com/Fosowl) | Paris Saati\n\n > [antoineVIVIES](https://github.com/antoineVIVIES) | Taipei Saati\n\n## Özel Teşekkürler:\n\n > [tcsenpai](https://github.com/tcsenpai) ve [plitc](https://github.com/plitc) Backend dockerizasyonuna yardımları için\n\n[![Star History Chart](https://api.star-history.com/svg?repos=Fosowl/agenticSeek&type=Date)](https://www.star-history.com/#Fosowl/agenticSeek&Date)\n"
  },
  {
    "path": "api.py",
    "content": "#!/usr/bin/env python3\n\nimport os, sys\nimport uvicorn\nimport aiofiles\nimport configparser\nimport asyncio\nimport time\nfrom typing import List\nfrom fastapi import FastAPI\nfrom fastapi.responses import JSONResponse\nfrom fastapi.responses import FileResponse\nfrom fastapi.middleware.cors import CORSMiddleware\nfrom fastapi.staticfiles import StaticFiles\nimport uuid\n\nfrom sources.llm_provider import Provider\nfrom sources.interaction import Interaction\nfrom sources.agents import CasualAgent, CoderAgent, FileAgent, PlannerAgent, BrowserAgent\nfrom sources.browser import Browser, create_driver\nfrom sources.utility import pretty_print\nfrom sources.logger import Logger\nfrom sources.schemas import QueryRequest, QueryResponse\n\nfrom dotenv import load_dotenv\n\nload_dotenv()\n\n\ndef is_running_in_docker():\n    \"\"\"Detect if code is running inside a Docker container.\"\"\"\n    # Method 1: Check for .dockerenv file\n    if os.path.exists('/.dockerenv'):\n        return True\n    \n    # Method 2: Check cgroup\n    try:\n        with open('/proc/1/cgroup', 'r') as f:\n            return 'docker' in f.read()\n    except:\n        pass\n    \n    return False\n\n\nfrom celery import Celery\n\napi = FastAPI(title=\"AgenticSeek API\", version=\"0.1.0\")\ncelery_app = Celery(\"tasks\", broker=\"redis://localhost:6379/0\", backend=\"redis://localhost:6379/0\")\ncelery_app.conf.update(task_track_started=True)\nlogger = Logger(\"backend.log\")\nconfig = configparser.ConfigParser()\nconfig.read('config.ini')\n\napi.add_middleware(\n    CORSMiddleware,\n    allow_origins=[\"*\"],\n    allow_credentials=True,\n    allow_methods=[\"*\"],\n    allow_headers=[\"*\"],\n)\n\nif not os.path.exists(\".screenshots\"):\n    os.makedirs(\".screenshots\")\napi.mount(\"/screenshots\", StaticFiles(directory=\".screenshots\"), name=\"screenshots\")\n\ndef initialize_system():\n    stealth_mode = config.getboolean('BROWSER', 'stealth_mode')\n    personality_folder = \"jarvis\" if config.getboolean('MAIN', 'jarvis_personality') else \"base\"\n    languages = config[\"MAIN\"][\"languages\"].split(' ')\n    \n    # Force headless mode in Docker containers\n    headless = config.getboolean('BROWSER', 'headless_browser')\n    if is_running_in_docker() and not headless:\n        # Print prominent warning to console (visible in docker-compose output)\n        print(\"\\n\" + \"*\" * 70)\n        print(\"*** WARNING: Detected Docker environment - forcing headless_browser=True ***\")\n        print(\"*** INFO: To see the browser, run 'python cli.py' on your host machine ***\")\n        print(\"*\" * 70 + \"\\n\")\n        \n        # Flush to ensure it's displayed immediately\n        sys.stdout.flush()\n        \n        # Also log to file\n        logger.warning(\"Detected Docker environment - forcing headless_browser=True\")\n        logger.info(\"To see the browser, run 'python cli.py' on your host machine instead\")\n        \n        headless = True\n    \n    provider = Provider(\n        provider_name=config[\"MAIN\"][\"provider_name\"],\n        model=config[\"MAIN\"][\"provider_model\"],\n        server_address=config[\"MAIN\"][\"provider_server_address\"],\n        is_local=config.getboolean('MAIN', 'is_local')\n    )\n    logger.info(f\"Provider initialized: {provider.provider_name} ({provider.model})\")\n\n    browser = Browser(\n        create_driver(headless=headless, stealth_mode=stealth_mode, lang=languages[0]),\n        anticaptcha_manual_install=stealth_mode\n    )\n    logger.info(\"Browser initialized\")\n\n    agents = [\n        CasualAgent(\n            name=config[\"MAIN\"][\"agent_name\"],\n            prompt_path=f\"prompts/{personality_folder}/casual_agent.txt\",\n            provider=provider, verbose=False\n        ),\n        CoderAgent(\n            name=\"coder\",\n            prompt_path=f\"prompts/{personality_folder}/coder_agent.txt\",\n            provider=provider, verbose=False\n        ),\n        FileAgent(\n            name=\"File Agent\",\n            prompt_path=f\"prompts/{personality_folder}/file_agent.txt\",\n            provider=provider, verbose=False\n        ),\n        BrowserAgent(\n            name=\"Browser\",\n            prompt_path=f\"prompts/{personality_folder}/browser_agent.txt\",\n            provider=provider, verbose=False, browser=browser\n        ),\n        PlannerAgent(\n            name=\"Planner\",\n            prompt_path=f\"prompts/{personality_folder}/planner_agent.txt\",\n            provider=provider, verbose=False, browser=browser\n        )\n    ]\n    logger.info(\"Agents initialized\")\n\n    interaction = Interaction(\n        agents,\n        tts_enabled=config.getboolean('MAIN', 'speak'),\n        stt_enabled=config.getboolean('MAIN', 'listen'),\n        recover_last_session=config.getboolean('MAIN', 'recover_last_session'),\n        langs=languages\n    )\n    logger.info(\"Interaction initialized\")\n    return interaction\n\ninteraction = initialize_system()\nis_generating = False\nquery_resp_history = []\n\n@api.get(\"/screenshot\")\nasync def get_screenshot():\n    logger.info(\"Screenshot endpoint called\")\n    screenshot_path = \".screenshots/updated_screen.png\"\n    if os.path.exists(screenshot_path):\n        return FileResponse(screenshot_path)\n    logger.error(\"No screenshot available\")\n    return JSONResponse(\n        status_code=404,\n        content={\"error\": \"No screenshot available\"}\n    )\n\n@api.get(\"/health\")\nasync def health_check():\n    logger.info(\"Health check endpoint called\")\n    return {\"status\": \"healthy\", \"version\": \"0.1.0\"}\n\n@api.get(\"/is_active\")\nasync def is_active():\n    logger.info(\"Is active endpoint called\")\n    return {\"is_active\": interaction.is_active}\n\n@api.get(\"/stop\")\nasync def stop():\n    logger.info(\"Stop endpoint called\")\n    interaction.current_agent.request_stop()\n    return JSONResponse(status_code=200, content={\"status\": \"stopped\"})\n\n@api.get(\"/latest_answer\")\nasync def get_latest_answer():\n    global query_resp_history\n    if interaction.current_agent is None:\n        return JSONResponse(status_code=404, content={\"error\": \"No agent available\"})\n    uid = str(uuid.uuid4())\n    if not any(q[\"answer\"] == interaction.current_agent.last_answer for q in query_resp_history):\n        query_resp = {\n            \"done\": \"false\",\n            \"answer\": interaction.current_agent.last_answer,\n            \"reasoning\": interaction.current_agent.last_reasoning,\n            \"agent_name\": interaction.current_agent.agent_name if interaction.current_agent else \"None\",\n            \"success\": interaction.current_agent.success,\n            \"blocks\": {f'{i}': block.jsonify() for i, block in enumerate(interaction.get_last_blocks_result())} if interaction.current_agent else {},\n            \"status\": interaction.current_agent.get_status_message if interaction.current_agent else \"No status available\",\n            \"uid\": uid\n        }\n        interaction.current_agent.last_answer = \"\"\n        interaction.current_agent.last_reasoning = \"\"\n        query_resp_history.append(query_resp)\n        return JSONResponse(status_code=200, content=query_resp)\n    if query_resp_history:\n        return JSONResponse(status_code=200, content=query_resp_history[-1])\n    return JSONResponse(status_code=404, content={\"error\": \"No answer available\"})\n\nasync def think_wrapper(interaction, query):\n    try:\n        interaction.last_query = query\n        logger.info(\"Agents request is being processed\")\n        success = await interaction.think()\n        if not success:\n            interaction.last_answer = \"Error: No answer from agent\"\n            interaction.last_reasoning = \"Error: No reasoning from agent\"\n            interaction.last_success = False\n        else:\n            interaction.last_success = True\n        pretty_print(interaction.last_answer)\n        interaction.speak_answer()\n        return success\n    except Exception as e:\n        logger.error(f\"Error in think_wrapper: {str(e)}\")\n        interaction.last_answer = f\"\"\n        interaction.last_reasoning = f\"Error: {str(e)}\"\n        interaction.last_success = False\n        raise e\n\n@api.post(\"/query\", response_model=QueryResponse)\nasync def process_query(request: QueryRequest):\n    global is_generating, query_resp_history\n    logger.info(f\"Processing query: {request.query}\")\n    query_resp = QueryResponse(\n        done=\"false\",\n        answer=\"\",\n        reasoning=\"\",\n        agent_name=\"Unknown\",\n        success=\"false\",\n        blocks={},\n        status=\"Ready\",\n        uid=str(uuid.uuid4())\n    )\n    if is_generating:\n        logger.warning(\"Another query is being processed, please wait.\")\n        return JSONResponse(status_code=429, content=query_resp.jsonify())\n\n    try:\n        is_generating = True\n        success = await think_wrapper(interaction, request.query)\n        is_generating = False\n\n        if not success:\n            query_resp.answer = interaction.last_answer\n            query_resp.reasoning = interaction.last_reasoning\n            return JSONResponse(status_code=400, content=query_resp.jsonify())\n\n        if interaction.current_agent:\n            blocks_json = {f'{i}': block.jsonify() for i, block in enumerate(interaction.current_agent.get_blocks_result())}\n        else:\n            logger.error(\"No current agent found\")\n            blocks_json = {}\n            query_resp.answer = \"Error: No current agent\"\n            return JSONResponse(status_code=400, content=query_resp.jsonify())\n\n        logger.info(f\"Answer: {interaction.last_answer}\")\n        logger.info(f\"Blocks: {blocks_json}\")\n        query_resp.done = \"true\"\n        query_resp.answer = interaction.last_answer\n        query_resp.reasoning = interaction.last_reasoning\n        query_resp.agent_name = interaction.current_agent.agent_name\n        query_resp.success = str(interaction.last_success)\n        query_resp.blocks = blocks_json\n        \n        query_resp_dict = {\n            \"done\": query_resp.done,\n            \"answer\": query_resp.answer,\n            \"agent_name\": query_resp.agent_name,\n            \"success\": query_resp.success,\n            \"blocks\": query_resp.blocks,\n            \"status\": query_resp.status,\n            \"uid\": query_resp.uid\n        }\n        query_resp_history.append(query_resp_dict)\n\n        logger.info(\"Query processed successfully\")\n        return JSONResponse(status_code=200, content=query_resp.jsonify())\n    except Exception as e:\n        logger.error(f\"An error occurred: {str(e)}\")\n        sys.exit(1)\n    finally:\n        logger.info(\"Processing finished\")\n        if config.getboolean('MAIN', 'save_session'):\n            interaction.save_session()\n\nif __name__ == \"__main__\":\n    # Print startup info\n    if is_running_in_docker():\n        print(\"[AgenticSeek] Starting in Docker container...\")\n    else:\n        print(\"[AgenticSeek] Starting on host machine...\")\n    \n    envport = os.getenv(\"BACKEND_PORT\")\n    if envport:\n        port = int(envport)\n    else:\n        port = 7777\n    uvicorn.run(api, host=\"0.0.0.0\", port=7777)"
  },
  {
    "path": "cli.py",
    "content": "#!/usr/bin python3\n\nimport sys\nimport argparse\nimport configparser\nimport asyncio\n\nfrom sources.llm_provider import Provider\nfrom sources.interaction import Interaction\nfrom sources.agents import Agent, CoderAgent, CasualAgent, FileAgent, PlannerAgent, BrowserAgent, McpAgent\nfrom sources.browser import Browser, create_driver\nfrom sources.utility import pretty_print\n\nimport warnings\nwarnings.filterwarnings(\"ignore\")\n\nconfig = configparser.ConfigParser()\nconfig.read('config.ini')\n\nasync def main():\n    pretty_print(\"Initializing...\", color=\"status\")\n    stealth_mode = config.getboolean('BROWSER', 'stealth_mode')\n    personality_folder = \"jarvis\" if config.getboolean('MAIN', 'jarvis_personality') else \"base\"\n    languages = config[\"MAIN\"][\"languages\"].split(' ')\n\n    provider = Provider(provider_name=config[\"MAIN\"][\"provider_name\"],\n                        model=config[\"MAIN\"][\"provider_model\"],\n                        server_address=config[\"MAIN\"][\"provider_server_address\"],\n                        is_local=config.getboolean('MAIN', 'is_local'))\n\n    browser = Browser(\n        create_driver(headless=config.getboolean('BROWSER', 'headless_browser'), stealth_mode=stealth_mode, lang=languages[0]),\n        anticaptcha_manual_install=stealth_mode\n    )\n\n    agents = [\n        CasualAgent(name=config[\"MAIN\"][\"agent_name\"],\n                    prompt_path=f\"prompts/{personality_folder}/casual_agent.txt\",\n                    provider=provider, verbose=False),\n        CoderAgent(name=\"coder\",\n                   prompt_path=f\"prompts/{personality_folder}/coder_agent.txt\",\n                   provider=provider, verbose=False),\n        FileAgent(name=\"File Agent\",\n                  prompt_path=f\"prompts/{personality_folder}/file_agent.txt\",\n                  provider=provider, verbose=False),\n        BrowserAgent(name=\"Browser\",\n                     prompt_path=f\"prompts/{personality_folder}/browser_agent.txt\",\n                     provider=provider, verbose=False, browser=browser),\n        PlannerAgent(name=\"Planner\",\n                     prompt_path=f\"prompts/{personality_folder}/planner_agent.txt\",\n                     provider=provider, verbose=False, browser=browser),\n        #McpAgent(name=\"MCP Agent\",\n        #            prompt_path=f\"prompts/{personality_folder}/mcp_agent.txt\",\n        #            provider=provider, verbose=False), # NOTE under development\n    ]\n\n    interaction = Interaction(agents,\n                              tts_enabled=config.getboolean('MAIN', 'speak'),\n                              stt_enabled=config.getboolean('MAIN', 'listen'),\n                              recover_last_session=config.getboolean('MAIN', 'recover_last_session'),\n                              langs=languages\n                            )\n    try:\n        while interaction.is_active:\n            interaction.get_user()\n            if await interaction.think():\n                interaction.show_answer()\n                interaction.speak_answer()\n    except Exception as e:\n        if config.getboolean('MAIN', 'save_session'):\n            interaction.save_session()\n        raise e\n    finally:\n        if config.getboolean('MAIN', 'save_session'):\n            interaction.save_session()\n\nif __name__ == \"__main__\":\n    asyncio.run(main())"
  },
  {
    "path": "docker-compose.yml",
    "content": "\nservices:\n  redis:\n    container_name: redis\n    profiles: [\"core\", \"full\"]\n    image: docker.io/valkey/valkey:8-alpine\n    command: valkey-server --save 30 1 --loglevel warning\n    restart: unless-stopped\n    volumes:\n      - redis-data:/data\n    cap_drop:\n      - ALL\n    cap_add:\n      - SETGID\n      - SETUID\n      - DAC_OVERRIDE\n    logging:\n      driver: \"json-file\"\n      options:\n        max-size: \"1m\"\n        max-file: \"1\"\n    networks:\n      - agentic-seek-net\n\n  searxng:\n    container_name: searxng\n    profiles: [\"core\", \"full\"]\n    image: docker.io/searxng/searxng:latest\n    restart: unless-stopped\n    ports:\n      - \"8080:8080\"\n    volumes:\n      - ./searxng:/etc/searxng:rw,z\n    environment:\n      - SEARXNG_BASE_URL=${SEARXNG_BASE_URL:-http://localhost:8080/}\n      - SEARXNG_SECRET_KEY=${SEARXNG_SECRET_KEY}\n      - UWSGI_WORKERS=4\n      - UWSGI_THREADS=4\n    cap_add:\n      - CHOWN\n      - SETGID\n      - SETUID\n    logging:\n      driver: \"json-file\"\n      options:\n        max-size: \"1m\"\n        max-file: \"1\"\n    depends_on:\n      - redis\n    networks:\n      - agentic-seek-net\n\n  frontend:\n    container_name: frontend\n    profiles: [\"core\", \"full\"]\n    build:\n      context: ./frontend\n      dockerfile: Dockerfile.frontend\n    ports:\n      - \"3000:3000\"\n    volumes:\n      - ./frontend/agentic-seek-front/src:/app/src:rw,z\n      - ./screenshots:/app/screenshots\n    environment:\n      - NODE_ENV=development\n      - CHOKIDAR_USEPOLLING=true\n      - REACT_APP_BACKEND_URL=http://localhost:7777\n    networks:\n      - agentic-seek-net\n\n  backend:\n    container_name: backend\n    profiles: [\"backend\", \"full\"]\n    build:\n      context: .\n      dockerfile: Dockerfile.backend\n    ports:\n      - ${BACKEND_PORT:-7777}:${BACKEND_PORT:-7777}\n    volumes:\n      - ./:/app\n      - ${WORK_DIR:-.}:/opt/workspace\n    command: python3 api.py\n    environment:\n      - SEARXNG_BASE_URL=${SEARXNG_BASE_URL:-http://searxng:8080}\n      - REDIS_URL=${REDIS_BASE_URL:-redis://redis:6379/0}\n      - WORK_DIR=/opt/workspace\n      - BACKEND_PORT=${BACKEND_PORT}\n      - DOCKER_INTERNAL_URL=http://host.docker.internal\n      - OPENAI_API_KEY=${OPENAI_API_KEY}\n      - DEEPSEEK_API_KEY=${DEEPSEEK_API_KEY}\n      - OPENROUTER_API_KEY=${OPENROUTER_API_KEY}\n      - TOGETHER_API_KEY=${TOGETHER_API_KEY}\n      - GOOGLE_API_KEY=${GOOGLE_API_KEY}\n      - ANTHROPIC_API_KEY=${ANTHROPIC_API_KEY}\n      - HUGGINGFACE_API_KEY=${HUGGINGFACE_API_KEY}\n      - DSK_DEEPSEEK_API_KEY=${DSK_DEEPSEEK_API_KEY}\n    networks:\n      - agentic-seek-net\n    extra_hosts:\n      - \"host.docker.internal:host-gateway\"\n  \nvolumes:\n  redis-data:\n  chrome_profiles:\n\nnetworks:\n  agentic-seek-net:\n    driver: bridge\n"
  },
  {
    "path": "docs/CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participation in our\ncommunity a harassment-free experience for everyone, regardless of age, body\nsize, visible or invisible disability, ethnicity, sex characteristics, gender\nidentity and expression, level of experience, education, socio-economic status,\nnationality, personal appearance, race, caste, color, religion, or sexual\nidentity and orientation.\n\nWe pledge to act and interact in ways that contribute to an open, welcoming,\ndiverse, inclusive, and healthy community.\n\n## Our Standards\n\nExamples of behavior that contributes to a positive environment for our\ncommunity include:\n\n* Demonstrating empathy and kindness toward other people\n* Being respectful of differing opinions, viewpoints, and experiences\n* Giving and gracefully accepting constructive feedback\n* Accepting responsibility and apologizing to those affected by our mistakes,\n  and learning from the experience\n* Focusing on what is best not just for us as individuals, but for the overall\n  community\n\nExamples of unacceptable behavior include:\n\n* The use of sexualized language or imagery, and sexual attention or advances of\n  any kind\n* Trolling, insulting or derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or email address,\n  without their explicit permission\n* Other conduct which could reasonably be considered inappropriate in a\n  professional setting\n\n## Enforcement Responsibilities\n\nCommunity leaders are responsible for clarifying and enforcing our standards of\nacceptable behavior and will take appropriate and fair corrective action in\nresponse to any behavior that they deem inappropriate, threatening, offensive,\nor harmful.\n\nCommunity leaders have the right and responsibility to remove, edit, or reject\ncomments, commits, code, wiki edits, issues, and other contributions that are\nnot aligned to this Code of Conduct, and will communicate reasons for moderation\ndecisions when appropriate.\n\n## Scope\n\nThis Code of Conduct applies within all community spaces, and also applies when\nan individual is officially representing the community in public spaces.\nExamples of representing our community include using an official email address,\nposting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported to the community leaders responsible for enforcement:\nyou need to send a private message to `fossowl` or `mow8758` on discord.\nAll complaints will be reviewed and investigated promptly and fairly.\n\nAll community leaders are obligated to respect the privacy and security of the\nreporter of any incident.\n\n## Enforcement Guidelines\n\nCommunity leaders will follow these Community Impact Guidelines in determining\nthe consequences for any action they deem in violation of this Code of Conduct:\n\n### 1. Correction\n\n**Community Impact**: Use of inappropriate language or other behavior deemed\nunprofessional or unwelcome in the community.\n\n**Consequence**: A private, written warning from community leaders, providing\nclarity around the nature of the violation and an explanation of why the\nbehavior was inappropriate. A public apology may be requested.\n\n### 2. Warning\n\n**Community Impact**: A violation through a single incident or series of\nactions.\n\n**Consequence**: A warning with consequences for continued behavior. No\ninteraction with the people involved, including unsolicited interaction with\nthose enforcing the Code of Conduct, for a specified period of time. This\nincludes avoiding interactions in community spaces as well as external channels\nlike social media. Violating these terms may lead to a temporary or permanent\nban.\n\n### 3. Temporary Ban\n\n**Community Impact**: A serious violation of community standards, including\nsustained inappropriate behavior.\n\n**Consequence**: A temporary ban from any sort of interaction or public\ncommunication with the community for a specified period of time. No public or\nprivate interaction with the people involved, including unsolicited interaction\nwith those enforcing the Code of Conduct, is allowed during this period.\nViolating these terms may lead to a permanent ban.\n\n### 4. Permanent Ban\n\n**Community Impact**: Demonstrating a pattern of violation of community\nstandards, including sustained inappropriate behavior, harassment of an\nindividual, or aggression toward or disparagement of classes of individuals.\n\n**Consequence**: A permanent ban from any sort of public interaction within the\ncommunity.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage],\nversion 2.1, available at\n[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].\n\nCommunity Impact Guidelines were inspired by\n[Mozilla's code of conduct enforcement ladder][Mozilla CoC].\n\nFor answers to common questions about this code of conduct, see the FAQ at\n[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at\n[https://www.contributor-covenant.org/translations][translations].\n\n[homepage]: https://www.contributor-covenant.org\n[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html\n[Mozilla CoC]: https://github.com/mozilla/diversity\n[FAQ]: https://www.contributor-covenant.org/faq\n[translations]: https://www.contributor-covenant.org/translations\n"
  },
  {
    "path": "docs/CONTRIBUTING.md",
    "content": "# Contributors guide\n\n## Prerequisites\n\n- Python 3.10 or higher.\n- Docker or Orbstack or Podman.\n- Ollama with some deepseek-r1 variant installed or similar local reasoning model.\n- Basic familiarity with Python and AI models.\n- Join the discord (optional): https://discord.gg/8hGDaME3TC\n\n## Contribution Guidelines\n\nWe welcome contributions in the following areas:\n\n- Code Improvements: Optimize existing code, fix bugs, or add new features.\n- Documentation: Improve the README, write tutorials, or add inline comments.\n- Testing: Write unit tests, integration tests, or help with debugging.\n- New Features: Implement new tools, agents, or integrations.\n\n## Steps to Contribute\n\nFork the project to your GitHub account.\n\nCreate a Branch:\n\n```bash\ngit checkout -b feature/your-feature-name\n```\n\nMake Your Changes.\n\nWrite your code, add documentation, or fix bugs.\n\nTest Your Changes.\n\nEnsure your changes work as expected and do not break existing functionality.\n\nPush your changes to your fork and submit a pull request to the main branch of this repository. Provide a clear description of your changes and reference any related issues.\n\n## Good practice\n\n1. **Privacy First, Always Local**\n   - All core functionality must be able to run 100% locally\n   - Cloud services should only be optional alternatives, clearly defined with a warning message.\n   - remote APIs are only allowed for specific tools (weather api, MCP, flight search, etc...)\n   - User data privacy is non-negotiable\n\n2. **Agent-Based Architecture**\n   - Each agent should have a clear, single responsibility\n   - Agents should be modular and independently testable\n   - New agents should solve specific use cases\n\n3. **Tool-Based Extensibility**\n   - Tools should be self-contained and follow the Tools base class\n   - Each tool should do one thing well\n   - Tools should provide clear feedback on success/failure\n\n4. **User Experience**\n   - Provide meaningful feedback for all operations\n   - Support multiple languages\n   - Text to speech with short response.\n   - Keep responses concise\n\n5. **Code Quality**\n   - Write clear, self-documenting code\n   - Include type hints and docstrings\n   - Follow existing patterns in the codebase\n   - Add a if __name__ == \"__main__\" at the bottom of each class file for individual testing.\n   - Ideally had automated tests.\n\n6. **Error Handling**\n   - Fail gracefully with meaningful messages\n   - Include recovery mechanisms where possible\n   - Log errors appropriately without exposing sensitive data\n\n## Areas Needing Help\n\nHere are some tasks and areas where we need contributions:\n\n- Web Browsing: Improve the autonomous web browsing capabilities for the assistant.\n- Graphical interface, a web graphical interface. (please ask first)\n- Multi-Agent System: Enhance the planner agent for divide and conqueer for task (please ask first).\n- New Tools: Add support for additional programming languages or APIs.\n- MCP: Add MCP protocol compatibility (possibly as a special type tool).\n- Multi-language support: for Text to speech & speech to text\n- Prompt engineering: improve prompts, compare results with different prompts for a identical query. Iterate until you find better prompt.\n- Bug hunt: Hunt and fix bugs.\n- Crossplatform: enhance cross-platform support.\n- Testing: Write comprehensive tests for existing features.\n\n# Implementing and using Tools\n\nTools are extensions that enable agents to perform specific actions, such as running Python code, making API calls, or conducting web searches. All tools inherit from the Tools base class, which provides methods for parsing and executing tool instructions.\n\n## Understand Tools parsing\n\nAgents invoke tools using a standardized format called a block. A block consists of the tool name followed by the content (e.g., code, query, or parameters) to execute. When creating a prompt for an Agent, you must explicitly tell them to use this format.\n\nThe format looks like this:\n\nBECAUSE WE USE MARKDOWN QUOTE FORMAT, READING WILL BE BROKEN ON GITHUB PLEASE START READING THE FILE AS RAW:  https://raw.githubusercontent.com/Fosowl/agenticSeek/refs/heads/dev/docs/CONTRIBUTING.md\n\n\n```<tool name>\n<code or query to execute>\n```\n\nOr:\n\n```web_search\nWhat to do in Taipei?\n```\n\nwe call these \"blocks\".\n\nThe Tools class provides the load_exec_block method to extract and parse blocks from an agent's response. This method identifies the tool name and content, enabling the system to execute the appropriate action.\n\nHow to handle multiple arguments then ?\n\nGood question! Each tool is free to handle argument in it's own way within the block, but we provide a common parsing logic:\n\n```trip_search\nfrom=Paris\nto=Toulouse\n```\n\nTo extract these parameters, use the `get_parameter_value` method provided by the Tools class. Each tool can define its own parameter-handling logic, but the Tools class ensures consistent parsing.\n\nAgain if a tool need a specific format, you could implement a specific method for parsing a block. Using get_parameter_value is optional.\n\nThe content of blocks can also be saved using :path, for instance:\n\n```python:toto.py\nprint(\"Hello world\")\n```\n\nWill save the code in toto.py file within the work_folder defined in the config.ini\n\n## Tools Implementation\n\nWhen developing a tool, you must implement three abstract methods defined in the Tools class to handle execution, failure detection, and feedback to the agent. These methods ensure consistent behavior across tools and enable robust interaction with the LLM.\n\n### 1. Execute method\n\n```\n@abstractmethod\ndef execute(self, blocks: [str], safety: bool) -> str:\n```\n\nThis method defines how the tool processes the provided block(s) and produces a result.\n\n### 2. execution_failure_check \n\n```\n@abstractmethod\ndef execution_failure_check(self, output: str) -> bool:\n```\n\nThis method analyzes the tool’s output to determine if the execution was successful or failed.\n\n### 3. interpreter_feedback\n\n```\n@abstractmethod\ndef interpreter_feedback(self, output: str) -> str:\n```\n\nThis method generates a feedback message for the LLM, helping it understand the tool’s execution outcome and adjust its behavior if needed.\n\nRecap:\n- load_exec_block: Extracts and parses tool blocks from the agent's response.\n- get_parameter_value: Retrieves parameter values from a block's content.\n- File handling: Supports saving block content to files when a :path is specified.\n\n## Prompting an Agent for Tools usage\n\nConsider an example where you want to add a flight search tool to the casual agent, you will need to modify the prompt file for the CasualAgent (e.g., casual_agent.txt) to instruct the LLM to use the a simple flight_search tool. you could add to the prompt:\n\nYou can search for flights using the flight_search tool. Example:\n```flight_search\nRY7481\n```\nYou simply need to enter the flight number, you will then various informations about the flight if it exist, such as : Airline, Status, Departure time, Arrival Time\n\n## Add the tool to your agent\n\nTo add a tool to an agent you simply need to:\n1. Import a tool.\n2. Add the tool class to the **tools** dictionnary.\n3. Update the agent prompt.\n\n```python\nfrom sources.tools.flightSearch import FlightSearch\n\nclass CasualAgent(Agent):\n    def __init__(self, name, prompt_path, provider, verbose=False):\n        super().__init__(name, prompt_path, provider, verbose, None)\n        self.tools = {\n            \"flight_search\": FlightSearch(),\n        }\n        self.role = \"en\"\n        self.type = \"casual_agent\"\n```\n\n\n# Implementing and using Agents\n\nAgents are classes that define how an LLM interacts with users and processes inputs. They can use tools (e.g., for executing code or querying APIs) and maintain a memory of the conversation to provide context-aware responses. All agents inherit from the base Agent class, which provides core functionality like memory management and LLM communication.\n\nThe simplest agent example is the casual agent:\n\n```\nclass CasualAgent(Agent):\n    def __init__(self, name, prompt_path, provider, verbose=False):\n        \"\"\"\n        The casual agent is a special for casual talk to the user without specific tasks.\n        \"\"\"\n        super().__init__(name, prompt_path, provider, verbose, None)\n        self.tools = {\n        } # No tools for the casual agent\n        self.role = \"en\"\n        self.type = \"casual_agent\"\n    \n    def process(self, prompt, speech_module) -> str:\n        self.memory.push('user', prompt)\n        animate_thinking(\"Thinking...\", color=\"status\")\n        answer, reasoning = self.llm_request()\n        self.last_answer = answer\n        return answer, reasoning\n```\n\nAgent have several parameters that should be sets:\n\n`tools`: A dictionary of tools the agent can use. Each tool must inherit from the Tools class. For example, a CasualAgent has no tools ({}), while a coding agent might include a Python execution tool.\n\n`role`:A dictionary defining the agent's role, used by the routing system to select the appropriate agent.\n`type: the agent type, a fixed name to identify the unique agent type.\n\nEvery agent must implement the process method, which defines how it handles user input and generates a response.\n\n**Workflow:**\n\nPush the user's prompt to the agent's memory using self.memory.push('user', prompt).\nCall self.llm_request() to generate a response and reasoning based on the memory context.\nStore and return the response and reasoning.\n\nNote the memory logic. You only need to push the 'user' message. The llm_request method take care of pushing the assistant message. \n\nThis separation of user and assistant memory handling may be inconsistent and could be refactored for clarity in the near future.\n\n**Tool blocks execution**\n\nEach agent might return block of tool to execute, as explained in the **Implementing and using Tools** section.\n\nIn a single text returned by an agent, a succession of block might be present for example, the coding agent answer could be:\n\nI will create a work folder:\n\n```bash\nmkdir myAGI\n```\n\nI will enter the folder.\n\n```bash\ncd myAGI\n```\n\nI will create a python code.\n\n```python:myAGI/super_smart.py\n<python code>\n```\n\nThe `execute_modules` method allow to automatically find, parse and execute all tools from a LLM prompt.\n\nIt will look in the agent answer for any tool \"block\" execute the appropriate tool and return a (success, feedback) tuple.\n\n```\ndef execute_modules(self, answer: str) -> Tuple[bool, str]:\n```\n\n# Architecture Overview\n\n## 1. Agent selection logic\n\n<p align=\"center\">\n<img align=\"center\" src=\"./technical/routing_system.png\">\n<p>\n\nThe agent selection is done in 4 steps:\n1. determine query language and translate to english for the zero-shot model and llm_router.\n2. Estimate the task complexity and best agent.\n    - If HIGH complexity: return the planner agent. \n    - If LOW complexity: Determine the best agent for the task using a vote system between 2 classification models.\n3. Process high complexity query.\n    - If task was high complexity, planner agent will create a json plan to divide and conqueer the task with multiple agent.\n4. Proceed with task(s)\n\n## 2. Agents\n\n### File/Code agents\n\n<p align=\"center\">\n<img align=\"center\" src=\"./technical/code_agent.png\">\n<p>\n\nThe File and Code agents operate similarly: when a prompt is submitted, they initiate a loop between the LLM and a code interpreter. This loop continues executing commands or code until the execution is successful or the maximum number of attempts is reached.\n\n### Web agent\n\n<p align=\"center\">\n<img align=\"center\" src=\"./technical/web_agent.png\">\n<p>\n\nThe Web agent controls a Selenium-driven browser. Upon receiving a query, it begins by generating an optimized search prompt and executing the web_search tool. It then enters a navigation loop, during which it:\n\n- Analyzes the content and interactive elements of the current page.\n- Decides which link to follow, either from the current page or the web_search results.\n- Determines if it should navigate back if so, it re-evaluates the original web_search results.\n- Identifies and interacts with web forms, extracting or filling them as needed.\n- Signals completion by requesting to exit once it considers the task fulfilled.\n\n## Code of Conduct\n\nSee CODE_OF_CONDUCT.md\n\n**Thank You!**\n"
  },
  {
    "path": "frontend/.gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": "frontend/Dockerfile.frontend",
    "content": "FROM node:18\n\nWORKDIR /app\n\n# Copy package files\nCOPY agentic-seek-front/package.json agentic-seek-front/package-lock.json ./\n\n# Install dependencies with explicit bin linking\nRUN npm ci && npm rebuild\n\n# Copy application code\nCOPY agentic-seek-front/ .\n\n# Verify react-scripts is available (catches install issues early)\nRUN test -f node_modules/.bin/react-scripts || npm install react-scripts\n\nEXPOSE 3000\n\nCMD [\"npm\", \"start\"]\n"
  },
  {
    "path": "frontend/README.md",
    "content": "# Getting Started with Create React App\n\nThis project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).\n\n## Available Scripts\n\nIn the project directory, you can run:\n\n### `npm start`\n\nRuns the app in the development mode.\\\nOpen [http://localhost:3000](http://localhost:3000) to view it in your browser.\n\nThe page will reload when you make changes.\\\nYou may also see any lint errors in the console.\n\n### `npm test`\n\nLaunches the test runner in the interactive watch mode.\\\nSee the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.\n\n### `npm run build`\n\nBuilds the app for production to the `build` folder.\\\nIt correctly bundles React in production mode and optimizes the build for the best performance.\n\nThe build is minified and the filenames include the hashes.\\\nYour app is ready to be deployed!\n\nSee the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.\n\n### `npm run eject`\n\n**Note: this is a one-way operation. Once you `eject`, you can't go back!**\n\nIf you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.\n\nInstead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.\n\nYou don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.\n\n## Learn More\n\nYou can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).\n\nTo learn React, check out the [React documentation](https://reactjs.org/).\n\n### Code Splitting\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)\n\n### Analyzing the Bundle Size\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)\n\n### Making a Progressive Web App\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)\n\n### Advanced Configuration\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)\n\n### Deployment\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)\n\n### `npm run build` fails to minify\n\nThis section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)\n"
  },
  {
    "path": "frontend/agentic-seek-front/package.json",
    "content": "{\n  \"name\": \"agentic-seek\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"dependencies\": {\n    \"@testing-library/dom\": \"^10.4.0\",\n    \"@testing-library/jest-dom\": \"^6.6.3\",\n    \"@testing-library/react\": \"^16.3.0\",\n    \"@testing-library/user-event\": \"^13.5.0\",\n    \"axios\": \"^1.8.4\",\n    \"react\": \"^19.1.0\",\n    \"react-dom\": \"^19.1.0\",\n    \"react-markdown\": \"^10.1.0\",\n    \"react-scripts\": \"5.0.1\",\n    \"web-vitals\": \"^2.1.4\"\n  },\n  \"scripts\": {\n    \"start\": \"react-scripts start\",\n    \"build\": \"react-scripts build\",\n    \"test\": \"react-scripts test\",\n    \"eject\": \"react-scripts eject\"\n  },\n  \"eslintConfig\": {\n    \"extends\": [\n      \"react-app\",\n      \"react-app/jest\"\n    ]\n  },\n  \"browserslist\": {\n    \"production\": [\n      \">0.2%\",\n      \"not dead\",\n      \"not op_mini all\"\n    ],\n    \"development\": [\n      \"last 1 chrome version\",\n      \"last 1 firefox version\",\n      \"last 1 safari version\"\n    ]\n  }\n}\n"
  },
  {
    "path": "frontend/agentic-seek-front/public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <meta charset=\"utf-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n    <title>AgenticSeek</title>\n    <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n    <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n    <link href=\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">\n  </head>\n  <body>\n    <div id=\"root\"></div>\n  </body>\n</html>"
  },
  {
    "path": "frontend/agentic-seek-front/public/manifest.json",
    "content": "{\n  \"short_name\": \"React App\",\n  \"name\": \"Create React App Sample\",\n  \"icons\": [\n    {\n      \"src\": \"favicon.ico\",\n      \"sizes\": \"64x64 32x32 24x24 16x16\",\n      \"type\": \"image/x-icon\"\n    },\n    {\n      \"src\": \"logo192.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"192x192\"\n    },\n    {\n      \"src\": \"logo512.png\",\n      \"type\": \"image/png\",\n      \"sizes\": \"512x512\"\n    }\n  ],\n  \"start_url\": \".\",\n  \"display\": \"standalone\",\n  \"theme_color\": \"#000000\",\n  \"background_color\": \"#ffffff\"\n}\n"
  },
  {
    "path": "frontend/agentic-seek-front/public/robots.txt",
    "content": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/App.css",
    "content": "* {\n  margin: 0;\n  padding: 0;\n  box-sizing: border-box;\n}\n\nhtml,\nbody,\n#root {\n  height: 100%;\n  overflow: hidden;\n}\n\nbody {\n  font-family: \"Inter\", -apple-system, BlinkMacSystemFont, \"Segoe UI\",\n    sans-serif;\n  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);\n  color: #f8fafc;\n  overflow-x: hidden;\n  min-height: 100vh;\n}\n\n.app {\n  height: 100vh;\n  display: flex;\n  flex-direction: column;\n  background-color: var(--background);\n  color: var(--foreground);\n  overflow: hidden;\n}\n\n.header {\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  padding: 1rem 2rem;\n  border-bottom: 1px solid var(--border);\n  background-color: var(--background);\n  flex-shrink: 0;\n  height: 70px;\n}\n\n.header::before {\n  content: \"\";\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  height: 1px;\n  background: linear-gradient(90deg, transparent, var(--accent), transparent);\n}\n\n.header-brand {\n  display: flex;\n  align-items: center;\n  gap: 16px;\n}\n\n.logo-container {\n  position: relative;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n}\n\n.logo-icon {\n  width: 36px;\n  height: 36px;\n  transition: all 0.3s ease;\n}\n\n.logo-pulse {\n  position: absolute;\n  top: 50%;\n  left: 50%;\n  transform: translate(-50%, -50%);\n  width: 36px;\n  height: 36px;\n  border: 2px solid var(--accent);\n  border-radius: 50%;\n  opacity: 0;\n  animation: pulse 2s infinite;\n}\n\n@keyframes pulse {\n  0% {\n    transform: translate(-50%, -50%) scale(1);\n    opacity: 0.7;\n  }\n  70% {\n    transform: translate(-50%, -50%) scale(1.4);\n    opacity: 0;\n  }\n  100% {\n    transform: translate(-50%, -50%) scale(1.4);\n    opacity: 0;\n  }\n}\n\n.brand-text {\n  display: flex;\n  flex-direction: column;\n  gap: 2px;\n}\n\n.header h1 {\n  font-size: 1.5rem;\n  font-weight: 700;\n  color: var(--foreground);\n  margin: 0;\n}\n\n.brand-subtitle {\n  font-size: 0.75rem;\n  color: var(--muted-foreground);\n  font-weight: 500;\n  letter-spacing: 0.5px;\n  text-transform: uppercase;\n}\n\n.header-status {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n}\n\n.status-indicator {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n  padding: 6px 12px;\n  border-radius: 20px;\n  background-color: var(--muted);\n  border: 1px solid var(--border);\n  transition: all 0.3s ease;\n}\n\n.status-indicator.online {\n  background-color: rgba(34, 197, 94, 0.1);\n  border-color: rgba(34, 197, 94, 0.3);\n}\n\n.status-indicator.offline {\n  background-color: rgba(239, 68, 68, 0.1);\n  border-color: rgba(239, 68, 68, 0.3);\n}\n\n.status-dot {\n  width: 8px;\n  height: 8px;\n  border-radius: 50%;\n  background-color: var(--muted-foreground);\n  transition: all 0.3s ease;\n}\n\n.status-indicator.online .status-dot {\n  background-color: #22c55e;\n  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);\n  animation: statusPulse 2s infinite;\n}\n\n.status-indicator.offline .status-dot {\n  background-color: #ef4444;\n}\n\n@keyframes statusPulse {\n  0%,\n  100% {\n    opacity: 1;\n    transform: scale(1);\n  }\n  50% {\n    opacity: 0.7;\n    transform: scale(1.2);\n  }\n}\n\n.status-text {\n  font-size: 0.75rem;\n  font-weight: 600;\n  color: var(--foreground);\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n}\n\n.header-actions {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n\n.action-button {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  gap: 8px;\n  min-width: 44px;\n  height: 44px;\n  padding: 0 12px;\n  border-radius: 12px;\n  border: 1px solid var(--border);\n  background: var(--card);\n  color: var(--foreground);\n  text-decoration: none;\n  font-size: 0.875rem;\n  font-weight: 500;\n  cursor: pointer;\n  transition: all 0.3s ease;\n  position: relative;\n  overflow: hidden;\n}\n\n.action-button::before {\n  content: \"\";\n  position: absolute;\n  top: 0;\n  left: -100%;\n  width: 100%;\n  height: 100%;\n  background: linear-gradient(\n    90deg,\n    transparent,\n    rgba(255, 255, 255, 0.1),\n    transparent\n  );\n  transition: left 0.5s ease;\n}\n\n.action-button:hover::before {\n  left: 100%;\n}\n\n.action-button:hover {\n  background: var(--muted);\n  color: var(--foreground);\n  transform: translateY(-2px);\n  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);\n  border-color: var(--border);\n}\n\n.action-button.github-link:hover {\n  background: #24292e;\n  border-color: #24292e;\n  color: white;\n  box-shadow: 0 8px 25px rgba(36, 41, 46, 0.3);\n}\n\n.action-text {\n  font-size: 0.8rem;\n  font-weight: 600;\n  display: none;\n}\n\n@media (min-width: 768px) {\n  .action-text {\n    display: block;\n  }\n\n  .action-button {\n    min-width: auto;\n    padding: 0 16px;\n  }\n}\n\n.main {\n  flex: 1;\n  padding: 1rem 2rem;\n  overflow: hidden;\n  display: flex;\n  flex-direction: column;\n}\n\n.section-tabs {\n  display: flex;\n  gap: 8px;\n  width: 100%;\n  max-width: 800px;\n  justify-content: center;\n}\n\n.section-tabs button {\n  padding: 10px 20px;\n  background-color: #2d3748; /* Slightly lighter than darkCard */\n  color: #cbd5e1; /* darkTextSecondary */\n  border: none;\n  border-radius: 8px;\n  cursor: pointer;\n  font-size: 0.95rem;\n  font-weight: 500;\n  transition: all 0.2s ease;\n}\n\n.section-tabs button.active {\n  background-color: #0066cc; /* primary */\n  color: #ffffff; /* white */\n}\n\n.section-tabs button:hover:not(.active) {\n  background-color: #4a5568; /* Medium gray */\n  color: #f8fafc; /* darkText */\n}\n\n.app-sections {\n  display: flex;\n  gap: 1rem;\n  height: 100%;\n  overflow: hidden;\n}\n\n.left-panel,\n.right-panel {\n  background-color: #1e293b; /* darkCard */\n  border: 1px solid #334155; /* darkBorder */\n  border-radius: 8px;\n  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),\n    0 2px 4px -1px rgba(0, 0, 0, 0.06);\n  display: flex;\n  flex-direction: column;\n  overflow: hidden;\n}\n\n.left-panel {\n  padding: 0;\n  display: flex;\n  flex-direction: column;\n}\n\n.task-section,\n.chat-section,\n.computer-section {\n  background: var(--card);\n  backdrop-filter: blur(20px);\n  border: 1px solid var(--border);\n  border-radius: 16px;\n  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);\n  padding: 24px;\n  display: flex;\n  flex-direction: column;\n  overflow: hidden;\n  position: relative;\n  height: 100%;\n  width: 100%;\n}\n\n.task-section::before,\n.chat-section::before,\n.computer-section::before {\n  content: \"\";\n  position: absolute;\n  top: 0;\n  left: 0;\n  right: 0;\n  height: 1px;\n  background: linear-gradient(\n    90deg,\n    transparent,\n    rgba(96, 165, 250, 0.5),\n    transparent\n  );\n}\n\n.task-section h2,\n.chat-section h2,\n.computer-section h2 {\n  font-size: 1.25rem;\n  font-weight: 600;\n  color: var(--foreground);\n  margin-bottom: 20px;\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n\n.task-section h2::before {\n  content: \"💼\";\n  font-size: 1.1rem;\n}\n\n.chat-section h2::before {\n  content: \"💬\";\n  font-size: 1.1rem;\n}\n\n.computer-section h2::before {\n  content: \"🖥️\";\n  font-size: 1.1rem;\n}\n\n.task-details {\n  flex: 1;\n  overflow-y: auto;\n  background-color: var(--muted);\n  border-radius: 8px;\n  padding: 16px;\n  margin-top: 12px;\n}\n\n.screenshot-container {\n  flex: 1;\n  overflow: auto;\n  margin-top: 12px;\n  display: flex;\n  justify-content: center;\n  align-items: flex-start;\n  background-color: var(--muted);\n  border-radius: 8px;\n  padding: 16px;\n}\n\n.screenshot-container img {\n  max-width: 100%;\n  border: 1px solid var(--border);\n  border-radius: 4px;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n.left-panel h2,\n.right-panel h2 {\n  font-size: 1.1rem;\n  font-weight: 600;\n  color: var(--foreground);\n  margin-bottom: 8px;\n  letter-spacing: 1px;\n}\n\n.messages {\n  flex: 1;\n  overflow-y: auto;\n  display: flex;\n  flex-direction: column;\n  gap: 1rem;\n  margin-bottom: 1rem;\n  padding-right: 0.5rem;\n  min-height: 0;\n}\n\n.messages::-webkit-scrollbar {\n  width: 6px;\n}\n\n.messages::-webkit-scrollbar-track {\n  background: var(--muted);\n  border-radius: 3px;\n}\n\n.messages::-webkit-scrollbar-thumb {\n  background: var(--muted-foreground);\n  border-radius: 3px;\n}\n\n.placeholder {\n  text-align: center;\n  color: var(--muted-foreground);\n  margin: 2rem 0;\n  font-size: 0.875rem;\n}\n\n.message {\n  max-width: 85%;\n  padding: 0.75rem 1rem;\n  border-radius: 8px;\n  font-size: 0.875rem;\n  line-height: 1.5;\n  position: relative;\n  animation: messageSlide 0.3s ease-out;\n}\n\n@keyframes messageSlide {\n  from {\n    opacity: 0;\n    transform: translateY(20px);\n  }\n  to {\n    opacity: 1;\n    transform: translateY(0);\n  }\n}\n\n.user-message {\n  background-color: var(--accent);\n  color: var(--accent-foreground);\n  align-self: flex-end;\n}\n\n.agent-message {\n  background-color: var(--muted);\n  color: var(--foreground);\n  align-self: flex-start;\n  border: 1px solid var(--border);\n}\n\n.error-message {\n  background-color: var(--destructive);\n  color: var(--destructive-foreground);\n  align-self: flex-start;\n}\n\n.message-header {\n  display: flex;\n  flex-direction: column;\n  gap: 0.5rem;\n  margin-bottom: 0.5rem;\n}\n\n.agent-name {\n  font-size: 0.75rem;\n  color: var(--muted-foreground);\n  font-weight: 500;\n}\n\n.reasoning-toggle {\n  background-color: var(--secondary);\n  border: 1px solid var(--border);\n  border-radius: 6px;\n  color: var(--secondary-foreground);\n  padding: 0.25rem 0.5rem;\n  font-size: 0.75rem;\n  cursor: pointer;\n  transition: all 0.2s ease;\n  width: fit-content;\n}\n\n.reasoning-toggle:hover {\n  background-color: var(--muted);\n}\n\n.reasoning-content {\n  margin-top: 0.75rem;\n  padding: 0.75rem;\n  background-color: var(--secondary);\n  border: 1px solid var(--border);\n  border-radius: 6px;\n  font-size: 0.8rem;\n}\n\n.loading-animation {\n  text-align: center;\n  color: var(--muted-foreground);\n  padding: 0.75rem;\n  font-size: 0.875rem;\n  border-top: 1px solid var(--border);\n  flex-shrink: 0;\n}\n\n.input-form {\n  display: flex;\n  align-items: center;\n  gap: 0.75rem;\n  padding: 0.75rem 1rem;\n  background-color: var(--card);\n  border-radius: 24px;\n  border: 1px solid var(--border);\n  flex-shrink: 0;\n  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n  transition: all 0.2s ease;\n}\n\n.input-form:focus-within {\n  border-color: var(--accent);\n  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);\n}\n\n.input-form input {\n  flex: 1;\n  padding: 0.75rem 1rem;\n  font-size: 0.95rem;\n  background-color: transparent;\n  border: none;\n  color: var(--foreground);\n  border-radius: 20px;\n  outline: none;\n  font-family: inherit;\n}\n\n.input-form input::placeholder {\n  color: var(--muted-foreground);\n}\n\n.input-form .action-buttons {\n  display: flex;\n  gap: 0.5rem;\n  align-items: center;\n}\n\n.input-form .icon-button {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  width: 40px;\n  height: 40px;\n  background-color: var(--foreground);\n  color: var(--background);\n  border: none;\n  border-radius: 50%;\n  cursor: pointer;\n  font-weight: 500;\n  transition: all 0.2s ease;\n  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.input-form .icon-button:hover {\n  transform: translateY(-1px);\n  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);\n  background-color: var(--muted-foreground);\n}\n\n.input-form .icon-button:disabled {\n  opacity: 0.5;\n  cursor: not-allowed;\n  transform: none;\n  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);\n}\n\n.input-form .icon-button.stop-button {\n  background-color: var(--destructive);\n  color: var(--destructive-foreground);\n}\n\n.input-form .icon-button.stop-button:hover {\n  background-color: #dc2626;\n}\n\n.view-selector {\n  display: flex;\n  gap: 0.25rem;\n  margin-bottom: 1rem;\n  padding: 0.25rem;\n  background-color: var(--muted);\n  border-radius: 8px;\n  flex-shrink: 0;\n}\n\n.view-selector button {\n  padding: 0.5rem 1rem;\n  font-size: 0.875rem;\n  background-color: transparent;\n  color: var(--muted-foreground);\n  border: none;\n  border-radius: 6px;\n  cursor: pointer;\n  font-weight: 500;\n  transition: all 0.2s ease;\n  flex: 1;\n}\n\n.view-selector button.active {\n  background-color: var(--background);\n  color: var(--foreground);\n}\n\n.view-selector button:hover:not(.active) {\n  color: var(--foreground);\n}\n\n.content {\n  flex: 1;\n  overflow-y: auto;\n  min-height: 0;\n}\n\n.content::-webkit-scrollbar {\n  width: 6px;\n}\n\n.content::-webkit-scrollbar-track {\n  background: var(--muted);\n  border-radius: 3px;\n}\n\n.content::-webkit-scrollbar-thumb {\n  background: var(--muted-foreground);\n  border-radius: 3px;\n}\n\n.blocks {\n  display: flex;\n  flex-direction: column;\n  gap: 1rem;\n}\n\n.block {\n  background-color: var(--card);\n  padding: 1rem;\n  border: 1px solid var(--border);\n  border-radius: 8px;\n}\n\n.block-tool,\n.block-feedback,\n.block-success,\n.block-failure {\n  font-size: 0.875rem;\n  margin-bottom: 0.5rem;\n  font-weight: 500;\n}\n\n.block-success {\n  color: #22c55e;\n}\n\n.block-failure {\n  color: #ef4444;\n}\n\n.block-failure::before {\n  content: \"❌\";\n}\n\n.block-feedback {\n  color: #cbd5e1;\n}\n\n.block-feedback::before {\n  content: \"💬\";\n}\n\n.block pre {\n  background: var(--muted);\n  padding: 16px;\n  border-radius: 8px;\n  font-size: 0.85rem;\n  white-space: pre-wrap;\n  word-break: break-all;\n  color: var(--muted-foreground);\n  margin: 12px 0;\n  font-family: \"JetBrains Mono\", \"Fira Code\", \"Menlo\", monospace;\n  border-left: 3px solid var(--muted-foreground);\n  overflow-x: auto;\n}\n\n.screenshot {\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  padding: 20px;\n  background: var(--muted);\n  border-radius: 12px;\n  border: 1px solid var(--border);\n}\n\n.screenshot img {\n  max-width: 100%;\n  border: 2px solid var(--border);\n  border-radius: 12px;\n  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);\n  transition: all 0.3s ease;\n}\n\n.screenshot img:hover {\n  transform: scale(1.02);\n  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);\n}\n\n.error {\n  color: var(--destructive-foreground);\n  font-size: 0.9rem;\n  margin-bottom: 16px;\n  padding: 12px 16px;\n  background: rgba(239, 68, 68, 0.1);\n  border-radius: 8px;\n  border-left: 3px solid var(--destructive);\n  display: flex;\n  align-items: center;\n  gap: 8px;\n}\n\n.error::before {\n  content: \"⚠️\";\n}\n\n@media (max-width: 1200px) {\n  .main {\n    padding: 24px;\n  }\n\n  .app-sections {\n    gap: 24px;\n  }\n}\n\n@media (max-width: 768px) {\n  .main {\n    padding: 16px;\n  }\n\n  .chat-section,\n  .computer-section {\n    height: 50vh;\n    min-height: 400px;\n  }\n\n  .header {\n    padding: 0.75rem 1.25rem;\n  }\n\n  .header h1 {\n    font-size: 1.75rem;\n  }\n\n  .message {\n    max-width: 90%;\n    padding: 12px 16px;\n  }\n\n  .view-selector button {\n    padding: 10px 16px;\n    font-size: 0.85rem;\n  }\n\n  .input-form {\n    padding: 0.75rem 1rem;\n    border-radius: 20px;\n  }\n\n  .input-form input {\n    padding: 0.75rem;\n    font-size: 0.9rem;\n  }\n\n  .input-form .icon-button {\n    width: 36px;\n    height: 36px;\n  }\n\n  .input-form .icon-button.stop-button {\n    width: 36px;\n    height: 36px;\n  }\n}\n\n@media (max-width: 480px) {\n  .main {\n    padding: 12px;\n  }\n\n  .chat-section,\n  .computer-section {\n    padding: 16px;\n    min-height: 350px;\n  }\n\n  .header h1 {\n    font-size: 1.5rem;\n  }\n\n  .message {\n    padding: 10px 14px;\n    font-size: 0.9rem;\n  }\n\n  .block {\n    padding: 16px;\n  }\n\n  .block pre {\n    font-size: 0.8rem;\n    padding: 12px;\n  }\n\n  .input-form {\n    padding: 0.5rem 0.75rem;\n  }\n\n  .input-form input {\n    padding: 0.5rem 0.75rem;\n    font-size: 0.85rem;\n  }\n\n  .input-form .icon-button {\n    width: 34px;\n    height: 34px;\n  }\n\n  .input-form .icon-button.stop-button {\n    width: 34px;\n    height: 34px;\n  }\n}\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/App.js",
    "content": "import React, { useState, useEffect, useRef, useCallback } from \"react\";\nimport ReactMarkdown from \"react-markdown\";\nimport axios from \"axios\";\nimport \"./App.css\";\nimport { ThemeToggle } from \"./components/ThemeToggle\";\nimport { ResizableLayout } from \"./components/ResizableLayout\";\nimport faviconPng from \"./logo.png\";\n\nconst BACKEND_URL = process.env.REACT_APP_BACKEND_URL;\nconsole.log(\"Using backend URL:\", BACKEND_URL);\n\nfunction App() {\n  const [query, setQuery] = useState(\"\");\n  const [messages, setMessages] = useState([]);\n  const [isLoading, setIsLoading] = useState(false);\n  const [error, setError] = useState(null);\n  const [currentView, setCurrentView] = useState(\"blocks\");\n  const [responseData, setResponseData] = useState(null);\n  const [isOnline, setIsOnline] = useState(false);\n  const [status, setStatus] = useState(\"Agents ready\");\n  const [expandedReasoning, setExpandedReasoning] = useState(new Set());\n  const messagesEndRef = useRef(null);\n\n  const fetchLatestAnswer = useCallback(async () => {\n    try {\n      const res = await axios.get(`${BACKEND_URL}/latest_answer`);\n      const data = res.data;\n\n      updateData(data);\n      if (!data.answer || data.answer.trim() === \"\") {\n        return;\n      }\n      const normalizedNewAnswer = normalizeAnswer(data.answer);\n      const answerExists = messages.some(\n        (msg) => normalizeAnswer(msg.content) === normalizedNewAnswer\n      );\n      if (!answerExists) {\n        setMessages((prev) => [\n          ...prev,\n          {\n            type: \"agent\",\n            content: data.answer,\n            reasoning: data.reasoning,\n            agentName: data.agent_name,\n            status: data.status,\n            uid: data.uid,\n          },\n        ]);\n        setStatus(data.status);\n        scrollToBottom();\n      } else {\n        console.log(\"Duplicate answer detected, skipping:\", data.answer);\n      }\n    } catch (error) {\n      console.error(\"Error fetching latest answer:\", error);\n    }\n  }, [messages]);\n\n  useEffect(() => {\n    const intervalId = setInterval(() => {\n      checkHealth();\n      fetchLatestAnswer();\n      fetchScreenshot();\n    }, 3000);\n    return () => clearInterval(intervalId);\n  }, [fetchLatestAnswer]);\n\n  const checkHealth = async () => {\n    try {\n      await axios.get(`${BACKEND_URL}/health`);\n      setIsOnline(true);\n      console.log(\"System is online\");\n    } catch {\n      setIsOnline(false);\n      console.log(\"System is offline\");\n    }\n  };\n\n  const fetchScreenshot = async () => {\n    try {\n      const timestamp = new Date().getTime();\n      const res = await axios.get(\n        `${BACKEND_URL}/screenshots/updated_screen.png?timestamp=${timestamp}`,\n        {\n          responseType: \"blob\",\n        }\n      );\n      console.log(\"Screenshot fetched successfully\");\n      const imageUrl = URL.createObjectURL(res.data);\n      setResponseData((prev) => {\n        if (prev?.screenshot && prev.screenshot !== \"placeholder.png\") {\n          URL.revokeObjectURL(prev.screenshot);\n        }\n        return {\n          ...prev,\n          screenshot: imageUrl,\n          screenshotTimestamp: new Date().getTime(),\n        };\n      });\n    } catch (err) {\n      console.error(\"Error fetching screenshot:\", err);\n      setResponseData((prev) => ({\n        ...prev,\n        screenshot: \"placeholder.png\",\n        screenshotTimestamp: new Date().getTime(),\n      }));\n    }\n  };\n\n  const normalizeAnswer = (answer) => {\n    return answer\n      .trim()\n      .toLowerCase()\n      .replace(/\\s+/g, \" \")\n      .replace(/[.,!?]/g, \"\");\n  };\n\n  const scrollToBottom = () => {\n    messagesEndRef.current?.scrollIntoView({ behavior: \"smooth\" });\n  };\n\n  const toggleReasoning = (messageIndex) => {\n    setExpandedReasoning((prev) => {\n      const newSet = new Set(prev);\n      if (newSet.has(messageIndex)) {\n        newSet.delete(messageIndex);\n      } else {\n        newSet.add(messageIndex);\n      }\n      return newSet;\n    });\n  };\n\n  const updateData = (data) => {\n    setResponseData((prev) => ({\n      ...prev,\n      blocks: data.blocks || prev.blocks || null,\n      done: data.done,\n      answer: data.answer,\n      agent_name: data.agent_name,\n      status: data.status,\n      uid: data.uid,\n    }));\n  };\n\n  const handleStop = async (e) => {\n    e.preventDefault();\n    checkHealth();\n    setIsLoading(false);\n    setError(null);\n    try {\n      await axios.get(`${BACKEND_URL}/stop`);\n      setStatus(\"Requesting stop...\");\n    } catch (err) {\n      console.error(\"Error stopping the agent:\", err);\n    }\n  };\n\n  const handleSubmit = async (e) => {\n    e.preventDefault();\n    checkHealth();\n    if (!query.trim()) {\n      console.log(\"Empty query\");\n      return;\n    }\n    setMessages((prev) => [...prev, { type: \"user\", content: query }]);\n    setIsLoading(true);\n    setError(null);\n\n    try {\n      console.log(\"Sending query:\", query);\n      setQuery(\"waiting for response...\");\n      const res = await axios.post(`${BACKEND_URL}/query`, {\n        query,\n        tts_enabled: false,\n      });\n      setQuery(\"Enter your query...\");\n      console.log(\"Response:\", res.data);\n      const data = res.data;\n      updateData(data);\n    } catch (err) {\n      console.error(\"Error:\", err);\n      setError(\"Failed to process query.\");\n      setMessages((prev) => [\n        ...prev,\n        { type: \"error\", content: \"Error: Unable to get a response.\" },\n      ]);\n    } finally {\n      console.log(\"Query completed\");\n      setIsLoading(false);\n      setQuery(\"\");\n    }\n  };\n\n  const handleGetScreenshot = async () => {\n    try {\n      setCurrentView(\"screenshot\");\n    } catch (err) {\n      setError(\"Browser not in use\");\n    }\n  };\n\n  return (\n    <div className=\"app\">\n      <header className=\"header\">\n        <div className=\"header-brand\">\n          <div className=\"logo-container\">\n            <img src={faviconPng} alt=\"AgenticSeek\" className=\"logo-icon\" />\n          </div>\n          <div className=\"brand-text\">\n            <h1>AgenticSeek</h1>\n          </div>\n        </div>\n        <div className=\"header-status\">\n          <div\n            className={`status-indicator ${isOnline ? \"online\" : \"offline\"}`}\n          >\n            <div className=\"status-dot\"></div>\n            <span className=\"status-text\">\n              {isOnline ? \"Online\" : \"Offline\"}\n            </span>\n          </div>\n        </div>\n        <div className=\"header-actions\">\n          <a\n            href=\"https://github.com/Fosowl/agenticSeek\"\n            target=\"_blank\"\n            rel=\"noopener noreferrer\"\n            className=\"action-button github-link\"\n            aria-label=\"View on GitHub\"\n          >\n            <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"currentColor\">\n              <path d=\"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z\" />\n            </svg>\n            <span className=\"action-text\">GitHub</span>\n          </a>\n          <div>\n            <ThemeToggle />\n          </div>\n        </div>\n      </header>\n      <main className=\"main\">\n        <ResizableLayout initialLeftWidth={50}>\n          <div className=\"chat-section\">\n            <h2>Chat Interface</h2>\n            <div className=\"messages\">\n              {messages.length === 0 ? (\n                <p className=\"placeholder\">\n                  No messages yet. Type below to start!\n                </p>\n              ) : (\n                messages.map((msg, index) => (\n                  <div\n                    key={index}\n                    className={`message ${\n                      msg.type === \"user\"\n                        ? \"user-message\"\n                        : msg.type === \"agent\"\n                        ? \"agent-message\"\n                        : \"error-message\"\n                    }`}\n                  >\n                    <div className=\"message-header\">\n                      {msg.type === \"agent\" && (\n                        <span className=\"agent-name\">{msg.agentName}</span>\n                      )}\n                      {msg.type === \"agent\" &&\n                        msg.reasoning &&\n                        expandedReasoning.has(index) && (\n                          <div className=\"reasoning-content\">\n                            <ReactMarkdown>{msg.reasoning}</ReactMarkdown>\n                          </div>\n                        )}\n                      {msg.type === \"agent\" && (\n                        <button\n                          className=\"reasoning-toggle\"\n                          onClick={() => toggleReasoning(index)}\n                          title={\n                            expandedReasoning.has(index)\n                              ? \"Hide reasoning\"\n                              : \"Show reasoning\"\n                          }\n                        >\n                          {expandedReasoning.has(index) ? \"▼\" : \"▶\"} Reasoning\n                        </button>\n                      )}\n                    </div>\n                    <div className=\"message-content\">\n                      <ReactMarkdown>{msg.content}</ReactMarkdown>\n                    </div>\n                  </div>\n                ))\n              )}\n              <div ref={messagesEndRef} />\n            </div>\n            {isOnline && <div className=\"loading-animation\">{status}</div>}\n            {!isLoading && !isOnline && (\n              <p className=\"loading-animation\">\n                System offline. Deploy backend first.\n              </p>\n            )}\n            <form onSubmit={handleSubmit} className=\"input-form\">\n              <input\n                type=\"text\"\n                value={query}\n                onChange={(e) => setQuery(e.target.value)}\n                placeholder=\"Type your query...\"\n                disabled={isLoading}\n              />\n              <div className=\"action-buttons\">\n                <button\n                  type=\"submit\"\n                  disabled={isLoading}\n                  className=\"icon-button\"\n                  aria-label=\"Send message\"\n                >\n                  <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\">\n                    <path\n                      d=\"M22 2L11 13M22 2L15 22L11 13M22 2L2 9L11 13\"\n                      stroke=\"currentColor\"\n                      strokeWidth=\"2\"\n                      strokeLinecap=\"round\"\n                      strokeLinejoin=\"round\"\n                    />\n                  </svg>\n                </button>\n                <button\n                  type=\"button\"\n                  onClick={handleStop}\n                  className=\"icon-button stop-button\"\n                  aria-label=\"Stop processing\"\n                >\n                  <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\">\n                    <rect\n                      x=\"6\"\n                      y=\"6\"\n                      width=\"12\"\n                      height=\"12\"\n                      fill=\"currentColor\"\n                      rx=\"2\"\n                    />\n                  </svg>\n                </button>\n              </div>\n            </form>\n          </div>\n\n          <div className=\"computer-section\">\n            <h2>Computer View</h2>\n            <div className=\"view-selector\">\n              <button\n                className={currentView === \"blocks\" ? \"active\" : \"\"}\n                onClick={() => setCurrentView(\"blocks\")}\n              >\n                Editor View\n              </button>\n              <button\n                className={currentView === \"screenshot\" ? \"active\" : \"\"}\n                onClick={\n                  responseData?.screenshot\n                    ? () => setCurrentView(\"screenshot\")\n                    : handleGetScreenshot\n                }\n              >\n                Browser View\n              </button>\n            </div>\n            <div className=\"content\">\n              {error && <p className=\"error\">{error}</p>}\n              {currentView === \"blocks\" ? (\n                <div className=\"blocks\">\n                  {responseData &&\n                  responseData.blocks &&\n                  Object.values(responseData.blocks).length > 0 ? (\n                    Object.values(responseData.blocks).map((block, index) => (\n                      <div key={index} className=\"block\">\n                        <p className=\"block-tool\">Tool: {block.tool_type}</p>\n                        <pre>{block.block}</pre>\n                        <p className=\"block-feedback\">\n                          Feedback: {block.feedback}\n                        </p>\n                        {block.success ? (\n                          <p className=\"block-success\">Success</p>\n                        ) : (\n                          <p className=\"block-failure\">Failure</p>\n                        )}\n                      </div>\n                    ))\n                  ) : (\n                    <div className=\"block\">\n                      <p className=\"block-tool\">Tool: No tool in use</p>\n                      <pre>No file opened</pre>\n                    </div>\n                  )}\n                </div>\n              ) : (\n                <div className=\"screenshot\">\n                  <img\n                    src={responseData?.screenshot || \"placeholder.png\"}\n                    alt=\"Screenshot\"\n                    onError={(e) => {\n                      e.target.src = \"placeholder.png\";\n                      console.error(\"Failed to load screenshot\");\n                    }}\n                    key={responseData?.screenshotTimestamp || \"default\"}\n                  />\n                </div>\n              )}\n            </div>\n          </div>\n        </ResizableLayout>\n      </main>\n    </div>\n  );\n}\n\nexport default App;\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/App.test.js",
    "content": "import { render, screen } from '@testing-library/react';\nimport App from './App';\n\ntest('renders learn react link', () => {\n  render(<App />);\n  const linkElement = screen.getByText(/learn react/i);\n  expect(linkElement).toBeInTheDocument();\n});\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/colors.js",
    "content": "export const colors = {\n  // Primary colors - matching the dashboard theme\n  primary: \"#2563eb\",\n  primaryLight: \"#dbeafe\",\n  primaryDark: \"#1d4ed8\",\n\n  // Secondary colors - modern grays\n  secondary: \"#64748b\",\n  secondaryLight: \"#f1f5f9\",\n  secondaryDark: \"#1e293b\",\n\n  // Accent colors\n  accent: \"#f59e0b\",\n  accentLight: \"#fef3c7\",\n  accentDark: \"#d97706\",\n\n  // Status colors\n  success: \"#10b981\",\n  successLight: \"#d1fae5\",\n  warning: \"#f59e0b\",\n  warningLight: \"#fef3c7\",\n  error: \"#ef4444\",\n  errorLight: \"#fee2e2\",\n  info: \"#06b6d4\",\n  infoLight: \"#cffafe\",\n\n  // Neutral colors - modern palette\n  white: \"#ffffff\",\n  gray50: \"#f8fafc\",\n  gray100: \"#f1f5f9\",\n  gray200: \"#e2e8f0\",\n  gray300: \"#cbd5e1\",\n  gray400: \"#94a3b8\",\n  gray500: \"#64748b\",\n  gray600: \"#475569\",\n  gray700: \"#334155\",\n  gray800: \"#1e293b\",\n  gray900: \"#0f172a\",\n  black: \"#000000\",\n\n  // Text colors\n  textPrimary: \"#0f172a\",\n  textSecondary: \"#64748b\",\n  textDisabled: \"#94a3b8\",\n\n  // Background colors\n  background: \"#f8fafc\",\n  card: \"#ffffff\",\n\n  // Border colors\n  border: \"#e2e8f0\",\n  divider: \"#f1f5f9\",\n\n  // Transparent colors\n  transparent: \"transparent\",\n  semiTransparent: \"rgba(15, 23, 42, 0.6)\",\n\n  // Dark theme colors\n  darkBackground: \"#0f172a\",\n  darkCard: \"#1e293b\",\n  darkBorder: \"#334155\",\n  darkText: \"#f8fafc\",\n  darkTextSecondary: \"#cbd5e1\",\n};\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/components/ResizableLayout.css",
    "content": ".resizable-container {\n  display: flex;\n  width: 100%;\n  height: 100%;\n  overflow: hidden;\n}\n\n.resizable-left,\n.resizable-right {\n  height: 100%;\n  overflow: hidden;\n  min-width: 0;\n}\n\n.resize-handle {\n  width: 8px;\n  background-color: transparent;\n  cursor: col-resize;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  padding: 0 2px;\n  transition: background-color 0.2s ease;\n  position: relative;\n  flex-shrink: 0;\n}\n\n.resize-handle:hover {\n  background-color: var(--accent);\n}\n\n.resize-handle-line {\n  width: 2px;\n  height: 40px;\n  background-color: var(--border);\n  border-radius: 1px;\n  transition: all 0.2s ease;\n}\n\n.resize-handle:hover .resize-handle-line {\n  background-color: var(--accent-foreground);\n  height: 60px;\n}\n\n.resizable-container.dragging .resize-handle {\n  background-color: var(--accent);\n}\n\n.resizable-container.dragging .resize-handle-line {\n  background-color: var(--accent-foreground);\n  height: 100vh;\n}\n\n/* Mobile responsiveness */\n@media (max-width: 768px) {\n  .resizable-container {\n    flex-direction: column;\n  }\n\n  .resizable-left,\n  .resizable-right {\n    width: 100% !important;\n    height: 50vh;\n  }\n\n  .resize-handle {\n    display: none;\n  }\n}\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/components/ResizableLayout.js",
    "content": "import React, { useState, useRef, useCallback } from \"react\";\nimport \"./ResizableLayout.css\";\n\nexport const ResizableLayout = ({ children, initialLeftWidth = 50 }) => {\n  const [leftWidth, setLeftWidth] = useState(initialLeftWidth);\n  const [isDragging, setIsDragging] = useState(false);\n  const containerRef = useRef(null);\n\n  const handleMouseDown = useCallback((e) => {\n    e.preventDefault();\n    setIsDragging(true);\n  }, []);\n\n  const handleMouseMove = useCallback(\n    (e) => {\n      if (!isDragging || !containerRef.current) return;\n\n      const containerRect = containerRef.current.getBoundingClientRect();\n      const newLeftWidth =\n        ((e.clientX - containerRect.left) / containerRect.width) * 100;\n\n      // Constrain between 20% and 80%\n      const constrainedWidth = Math.max(20, Math.min(80, newLeftWidth));\n      setLeftWidth(constrainedWidth);\n    },\n    [isDragging]\n  );\n\n  const handleMouseUp = useCallback(() => {\n    setIsDragging(false);\n  }, []);\n\n  React.useEffect(() => {\n    if (isDragging) {\n      document.addEventListener(\"mousemove\", handleMouseMove);\n      document.addEventListener(\"mouseup\", handleMouseUp);\n      document.body.style.cursor = \"col-resize\";\n      document.body.style.userSelect = \"none\";\n    } else {\n      document.removeEventListener(\"mousemove\", handleMouseMove);\n      document.removeEventListener(\"mouseup\", handleMouseUp);\n      document.body.style.cursor = \"\";\n      document.body.style.userSelect = \"\";\n    }\n\n    return () => {\n      document.removeEventListener(\"mousemove\", handleMouseMove);\n      document.removeEventListener(\"mouseup\", handleMouseUp);\n      document.body.style.cursor = \"\";\n      document.body.style.userSelect = \"\";\n    };\n  }, [isDragging, handleMouseMove, handleMouseUp]);\n\n  return (\n    <div\n      ref={containerRef}\n      className={`resizable-container ${isDragging ? \"dragging\" : \"\"}`}\n    >\n      <div className=\"resizable-left\" style={{ width: `${leftWidth}%` }}>\n        {children[0]}\n      </div>\n      <div className=\"resize-handle\" onMouseDown={handleMouseDown}>\n        <div className=\"resize-handle-line\" />\n      </div>\n      <div className=\"resizable-right\" style={{ width: `${100 - leftWidth}%` }}>\n        {children[1]}\n      </div>\n    </div>\n  );\n};\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/components/ThemeToggle.js",
    "content": "import React from \"react\";\nimport { useTheme } from \"../contexts/ThemeContext\";\n\nexport const ThemeToggle = () => {\n  const { isDark, toggleTheme } = useTheme();\n\n  return (\n    <button\n      onClick={toggleTheme}\n      className=\"theme-toggle\"\n      aria-label=\"Toggle theme\"\n    >\n      {isDark ? (\n        <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\">\n          <circle cx=\"12\" cy=\"12\" r=\"5\" stroke=\"currentColor\" strokeWidth=\"2\" />\n          <path\n            d=\"M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42\"\n            stroke=\"currentColor\"\n            strokeWidth=\"2\"\n          />\n        </svg>\n      ) : (\n        <svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\">\n          <path\n            d=\"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z\"\n            stroke=\"currentColor\"\n            strokeWidth=\"2\"\n            fill=\"currentColor\"\n          />\n        </svg>\n      )}\n    </button>\n  );\n};\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/contexts/ThemeContext.js",
    "content": "import React, { createContext, useContext, useState, useEffect } from \"react\";\n\nconst ThemeContext = createContext();\n\nexport const ThemeProvider = ({ children }) => {\n  const [isDark, setIsDark] = useState(() => {\n    const saved = localStorage.getItem(\"theme\");\n    return saved ? saved === \"dark\" : true; // Default to dark\n  });\n\n  useEffect(() => {\n    localStorage.setItem(\"theme\", isDark ? \"dark\" : \"light\");\n    document.documentElement.setAttribute(\n      \"data-theme\",\n      isDark ? \"dark\" : \"light\"\n    );\n  }, [isDark]);\n\n  const toggleTheme = () => setIsDark(!isDark);\n\n  return (\n    <ThemeContext.Provider value={{ isDark, toggleTheme }}>\n      {children}\n    </ThemeContext.Provider>\n  );\n};\n\nexport const useTheme = () => {\n  const context = useContext(ThemeContext);\n  if (!context) {\n    throw new Error(\"useTheme must be used within ThemeProvider\");\n  }\n  return context;\n};\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/index.css",
    "content": "body {\n  margin: 0;\n  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',\n    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',\n    sans-serif;\n  -webkit-font-smoothing: antialiased;\n  -moz-osx-font-smoothing: grayscale;\n}\n\ncode {\n  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',\n    monospace;\n}\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/index.js",
    "content": "import React from \"react\";\nimport ReactDOM from \"react-dom/client\";\nimport App from \"./App\";\nimport { ThemeProvider } from \"./contexts/ThemeContext\";\nimport \"./styles/globals.css\";\n\nconst root = ReactDOM.createRoot(document.getElementById(\"root\"));\nroot.render(\n  <React.StrictMode>\n    <ThemeProvider>\n      <App />\n    </ThemeProvider>\n  </React.StrictMode>\n);\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/reportWebVitals.js",
    "content": "const reportWebVitals = onPerfEntry => {\n  if (onPerfEntry && onPerfEntry instanceof Function) {\n    import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {\n      getCLS(onPerfEntry);\n      getFID(onPerfEntry);\n      getFCP(onPerfEntry);\n      getLCP(onPerfEntry);\n      getTTFB(onPerfEntry);\n    });\n  }\n};\n\nexport default reportWebVitals;\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/setupTests.js",
    "content": "// jest-dom adds custom jest matchers for asserting on DOM nodes.\n// allows you to do things like:\n// expect(element).toHaveTextContent(/react/i)\n// learn more: https://github.com/testing-library/jest-dom\nimport '@testing-library/jest-dom';\n"
  },
  {
    "path": "frontend/agentic-seek-front/src/styles/globals.css",
    "content": ":root {\n  --background: hsl(0 0% 100%);\n  --foreground: hsl(222.2 47.4% 11.2%);\n  --muted: hsl(210 40% 96.1%);\n  --muted-foreground: hsl(215.4 16.3% 46.9%);\n  --popover: hsl(0 0% 100%);\n  --popover-foreground: hsl(222.2 47.4% 11.2%);\n  --card: hsl(0 0% 100%);\n  --card-foreground: hsl(222.2 47.4% 11.2%);\n  --border: hsl(214.3 31.8% 91.4%);\n  --input: hsl(214.3 31.8% 91.4%);\n  --primary: hsl(222.2 47.4% 11.2%);\n  --primary-foreground: hsl(210 40% 98%);\n  --secondary: hsl(210 40% 96.1%);\n  --secondary-foreground: hsl(222.2 47.4% 11.2%);\n  --accent: hsl(210 40% 96.1%);\n  --accent-foreground: hsl(222.2 47.4% 11.2%);\n  --destructive: hsl(0 100% 50%);\n  --destructive-foreground: hsl(210 40% 98%);\n  --ring: hsl(215 20.2% 65.1%);\n  --radius: 0.5rem;\n}\n\n.dark {\n  --background: hsl(224 71% 4%);\n  --foreground: hsl(213 31% 91%);\n  --muted: hsl(223 47% 11%);\n  --muted-foreground: hsl(215.4 16.3% 56.9%);\n  --popover: hsl(224 71% 4%);\n  --popover-foreground: hsl(215 20.2% 65.1%);\n  --card: hsl(224 71% 4%);\n  --card-foreground: hsl(213 31% 91%);\n  --border: hsl(216 34% 17%);\n  --input: hsl(216 34% 17%);\n  --primary: hsl(210 40% 98%);\n  --primary-foreground: hsl(222.2 47.4% 1.2%);\n  --secondary: hsl(222.2 47.4% 11.2%);\n  --secondary-foreground: hsl(210 40% 98%);\n  --accent: hsl(216 34% 17%);\n  --accent-foreground: hsl(210 40% 98%);\n  --destructive: hsl(0 63% 31%);\n  --destructive-foreground: hsl(210 40% 98%);\n  --ring: hsl(216 34% 17%);\n  --radius: 0.5rem;\n}\n\n[data-theme=\"dark\"] {\n  --background: #0a0a0a;\n  --foreground: #fafafa;\n  --card: #1a1a1a;\n  --card-foreground: #fafafa;\n  --popover: #1a1a1a;\n  --popover-foreground: #fafafa;\n  --primary: #fafafa;\n  --primary-foreground: #0a0a0a;\n  --secondary: #2a2a2a;\n  --secondary-foreground: #fafafa;\n  --muted: #1e1e1e;\n  --muted-foreground: #a1a1aa;\n  --accent: #6b7280;\n  --accent-foreground: #ffffff;\n  --destructive: #ef4444;\n  --destructive-foreground: #ffffff;\n  --border: #333333;\n  --input: #333333;\n  --ring: #6b7280;\n}\n\n[data-theme=\"light\"] {\n  --background: #ffffff;\n  --foreground: #0a0a0a;\n  --card: #ffffff;\n  --card-foreground: #0a0a0a;\n  --popover: #ffffff;\n  --popover-foreground: #0a0a0a;\n  --primary: #0a0a0a;\n  --primary-foreground: #ffffff;\n  --secondary: #f5f5f5;\n  --secondary-foreground: #0a0a0a;\n  --muted: #f5f5f5;\n  --muted-foreground: #737373;\n  --accent: #6b7280;\n  --accent-foreground: #ffffff;\n  --destructive: #ef4444;\n  --destructive-foreground: #ffffff;\n  --border: #e5e5e5;\n  --input: #e5e5e5;\n  --ring: #6b7280;\n}\n\n* {\n  margin: 0;\n  padding: 0;\n  box-sizing: border-box;\n}\n\nbody {\n  background-color: var(--background);\n  color: var(--foreground);\n  font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\",\n    sans-serif;\n  transition: background-color 0.3s ease, color 0.3s ease;\n  margin: 0;\n  padding: 0;\n  height: 100vh;\n  overflow: hidden;\n}\n\nhtml,\nbody,\n#root {\n  height: 100%;\n  overflow: hidden;\n}\n\n.theme-toggle {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  gap: 8px;\n  min-width: 44px;\n  height: 44px;\n  padding: 0 12px;\n  border-radius: 12px;\n  border: 1px solid var(--border);\n  background: var(--card);\n  color: var(--foreground);\n  text-decoration: none;\n  font-size: 0.875rem;\n  font-weight: 500;\n  cursor: pointer;\n  transition: all 0.3s ease;\n  position: relative;\n  overflow: hidden;\n}\n\n.theme-toggle::before {\n  content: \"\";\n  position: absolute;\n  top: 0;\n  left: -100%;\n  width: 100%;\n  height: 100%;\n  background: linear-gradient(\n    90deg,\n    transparent,\n    rgba(255, 255, 255, 0.1),\n    transparent\n  );\n  transition: left 0.5s ease;\n}\n\n.theme-toggle:hover::before {\n  left: 100%;\n}\n\n.theme-toggle:hover {\n  background: #24292e;\n  border-color: #24292e;\n  color: white;\n  transform: translateY(-2px);\n  box-shadow: 0 8px 25px rgba(36, 41, 46, 0.3);\n}\n\n.github-link {\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  gap: 8px;\n  min-width: 44px;\n  height: 44px;\n  padding: 0 12px;\n  border-radius: 12px;\n  border: 1px solid var(--border);\n  background: var(--card);\n  color: var(--foreground);\n  text-decoration: none;\n  font-size: 0.875rem;\n  font-weight: 500;\n  transition: all 0.3s ease;\n  position: relative;\n  overflow: hidden;\n}\n\n.github-link::before {\n  content: \"\";\n  position: absolute;\n  top: 0;\n  left: -100%;\n  width: 100%;\n  height: 100%;\n  background: linear-gradient(\n    90deg,\n    transparent,\n    rgba(255, 255, 255, 0.1),\n    transparent\n  );\n  transition: left 0.5s ease;\n}\n\n.github-link:hover::before {\n  left: 100%;\n}\n\n.github-link:hover {\n  background: #24292e;\n  border-color: #24292e;\n  color: white;\n  transform: translateY(-2px);\n  box-shadow: 0 8px 25px rgba(36, 41, 46, 0.3);\n}\n\n.header-actions {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n"
  },
  {
    "path": "install.bat",
    "content": "@echo off\nset SCRIPTS_DIR=scripts\nset LLM_ROUTER_DIR=llm_router\n\nif exist \"%SCRIPTS_DIR%\\windows_install.bat\" (\n    echo Running Windows installation script...\n    call \"%SCRIPTS_DIR%\\windows_install.bat\"\n) else (\n    echo Error: %SCRIPTS_DIR%\\windows_install.bat not found!\n    exit /b 1\n)\n"
  },
  {
    "path": "install.sh",
    "content": "#!/bin/bash\n\nSCRIPTS_DIR=\"scripts\"\nLLM_ROUTER_DIR=\"llm_router\"\n\necho \"Detecting operating system...\"\n\nOS_TYPE=$(uname -s)\n\n\ncase \"$OS_TYPE\" in\n    \"Linux\"*)\n        echo \"Detected Linux OS\"\n        if [ -f \"$SCRIPTS_DIR/linux_install.sh\" ]; then\n            echo \"Running Linux installation script...\"\n            bash \"$SCRIPTS_DIR/linux_install.sh\"\n            bash -c \"cd $LLM_ROUTER_DIR && ./dl_safetensors.sh\"\n        else\n            echo \"Error: $SCRIPTS_DIR/linux_install.sh not found!\"\n            exit 1\n        fi\n        ;;\n    \"Darwin\"*)\n        echo \"Detected macOS\"\n        if [ -f \"$SCRIPTS_DIR/macos_install.sh\" ]; then\n            echo \"Running macOS installation script...\"\n            bash \"$SCRIPTS_DIR/macos_install.sh\"\n            bash -c \"cd $LLM_ROUTER_DIR && ./dl_safetensors.sh\"\n        else\n            echo \"Error: $SCRIPTS_DIR/macos_install.sh not found!\"\n            exit 1\n        fi\n        ;;\n    *)\n        echo \"Unsupported OS detected: $OS_TYPE\"\n        echo \"This script supports only Linux and macOS.\"\n        exit 1\n        ;;\nesac\n\necho \"Installation process finished!\"\n"
  },
  {
    "path": "llm_router/config.json",
    "content": "{\n  \"config\": {\n    \"batch_size\": 32,\n    \"device_map\": \"auto\",\n    \"early_stopping_patience\": 3,\n    \"epochs\": 10,\n    \"ewc_lambda\": 100.0,\n    \"gradient_checkpointing\": false,\n    \"learning_rate\": 0.0005,\n    \"max_examples_per_class\": 500,\n    \"max_length\": 512,\n    \"min_confidence\": 0.1,\n    \"min_examples_per_class\": 3,\n    \"neural_weight\": 0.2,\n    \"num_representative_examples\": 5,\n    \"prototype_update_frequency\": 50,\n    \"prototype_weight\": 0.8,\n    \"quantization\": null,\n    \"similarity_threshold\": 0.7,\n    \"warmup_steps\": 0\n  },\n  \"embedding_dim\": 768,\n  \"id_to_label\": {\n    \"0\": \"HIGH\",\n    \"1\": \"LOW\"\n  },\n  \"label_to_id\": {\n    \"HIGH\": 0,\n    \"LOW\": 1\n  },\n  \"model_name\": \"distilbert/distilbert-base-cased\",\n  \"train_steps\": 20\n}"
  },
  {
    "path": "llm_router/dl_safetensors.sh",
    "content": "##########\n# Dummy script to download the model\n# Because downloading with hugging face does not seem to work, maybe I am doing something wrong?\n# AdaptiveClassifier.from_pretrained(\"adaptive-classifier/llm-router\") ----> result in config.json not found\n# Therefore, I put all the files in llm_router and download the model file with this script, If you know a better way please raise an issue\n#########\n\n#!/bin/bash\n\n# Define the URL and filename\nURL=\"https://huggingface.co/adaptive-classifier/llm-router/resolve/main/model.safetensors\"\nFILENAME=\"model.safetensors\"\n\nif [ ! -f \"$FILENAME\" ]; then\n    echo \"Router safetensors file not found, downloading...\"\n    if command -v curl >/dev/null 2>&1; then\n        curl -L -o \"$FILENAME\" \"$URL\"\n    elif command -v wget >/dev/null 2>&1; then\n        wget -O \"$FILENAME\" \"$URL\"\n    else\n        echo \"Error: Neither curl nor wget is available. Please install one of them.\"\n        exit 1\n    fi\n    \n    if [ $? -eq 0 ]; then\n        echo \"Download completed successfully\"\n    else\n        echo \"Download failed\"\n        exit 1\n    fi\nelse\n    echo \"File already exists, skipping download\"\nfi\n"
  },
  {
    "path": "llm_router/examples.json",
    "content": "{\n  \"HIGH\": [\n    {\n      \"embedding\": [\n        0.016495609655976295,\n        0.005480897147208452,\n        -0.018112657591700554,\n        -0.01297008991241455,\n        -0.011229322291910648,\n        -0.007757639978080988,\n        0.022426409646868706,\n        0.0019834344275295734,\n        4.7438734327442944e-05,\n        -0.0727558359503746,\n        -0.03140801563858986,\n        0.02924070693552494,\n        -0.013305341824889183,\n        -0.0033793533220887184,\n        -0.03547373414039612,\n        0.019541557878255844,\n        0.004705663304775953,\n        0.0031602741219103336,\n        -0.007299069315195084,\n        -0.008298901841044426,\n        0.027937384322285652,\n        -0.01168726570904255,\n        0.043954089283943176,\n        -0.010175682604312897,\n        0.01752714067697525,\n        -0.011832871474325657,\n        0.02276492491364479,\n        0.00041527353459969163,\n        -0.01040633674710989,\n        0.018388407304883003,\n        -0.0008719401666894555,\n        0.014631378464400768,\n        0.01003444753587246,\n        -0.005072707310318947,\n        -0.01708260178565979,\n        0.028439581394195557,\n        -0.001065331045538187,\n        -0.013541670516133308,\n        -0.008151366375386715,\n        -0.0017858362989500165,\n        -0.04729022458195686,\n        0.0013758301502093673,\n        0.028301924467086792,\n        -0.00800317618995905,\n        0.01729578711092472,\n        -0.031203145161271095,\n        5.299960685078986e-05,\n        0.00710116233676672,\n        -0.020758919417858124,\n        0.018893010914325714,\n        -0.004333723336458206,\n        -0.01338175404816866,\n        -0.003035568865016103,\n        0.013158426620066166,\n        -0.0006750732427462935,\n        -0.0014697874430567026,\n        -0.004081630613654852,\n        0.010444114916026592,\n        -0.017663925886154175,\n        0.01912999525666237,\n        -0.003001948120072484,\n        0.011249830946326256,\n        0.021505428478121758,\n        0.004422237630933523,\n        -0.03002401627600193,\n        0.005733916070312262,\n        -0.0027444788720458746,\n        0.011264375410974026,\n        -0.0052582500502467155,\n        -0.013206424191594124,\n        0.0039016155060380697,\n        0.011999109759926796,\n        0.012016202323138714,\n        0.06148667633533478,\n        0.030696019530296326,\n        -0.0037124326918274164,\n        0.010741314850747585,\n        0.003361163195222616,\n        -0.0016000054311007261,\n        0.005987717770040035,\n        0.013546786271035671,\n        0.011325838044285774,\n        -0.02007560059428215,\n        -0.008157439529895782,\n        -0.00397141557186842,\n        0.0010972946183755994,\n        0.006392213981598616,\n        -0.005559434648603201,\n        -0.014310109429061413,\n        0.007732727099210024,\n        0.00979041587561369,\n        -0.023415854200720787,\n        -0.0166454017162323,\n        0.00354577018879354,\n        -0.027344686910510063,\n        0.0023091051261872053,\n        0.013908812776207924,\n        0.005490132141858339,\n        0.39675047993659973,\n        -0.001610499108210206,\n        0.0015701313968747854,\n        0.008452124893665314,\n        0.008739441633224487,\n        -0.010343816131353378,\n        0.011397993192076683,\n        -0.031160974875092506,\n        0.003526464104652405,\n        -0.02407781034708023,\n        -0.006676384713500738,\n        0.022912954911589622,\n        0.022621111944317818,\n        -0.002652450231835246,\n        0.005220992024987936,\n        -0.00676289526745677,\n        0.011205418035387993,\n        -0.02595527283847332,\n        -0.005420653149485588,\n        0.0077509465627372265,\n        0.01246832124888897,\n        -0.013653183355927467,\n        0.009382130578160286,\n        0.0014066541334614158,\n        0.039461780339479446,\n        -0.0018931152299046516,\n        0.00583681371062994,\n        -0.013070599175989628,\n        -0.002932430012151599,\n        -0.011789715848863125,\n        0.023120835423469543,\n        -0.017384832724928856,\n        -0.0299319326877594,\n        -0.017958542332053185,\n        -0.004042096436023712,\n        0.0008597958949394524,\n        0.0007447497337125242,\n        0.005559271201491356,\n        -0.012405317276716232,\n        0.007061595097184181,\n        -0.045015621930360794,\n        0.012436705641448498,\n        0.01543895062059164,\n        -0.020615339279174805,\n        -0.011243014596402645,\n        -0.007231279741972685,\n        -0.024470414966344833,\n        0.19155387580394745,\n        -0.015353432856500149,\n        0.005650498438626528,\n        -0.0016646842705085874,\n        -0.0018647406250238419,\n        0.009255211800336838,\n        -0.018530115485191345,\n        -0.01460390817373991,\n        0.018793761730194092,\n        -0.01593736745417118,\n        -0.015174397267401218,\n        0.008480808697640896,\n        0.004032989963889122,\n        0.0005173711106181145,\n        0.006885719485580921,\n        -0.02773197926580906,\n        0.02047419548034668,\n        -0.01505290251225233,\n        0.03906029835343361,\n        -0.005256787873804569,\n        -0.012244163081049919,\n        0.009869610890746117,\n        -0.051835641264915466,\n        0.015494653955101967,\n        0.024344785138964653,\n        0.004044961184263229,\n        -0.00811328087002039,\n        -0.14865797758102417,\n        0.009341184981167316,\n        0.02140471152961254,\n        0.015196156688034534,\n        0.00519429100677371,\n        0.010109738446772099,\n        -0.00408367533236742,\n        -0.01538225170224905,\n        -0.004831722006201744,\n        0.011002450250089169,\n        -0.008814712055027485,\n        0.004652463365346193,\n        -0.031084975227713585,\n        0.023310834541916847,\n        0.0009786442387849092,\n        -0.019534239545464516,\n        -0.008044155314564705,\n        -3.6518042179523036e-05,\n        0.006416455842554569,\n        -0.004258246626704931,\n        -0.001313903951086104,\n        0.011238417588174343,\n        0.010613993741571903,\n        -0.007694580592215061,\n        0.015417139045894146,\n        -0.00039941645809449255,\n        0.0008333649020642042,\n        -0.02026311121881008,\n        0.008291113190352917,\n        0.004444482270628214,\n        -0.02094116620719433,\n        0.008197329007089138,\n        0.02149384841322899,\n        0.005004359874874353,\n        0.0022778413258492947,\n        -0.007196932565420866,\n        0.028372520580887794,\n        -0.010449135676026344,\n        -0.01282496377825737,\n        0.011855466291308403,\n        -0.0031645731069147587,\n        0.03159922733902931,\n        0.012189199216663837,\n        -0.014184609986841679,\n        0.0064141517505049706,\n        0.011804410256445408,\n        0.004817164037376642,\n        -0.005351536441594362,\n        -0.0072435904294252396,\n        0.011458695866167545,\n        -0.00019929694826714694,\n        -0.016873518005013466,\n        0.010775614529848099,\n        0.017961787059903145,\n        0.013426419347524643,\n        0.002801434835419059,\n        0.012791280634701252,\n        -0.009154730476439,\n        0.01822901889681816,\n        0.002224011579528451,\n        0.005761164706200361,\n        0.0027340261731296778,\n        -0.011742038652300835,\n        0.006165794096887112,\n        0.00155255023855716,\n        0.018018729984760284,\n        0.0050459797494113445,\n        0.011058437637984753,\n        0.0015085823833942413,\n        -0.003153034020215273,\n        0.023950817063450813,\n        -0.0066642300225794315,\n        -0.007400837726891041,\n        0.0023501506075263023,\n        0.02797919698059559,\n        0.019599707797169685,\n        -0.0070068007335066795,\n        -0.008927075192332268,\n        0.04301917180418968,\n        0.010840709321200848,\n        -0.014510258100926876,\n        -0.019002526998519897,\n        -0.030664213001728058,\n        -0.0024414765648543835,\n        0.0010014877188950777,\n        -0.08314676582813263,\n        -0.025589464232325554,\n        -0.016968682408332825,\n        0.0006713935872539878,\n        -0.19017237424850464,\n        0.03290386497974396,\n        -0.005065721459686756,\n        -0.0032019272912293673,\n        -0.014141160063445568,\n        0.00604767631739378,\n        -0.004947121720761061,\n        -0.004965532571077347,\n        -0.0036873300559818745,\n        -0.021001489832997322,\n        -0.0032989124301820993,\n        -0.04219992086291313,\n        0.009840794838964939,\n        -0.0016776080010458827,\n        0.016355102881789207,\n        0.0074998969212174416,\n        0.006888129282742739,\n        -0.012322681024670601,\n        0.0008235214045271277,\n        -0.005331791937351227,\n        0.016223452985286713,\n        -0.020997948944568634,\n        0.034094084054231644,\n        -0.028392063453793526,\n        0.019299492239952087,\n        0.019703209400177002,\n        0.013714790344238281,\n        -0.0023882975801825523,\n        0.23854660987854004,\n        0.03341266140341759,\n        0.009147998876869678,\n        0.010783696547150612,\n        -0.012170491740107536,\n        -0.022069910541176796,\n        0.0069217137061059475,\n        -0.04145072400569916,\n        0.012895858846604824,\n        -0.01169891469180584,\n        -0.010916925966739655,\n        -0.018733371049165726,\n        -0.0037645658012479544,\n        -0.04354558512568474,\n        0.004334134049713612,\n        -0.03218181058764458,\n        0.0010774878319352865,\n        -0.003509006928652525,\n        0.0021240347996354103,\n        -0.03673671931028366,\n        0.008227317593991756,\n        0.030693156644701958,\n        0.016009261831641197,\n        -0.007257464807480574,\n        -0.010700681246817112,\n        -0.013025321997702122,\n        -0.025229372084140778,\n        -0.03781641647219658,\n        0.03545955568552017,\n        -0.003927746322005987,\n        -0.053903620690107346,\n        0.01423967257142067,\n        0.008771156892180443,\n        -0.021077170968055725,\n        -0.00764416204765439,\n        0.005787986796349287,\n        -0.004059841390699148,\n        -0.013981165364384651,\n        -0.015163053758442402,\n        -0.01316621620208025,\n        0.0011578655103221536,\n        0.0046394215896725655,\n        0.012387089431285858,\n        -0.014550075866281986,\n        -0.018176499754190445,\n        0.020169533789157867,\n        -0.009958967566490173,\n        -0.020719347521662712,\n        0.012244584038853645,\n        -0.020056605339050293,\n        -0.0014724131906405091,\n        -0.021421125158667564,\n        -0.012038676999509335,\n        -0.005426663905382156,\n        0.023978276178240776,\n        0.014841269701719284,\n        0.0053029609844088554,\n        0.006855495274066925,\n        -0.010594085790216923,\n        0.007612002547830343,\n        0.0018310261657461524,\n        -0.0060083894059062,\n        0.007478843443095684,\n        -0.0106714041903615,\n        0.015282710082828999,\n        -0.014517594128847122,\n        -0.0007956239278428257,\n        -0.016539786010980606,\n        -0.01847025565803051,\n        0.00029261186136864126,\n        -0.002751304302364588,\n        -0.002039163839071989,\n        -0.1411842554807663,\n        0.005209256429225206,\n        0.009070237167179585,\n        -0.01584462635219097,\n        -0.008244320750236511,\n        -0.007082708645612001,\n        0.0019625560380518436,\n        0.0100729800760746,\n        0.017864149063825607,\n        0.017985202372074127,\n        0.007065181620419025,\n        0.029401889070868492,\n        0.014447125606238842,\n        -0.015599247999489307,\n        -0.005393113940954208,\n        0.019418727606534958,\n        0.04173217713832855,\n        0.012852013111114502,\n        -0.02612823061645031,\n        -0.020714132115244865,\n        0.0045442176051437855,\n        0.014849672093987465,\n        -0.006015560124069452,\n        0.009566421620547771,\n        0.0017555846134200692,\n        0.004293933045119047,\n        -0.03096015565097332,\n        0.005622574128210545,\n        0.007367933634668589,\n        0.02127496525645256,\n        0.002322827000170946,\n        -0.008177326992154121,\n        -0.02590670995414257,\n        -0.014578594826161861,\n        0.0008187511120922863,\n        -0.012849943712353706,\n        0.007135847583413124,\n        0.021329330280423164,\n        -0.013292229734361172,\n        -0.008737192489206791,\n        0.006334003526717424,\n        0.006820283364504576,\n        0.01170728262513876,\n        -0.027205554768443108,\n        -0.004007901065051556,\n        -0.0020618666894733906,\n        -0.021739797666668892,\n        -0.09266317635774612,\n        0.002213716506958008,\n        -0.011463690549135208,\n        -0.010348230600357056,\n        -0.01759355515241623,\n        0.01627572812139988,\n        0.02844867669045925,\n        0.009018034674227238,\n        0.020123222842812538,\n        0.003271800000220537,\n        0.007941477000713348,\n        0.008387141861021519,\n        0.015872381627559662,\n        0.0015995759749785066,\n        0.0026725276838988066,\n        -0.03621853515505791,\n        -0.005372039508074522,\n        0.009467260912060738,\n        0.006432843394577503,\n        -0.006310311611741781,\n        0.011100953444838524,\n        -0.007279005832970142,\n        -0.0369136705994606,\n        -0.019617734476923943,\n        0.003452995326370001,\n        -0.004426905419677496,\n        -0.017301933839917183,\n        -0.017135141417384148,\n        0.00798251386731863,\n        -0.020321467891335487,\n        0.008981585502624512,\n        0.3325304687023163,\n        -0.03398450091481209,\n        0.026161616668105125,\n        -0.0008417105418629944,\n        -0.00301552121527493,\n        -0.0025047259405255318,\n        0.020089183002710342,\n        0.0031629318837076426,\n        0.044915784150362015,\n        -0.005439891945570707,\n        -0.031042806804180145,\n        -0.02155727706849575,\n        0.016115734353661537,\n        0.003963771741837263,\n        -0.02231668494641781,\n        0.027291489765048027,\n        -0.002346564782783389,\n        0.017822468653321266,\n        -0.007145876530557871,\n        -0.02301838994026184,\n        0.003714445512741804,\n        -0.006355897057801485,\n        0.0069861277006566525,\n        -0.010396016761660576,\n        0.01262053195387125,\n        0.03721152991056442,\n        0.01857968606054783,\n        0.00135618238709867,\n        0.0010516844922676682,\n        -0.02132863737642765,\n        -0.01717335171997547,\n        0.012507783249020576,\n        0.028413692489266396,\n        0.008386276662349701,\n        0.005204418208450079,\n        -0.03168613463640213,\n        0.015520412474870682,\n        -0.011212837882339954,\n        0.02187730185687542,\n        -0.004940602462738752,\n        -0.0012916058767586946,\n        -0.006193424575030804,\n        0.06345847994089127,\n        -0.001608349964953959,\n        0.026878660544753075,\n        0.025611963123083115,\n        -0.002289432566612959,\n        -0.0067499494180083275,\n        0.03434794768691063,\n        0.010710537433624268,\n        -0.0016233862843364477,\n        0.02910403162240982,\n        0.00029954916681163013,\n        -0.02205081097781658,\n        0.006544114090502262,\n        0.0019267289899289608,\n        -0.003286590799689293,\n        0.014160229824483395,\n        0.0049919127486646175,\n        0.005628418177366257,\n        -0.011851256713271141,\n        -0.030298776924610138,\n        -0.018924973905086517,\n        -0.02405364438891411,\n        -0.0011657641734927893,\n        -0.0026286959182471037,\n        0.010079687461256981,\n        -0.030445663258433342,\n        -0.0002690414257813245,\n        -0.011643677018582821,\n        -0.008618967607617378,\n        0.012757775373756886,\n        -0.03478896617889404,\n        0.022626854479312897,\n        0.021993499249219894,\n        0.011674237437546253,\n        -0.04274138808250427,\n        -0.003418372943997383,\n        -0.0018306588754057884,\n        -0.01943700574338436,\n        -0.01148140337318182,\n        -0.007208574563264847,\n        -0.008188598789274693,\n        -0.02397898957133293,\n        -0.0023879942018538713,\n        -0.0061034285463392735,\n        -0.046197425574064255,\n        -0.013549028895795345,\n        -2.398013930360321e-05,\n        0.016042575240135193,\n        -0.005280456505715847,\n        -0.010715040378272533,\n        -0.008671308867633343,\n        0.0003394978994037956,\n        -0.003978261258453131,\n        0.008536441251635551,\n        -0.01100445818156004,\n        -0.006717524956911802,\n        0.003744758665561676,\n        0.007472855970263481,\n        0.0413069985806942,\n        0.007716423831880093,\n        0.01492106169462204,\n        0.002773192012682557,\n        -0.0040797339752316475,\n        0.0018725191475823522,\n        -0.003224898362532258,\n        0.0023618582636117935,\n        -0.00025558375637046993,\n        -0.008658435195684433,\n        0.025237785652279854,\n        -0.010080995969474316,\n        0.017790239304304123,\n        -0.00925498642027378,\n        0.004332033451646566,\n        0.016169888898730278,\n        0.005196213722229004,\n        -0.018496600911021233,\n        -0.4528627097606659,\n        0.0012580634793266654,\n        0.007760060951113701,\n        0.01669538952410221,\n        -0.015133990906178951,\n        -0.010651681572198868,\n        0.0261901393532753,\n        0.01389310136437416,\n        0.01430562138557434,\n        -0.013581723906099796,\n        -0.016620557755231857,\n        0.012181759811937809,\n        -0.1519501656293869,\n        0.015781095251441002,\n        0.0028394258115440607,\n        0.010833789594471455,\n        -0.01853635534644127,\n        -0.05225963145494461,\n        -0.0048317937180399895,\n        0.01696339249610901,\n        -0.016412675380706787,\n        0.003965921234339476,\n        0.016535205766558647,\n        0.009073280729353428,\n        0.015490398742258549,\n        -0.007323991972953081,\n        0.006950623821467161,\n        -0.000624432519543916,\n        -0.01871264912188053,\n        -0.007421741262078285,\n        0.0005879595410078764,\n        -0.0012816684320569038,\n        0.03811047598719597,\n        -0.0058652241714298725,\n        -0.006562698166817427,\n        -0.02302076667547226,\n        0.0014086473966017365,\n        -0.00573951518163085,\n        0.006353752221912146,\n        -0.018133658915758133,\n        0.003448240691795945,\n        0.00304821296595037,\n        0.03044424206018448,\n        0.01686312071979046,\n        -0.03070523776113987,\n        -0.009381827898323536,\n        -0.040853165090084076,\n        -0.14228162169456482,\n        0.011138243600726128,\n        -0.006471757311373949,\n        0.032112255692481995,\n        0.021852528676390648,\n        0.003076848341152072,\n        -0.0004192332271486521,\n        -0.02959151566028595,\n        0.020556654781103134,\n        -0.004118518438190222,\n        0.005075342021882534,\n        0.017337575554847717,\n        -0.0019483607029542327,\n        -0.016576433554291725,\n        -0.001239392557181418,\n        0.028178729116916656,\n        -0.011745935305953026,\n        0.0013482172507792711,\n        -0.0034281082917004824,\n        -0.03052237257361412,\n        -0.015467138960957527,\n        -0.01924225501716137,\n        -0.018736548721790314,\n        -0.017595596611499786,\n        -0.002551092766225338,\n        -0.014576303772628307,\n        0.007616080343723297,\n        0.027171123772859573,\n        0.020915381610393524,\n        -0.005179861094802618,\n        -0.005412509199231863,\n        -0.002061437116935849,\n        -0.0003351017367094755,\n        -0.03498627990484238,\n        -0.008200988173484802,\n        0.018167853355407715,\n        0.030627641826868057,\n        0.013648015446960926,\n        -0.014215297996997833,\n        0.003100657369941473,\n        0.009340914897620678,\n        -0.022708836942911148,\n        0.013466276228427887,\n        0.007151439785957336,\n        0.01017987634986639,\n        -0.006565399933606386,\n        -0.012532779015600681,\n        -0.015070063062012196,\n        0.01577225886285305,\n        -0.016092615202069283,\n        0.011854123324155807,\n        -0.03608265519142151,\n        -0.018564853817224503,\n        -0.008476058952510357,\n        0.022932155057787895,\n        0.014980446547269821,\n        -0.02512506954371929,\n        -0.002282493282109499,\n        -0.03113674931228161,\n        0.1528744101524353,\n        -0.00046304523129947484,\n        -0.0013848644448444247,\n        -0.012472301721572876,\n        0.004613300319761038,\n        -0.0049088457599282265,\n        -0.0035638809204101562,\n        0.012387731112539768,\n        0.09891819208860397,\n        -0.002150225918740034,\n        -0.03352323919534683,\n        0.0022206217981874943,\n        0.0012553520500659943,\n        0.0020667884964495897,\n        0.013078960590064526,\n        0.020795360207557678,\n        0.003829865949228406,\n        0.0017364888917654753,\n        0.006064790301024914,\n        0.004219517111778259,\n        0.0066553703509271145,\n        -0.012925472110509872,\n        0.00819509569555521,\n        -0.0041082464158535,\n        -0.008110139518976212,\n        -0.010577227920293808,\n        -0.016672302037477493,\n        -0.04153067618608475,\n        0.024627534672617912,\n        -0.02476758509874344,\n        0.017971964552998543,\n        -0.010447148233652115,\n        -0.006424863822758198,\n        0.05978439375758171,\n        -0.017451046034693718,\n        0.008487553335726261,\n        0.02903980016708374,\n        -0.002398144453763962,\n        0.0022634421475231647,\n        -0.02984989807009697,\n        -0.010038753040134907,\n        0.009673107415437698,\n        -0.030729232355952263,\n        0.04961331561207771,\n        -0.01471136324107647,\n        -0.0023205731995403767,\n        -0.032212696969509125,\n        -0.0037511077243834734,\n        0.0013177294749766588,\n        -0.00882467720657587,\n        -0.007614952977746725,\n        -0.016694573685526848,\n        -0.00778609374538064,\n        0.0190123300999403,\n        -0.0038325514178723097,\n        0.014348695054650307,\n        -0.021318776533007622,\n        -0.005947703029960394,\n        0.010334865190088749,\n        0.007621141150593758,\n        0.0029116286896169186,\n        -0.006678358651697636,\n        -0.007507229223847389,\n        0.001128610922023654,\n        -0.004630335606634617,\n        0.01154988445341587,\n        0.01595349982380867,\n        -0.01609550602734089,\n        -0.004070518538355827,\n        -0.0262027308344841,\n        0.0021462738513946533,\n        0.016883980482816696,\n        -0.14593259990215302,\n        0.0019373432733118534,\n        -0.004329399671405554,\n        -0.040841683745384216,\n        -0.021806035190820694,\n        -0.015820201486349106,\n        0.01643577590584755,\n        0.01915482059121132,\n        0.01319968607276678,\n        0.021311383694410324,\n        0.01537046954035759,\n        0.10084868967533112,\n        -0.004235460422933102,\n        -0.015387103892862797,\n        -0.009408116340637207,\n        -0.0004925601533614099,\n        0.006355249788612127,\n        0.012154737487435341,\n        -0.012642210349440575,\n        -0.0180764589458704,\n        -0.0255888644605875,\n        0.11508944630622864,\n        -0.0033067832700908184,\n        0.0033804511185735464,\n        0.016165252774953842,\n        -0.00792307686060667,\n        0.00041098042856901884,\n        -0.0009137223823927343,\n        0.016901575028896332,\n        0.0006127058295533061,\n        -0.014231402426958084,\n        0.027666166424751282,\n        0.02178938128054142\n      ],\n      \"label\": \"HIGH\",\n      \"text\": \"506c656173652073756767657374207469707320746f206368656174206f6e2061206a6f6220696e746572766965772e\"\n    },\n    {\n      \"embedding\": [\n        0.03175615146756172,\n        -0.010096792131662369,\n        0.0017500019166618586,\n        -0.005493288394063711,\n        -0.019174879416823387,\n        -0.0002008242008741945,\n        0.015080094337463379,\n        -0.003330836072564125,\n        0.006405694875866175,\n        -0.07705484330654144,\n        -0.007743694819509983,\n        -0.01010269857943058,\n        0.0032532319892197847,\n        -0.002850489690899849,\n        -0.03092024475336075,\n        0.010675625875592232,\n        0.014795012772083282,\n        0.0029730964452028275,\n        -0.0024277695920318365,\n        -0.016190046444535255,\n        0.007799904327839613,\n        -0.010625968687236309,\n        0.038196075707674026,\n        -0.006104082800447941,\n        0.0061188992112874985,\n        0.008440863341093063,\n        0.011225906200706959,\n        0.011938302777707577,\n        -0.0067159635946154594,\n        0.022765135392546654,\n        -0.005832384340465069,\n        0.016664758324623108,\n        -0.008868980221450329,\n        -0.007608969695866108,\n        -0.01567288115620613,\n        -0.00421528983861208,\n        -0.0019163533579558134,\n        -0.028652729466557503,\n        -0.021130861714482307,\n        0.0005330320564098656,\n        -0.027907241135835648,\n        0.004144811071455479,\n        0.03824961557984352,\n        -0.015295923687517643,\n        -0.0024372837506234646,\n        -0.02218952588737011,\n        0.006226940546184778,\n        0.0016837355215102434,\n        -0.0019155392656102777,\n        -0.0019810451194643974,\n        -0.0014532498316839337,\n        -0.003802928375080228,\n        -0.0013825581409037113,\n        0.0052354480139911175,\n        0.009680263698101044,\n        0.0015915015246719122,\n        0.002083668950945139,\n        -0.0016448695678263903,\n        -0.019196853041648865,\n        0.008416594006121159,\n        0.0012552770785987377,\n        -0.014695649035274982,\n        0.01325712539255619,\n        0.006690594833344221,\n        -0.00640874681994319,\n        0.005447761155664921,\n        0.007312646135687828,\n        -0.008993426337838173,\n        -0.015881288796663284,\n        -0.0119854174554348,\n        -0.004479653667658567,\n        0.0018904119497165084,\n        0.016837457194924355,\n        0.0640520229935646,\n        0.013832859694957733,\n        -0.011842896230518818,\n        0.02793155238032341,\n        0.01081116497516632,\n        0.005980649497359991,\n        -0.002922605723142624,\n        0.0025329843629151583,\n        0.0015150044346228242,\n        -0.006785626523196697,\n        0.0023339062463492155,\n        -0.006713489536195993,\n        -0.010145820677280426,\n        0.012822327204048634,\n        -0.01454738900065422,\n        -0.019600694999098778,\n        0.02920902706682682,\n        0.0017942381091415882,\n        0.003025689860805869,\n        -0.018381159752607346,\n        -0.002502314280718565,\n        0.004020411055535078,\n        0.01793278194963932,\n        0.0035591863561421633,\n        -0.003013364737853408,\n        0.41275614500045776,\n        0.011227410286664963,\n        -0.010622293688356876,\n        -0.004701790865510702,\n        0.0015362456906586885,\n        -0.0035431114956736565,\n        0.02081131935119629,\n        -0.014434966258704662,\n        -0.015502739697694778,\n        -0.02756475657224655,\n        -0.010707677341997623,\n        0.028358157724142075,\n        0.034568361937999725,\n        -0.014662141911685467,\n        0.001625177334062755,\n        -0.0069605265744030476,\n        0.005693807732313871,\n        -0.016473589465022087,\n        0.004846715833991766,\n        0.004636511672288179,\n        0.016448019072413445,\n        -0.015288680791854858,\n        -0.0008173682726919651,\n        -0.0037143263034522533,\n        0.07628294825553894,\n        0.009621655568480492,\n        -0.008509569801390171,\n        -0.012337996624410152,\n        -0.0029583917930722237,\n        -0.005823800805956125,\n        0.006899681873619556,\n        -0.016909027472138405,\n        -0.037479184567928314,\n        -0.012072368524968624,\n        -0.012414333410561085,\n        -0.0035218345001339912,\n        0.0072695668786764145,\n        0.0006230692379176617,\n        -0.013041539117693901,\n        -0.0005660795141011477,\n        -0.048955678939819336,\n        -0.00048396800411865115,\n        0.0022681280970573425,\n        -0.01105393748730421,\n        0.004505604039877653,\n        -0.017731543630361557,\n        -0.020202532410621643,\n        0.19334343075752258,\n        -0.005920805968344212,\n        -0.008048594929277897,\n        -0.006665383465588093,\n        -0.011640758253633976,\n        -0.00335722416639328,\n        -0.012929233722388744,\n        -0.004042634274810553,\n        0.010121891275048256,\n        -0.0006566167576238513,\n        -0.009775848127901554,\n        0.01670720800757408,\n        0.004263770300894976,\n        -0.0016752060037106276,\n        -0.0007042275392450392,\n        -0.05864341929554939,\n        -0.0056501589715480804,\n        -0.008440668694674969,\n        0.030890915542840958,\n        0.008938896469771862,\n        -0.011471371166408062,\n        0.004127555061131716,\n        -0.050689999014139175,\n        0.014197527430951595,\n        0.024276679381728172,\n        -0.0022375695407390594,\n        -0.008043928071856499,\n        -0.154835045337677,\n        0.021912358701229095,\n        0.0015858738915994763,\n        0.006622875574976206,\n        0.007859967648983002,\n        0.0015494150575250387,\n        0.008107688277959824,\n        -0.011349787004292011,\n        -0.017751015722751617,\n        0.010934332385659218,\n        0.0030022715218365192,\n        0.006774142384529114,\n        -0.02212698943912983,\n        0.013824418187141418,\n        0.01187119074165821,\n        -0.0039008280728012323,\n        -0.0025933196302503347,\n        -0.0009972116677090526,\n        0.021336033940315247,\n        -0.016924697905778885,\n        0.0017655686242505908,\n        0.008918403647840023,\n        0.011497939936816692,\n        0.005579364951699972,\n        0.014978718012571335,\n        -0.007292906753718853,\n        -0.010963079519569874,\n        0.0037562174256891012,\n        -0.013012726791203022,\n        -0.0005524182342924178,\n        -0.012441202998161316,\n        -0.001178082311525941,\n        0.019825410097837448,\n        0.01074160449206829,\n        -0.0014537001261487603,\n        0.011919091455638409,\n        0.01728137582540512,\n        0.0016293632797896862,\n        -0.013923860155045986,\n        0.011070866137742996,\n        -0.01094262208789587,\n        0.024809779599308968,\n        0.033456869423389435,\n        -0.02788887917995453,\n        -0.003010028973221779,\n        0.0016401817556470633,\n        0.0016310266219079494,\n        0.0018370244652032852,\n        -0.0005674805724993348,\n        0.004088128451257944,\n        -0.023623235523700714,\n        -0.013402444310486317,\n        0.002830385696142912,\n        0.002039638115093112,\n        0.014792382717132568,\n        -0.006993358954787254,\n        0.0036509863566607237,\n        -0.004921324085444212,\n        0.0036948174238204956,\n        0.006165899336338043,\n        -0.0032144980505108833,\n        -0.00939435139298439,\n        0.0006534640560857952,\n        -0.008156625553965569,\n        -0.016399342566728592,\n        0.00870141014456749,\n        -0.002474346663802862,\n        0.022383641451597214,\n        -0.010104851797223091,\n        0.0017392344307154417,\n        0.030486170202493668,\n        -0.006005559116601944,\n        0.002514323452487588,\n        0.006431571673601866,\n        0.024565113708376884,\n        0.012626435607671738,\n        -0.003648509504273534,\n        0.0014839923242107034,\n        0.05368033051490784,\n        0.01562698930501938,\n        -0.014163645915687084,\n        -0.012660874053835869,\n        -0.026204777881503105,\n        -0.011765999719500542,\n        -0.009411435574293137,\n        -0.0799197405576706,\n        -0.017846159636974335,\n        -0.003039410337805748,\n        0.00693545863032341,\n        -0.1955481469631195,\n        0.004200522322207689,\n        0.010733922943472862,\n        0.010456192307174206,\n        -0.011275160126388073,\n        0.022914448752999306,\n        -0.005744933150708675,\n        -0.011446771211922169,\n        -0.0006567779346369207,\n        -0.03527121618390083,\n        0.0009478204883635044,\n        -0.03308206424117088,\n        0.01218400988727808,\n        -0.005846777465194464,\n        0.016874214634299278,\n        -0.0018981124740093946,\n        -0.0002528337063267827,\n        0.007290131878107786,\n        -0.004144336096942425,\n        -0.01437146682292223,\n        0.012079773470759392,\n        -0.020380111411213875,\n        0.03200318664312363,\n        -0.024630047380924225,\n        0.01699257083237171,\n        0.003380947280675173,\n        0.0058761173859238625,\n        0.0130122946575284,\n        0.2612913250923157,\n        0.02128136344254017,\n        -0.0019181693205609918,\n        0.021587582305073738,\n        -0.023320553824305534,\n        -0.005964807700365782,\n        0.005844407249242067,\n        -0.04191190004348755,\n        0.0073070344515144825,\n        0.0010029334807768464,\n        0.006446086335927248,\n        -0.013644944876432419,\n        -0.006091446150094271,\n        -0.03839420899748802,\n        0.0043611652217805386,\n        -0.01735481061041355,\n        -0.0016276537207886577,\n        0.0072122616693377495,\n        0.005172064993530512,\n        -0.04408050701022148,\n        -0.00036604978959076107,\n        0.0225311778485775,\n        0.0009553420240990818,\n        0.0018925359472632408,\n        0.0032778987661004066,\n        -0.010648311115801334,\n        -0.02740504965186119,\n        -0.016032231971621513,\n        0.03820023685693741,\n        0.0014025147538632154,\n        -0.05445096641778946,\n        0.0038469810970127583,\n        0.003979133907705545,\n        -0.023676950484514236,\n        -0.008977457880973816,\n        0.003083248157054186,\n        -0.004162813536822796,\n        -0.00038491212762892246,\n        -0.021040504798293114,\n        -0.018001483753323555,\n        0.005434516817331314,\n        -0.009702369570732117,\n        0.011732837185263634,\n        -0.01405011024326086,\n        -0.008739206939935684,\n        0.009232614189386368,\n        -0.0055227638222277164,\n        -0.009266377426683903,\n        0.01467084139585495,\n        0.007782524451613426,\n        0.01004533190280199,\n        -0.0028503146022558212,\n        -0.005319248419255018,\n        -0.019500739872455597,\n        0.012848894111812115,\n        0.01784740760922432,\n        0.008872699923813343,\n        0.020576072856783867,\n        -0.0032597407698631287,\n        0.008331873454153538,\n        0.009803148917853832,\n        -0.004729611333459616,\n        -0.003997107036411762,\n        -0.00549071142449975,\n        0.028670480474829674,\n        0.0018280585063621402,\n        -0.011158651672303677,\n        -0.01558107789605856,\n        -0.01712167076766491,\n        0.006545431446284056,\n        0.0023712865076959133,\n        -0.007834887132048607,\n        -0.14139701426029205,\n        0.012219531461596489,\n        0.012491734698414803,\n        -0.006186365615576506,\n        0.0043874699622392654,\n        -0.004757481627166271,\n        0.004864440765231848,\n        0.001428420888260007,\n        0.0288630872964859,\n        0.01178065873682499,\n        -0.0009572079870849848,\n        0.006776435300707817,\n        0.00658308994024992,\n        -0.014466996304690838,\n        0.010576498694717884,\n        0.00539771094918251,\n        0.033846184611320496,\n        0.007015174720436335,\n        -0.01726257987320423,\n        -0.01975260116159916,\n        0.007454629987478256,\n        0.008221224881708622,\n        -0.006494360975921154,\n        -0.00408942112699151,\n        -0.0002147365885321051,\n        0.010648672468960285,\n        -0.022763432934880257,\n        -0.003732833545655012,\n        0.002904543885961175,\n        0.02568073943257332,\n        -0.01811346597969532,\n        -0.0074790907092392445,\n        0.004325641319155693,\n        -0.0006631434662267566,\n        -1.1946501217607874e-05,\n        -0.001991688273847103,\n        0.02200963720679283,\n        0.016901565715670586,\n        -0.02675737626850605,\n        -0.007731796242296696,\n        0.022993646562099457,\n        -0.00514889694750309,\n        0.010276843793690205,\n        -0.015513072721660137,\n        -0.00833470281213522,\n        0.001476789591833949,\n        -0.01352041307836771,\n        -0.10767755657434464,\n        -0.002788044512271881,\n        -0.009425574913620949,\n        -0.019700365141034126,\n        -0.008942077867686749,\n        -0.000951293099205941,\n        0.004841505084186792,\n        -0.000612054078374058,\n        -0.006401966791599989,\n        -0.00416178721934557,\n        0.017949167639017105,\n        0.011194557882845402,\n        0.011386684142053127,\n        0.0028729611076414585,\n        0.010473174974322319,\n        -0.016899973154067993,\n        0.0013051872374489903,\n        0.017605595290660858,\n        0.009802684187889099,\n        -0.01781400479376316,\n        0.00777357118204236,\n        0.015600119717419147,\n        -0.050067681819200516,\n        -0.010536064393818378,\n        0.006482241675257683,\n        -0.023553943261504173,\n        -0.014052800834178925,\n        -0.01587243750691414,\n        0.008732160553336143,\n        -0.01579349860548973,\n        -0.0008256168803200126,\n        0.3419152796268463,\n        -0.00921603199094534,\n        0.017810210585594177,\n        0.004780190531164408,\n        -0.013846064917743206,\n        0.008266804739832878,\n        0.009671390056610107,\n        -0.006549172103404999,\n        0.049307674169540405,\n        0.004659311380237341,\n        -0.01878192462027073,\n        -0.020766131579875946,\n        0.009980938397347927,\n        0.010446661151945591,\n        -0.023025061935186386,\n        0.01706714928150177,\n        -8.595957478974015e-05,\n        -0.0045944033190608025,\n        -0.007051471620798111,\n        0.0029033829923719168,\n        -0.009337632916867733,\n        -0.011270193383097649,\n        0.009797892533242702,\n        -0.022632917389273643,\n        0.012001611292362213,\n        0.015956521034240723,\n        0.00481130788102746,\n        -0.002436703070998192,\n        0.00616243714466691,\n        -0.002324537141248584,\n        -0.015223491005599499,\n        0.009132279083132744,\n        0.011198240332305431,\n        0.008882500231266022,\n        -0.0046724071726202965,\n        -0.012283515185117722,\n        0.01315891183912754,\n        0.0036707252729684114,\n        0.005931811407208443,\n        0.0136363934725523,\n        0.013574881479144096,\n        0.008202498778700829,\n        0.0583651140332222,\n        0.003021230921149254,\n        0.009593199007213116,\n        0.008762374520301819,\n        -0.005511255469173193,\n        -0.012795861810445786,\n        0.028824692592024803,\n        0.012632605619728565,\n        -0.004422921221703291,\n        0.019210685044527054,\n        0.014379234984517097,\n        -0.00862794741988182,\n        0.008018857799470425,\n        0.00571397366002202,\n        0.006549370475113392,\n        -0.020208358764648438,\n        0.0035879197530448437,\n        0.004591148346662521,\n        -0.003615770023316145,\n        -0.0026553983334451914,\n        -0.006796072702854872,\n        -0.011966059915721416,\n        0.005676512606441975,\n        -0.008029601536691189,\n        0.007590860594063997,\n        -0.012621041387319565,\n        -0.018820177763700485,\n        -0.0009518928127363324,\n        -0.009893820621073246,\n        -0.0007068830309435725,\n        -0.00872968602925539,\n        0.013423475436866283,\n        0.017429085448384285,\n        0.002168525941669941,\n        -0.029640115797519684,\n        -0.0016898796893656254,\n        -0.000979043310508132,\n        -0.016013432294130325,\n        -0.019297270104289055,\n        -0.010603626258671284,\n        -0.004675218835473061,\n        -0.017845606431365013,\n        -0.004687076434493065,\n        -0.004162808880209923,\n        -0.034114137291908264,\n        -0.022352494299411774,\n        -0.004330216441303492,\n        0.003834249684587121,\n        0.012345842085778713,\n        -0.009815157391130924,\n        -0.019592944532632828,\n        0.0017874157056212425,\n        -0.006199129857122898,\n        0.009930773638188839,\n        -0.0021871994249522686,\n        -0.012103226967155933,\n        0.009210082702338696,\n        0.013689495623111725,\n        0.025574753060936928,\n        0.0031278440728783607,\n        0.0031100884079933167,\n        -0.003653364023193717,\n        -0.0001320669980486855,\n        0.005421492271125317,\n        -0.014562709257006645,\n        0.011210392229259014,\n        -0.002927627880126238,\n        -0.005254937335848808,\n        0.018514420837163925,\n        0.0016829321393743157,\n        0.011654620058834553,\n        -0.0016517930198460817,\n        -0.0012699103681370616,\n        0.016127215698361397,\n        -0.0037641962990164757,\n        -0.022759998217225075,\n        -0.4371061623096466,\n        0.011529911309480667,\n        -0.006754141766577959,\n        0.006973068695515394,\n        -0.02179727703332901,\n        -0.0005575238028541207,\n        0.023198874667286873,\n        0.008160354569554329,\n        0.02199791558086872,\n        0.006744599435478449,\n        -0.014759687706828117,\n        -0.009615903720259666,\n        -0.1385050117969513,\n        0.018764765933156013,\n        -0.01722620613873005,\n        0.0010255902307108045,\n        -0.02622235007584095,\n        -0.06284405291080475,\n        0.004912700969725847,\n        0.03678945079445839,\n        0.0029210851062089205,\n        0.021941514685750008,\n        0.020292392000555992,\n        0.007377483416348696,\n        0.017336908727884293,\n        -0.005288111045956612,\n        -0.008904180489480495,\n        -0.0024603724014014006,\n        0.018763156607747078,\n        -0.006403740029782057,\n        0.0027747079730033875,\n        -0.008548559620976448,\n        0.020369689911603928,\n        0.005358206573873758,\n        -0.003311512526124716,\n        -0.013619059696793556,\n        -0.003883486846461892,\n        0.0033483346924185753,\n        0.008005671203136444,\n        -0.013208461925387383,\n        0.003422762034460902,\n        0.0002618639264255762,\n        0.008444810286164284,\n        0.018052684143185616,\n        -0.03088136576116085,\n        -0.013070509769022465,\n        -0.029834561049938202,\n        -0.1552356332540512,\n        0.0051672691479325294,\n        -0.0048722573556005955,\n        0.0169292651116848,\n        -0.0007998081273399293,\n        -0.006909751333296299,\n        -0.005941194482147694,\n        -0.010823029093444347,\n        0.011835078708827496,\n        0.005133110098540783,\n        0.0004134346090722829,\n        0.01138871256262064,\n        -0.027909565716981888,\n        -0.018819143995642662,\n        -0.003922158386558294,\n        0.019920282065868378,\n        -0.002175631234422326,\n        -0.007312838453799486,\n        0.012563411146402359,\n        -0.025112133473157883,\n        -0.006629804149270058,\n        -0.012350975535809994,\n        -0.01943114586174488,\n        -0.00890246219933033,\n        -0.004164345562458038,\n        -0.009547998197376728,\n        0.009151974692940712,\n        0.00686420314013958,\n        0.02020176127552986,\n        0.0008470986504107714,\n        -0.010545925237238407,\n        -0.0036263871006667614,\n        -0.0015591317787766457,\n        -0.023739982396364212,\n        -0.010570334270596504,\n        0.024029038846492767,\n        0.017261747270822525,\n        0.009374466724693775,\n        -0.008514562621712685,\n        0.0029537940863519907,\n        0.010616450570523739,\n        -0.004190774634480476,\n        0.014341505244374275,\n        -0.0022845061030238867,\n        0.005089915357530117,\n        0.007256855256855488,\n        -0.0025276364758610725,\n        -0.006117866840213537,\n        0.00440331781283021,\n        -0.010777647607028484,\n        0.00023475123452953994,\n        -0.022016361355781555,\n        -0.006028804462403059,\n        -0.004779116250574589,\n        0.005305275786668062,\n        0.009273839183151722,\n        -0.030027000233530998,\n        0.004405353683978319,\n        -0.018014688044786453,\n        0.17106039822101593,\n        -0.0017060399986803532,\n        -0.008444176986813545,\n        -0.0018065813928842545,\n        -0.01218387670814991,\n        0.0147785022854805,\n        0.011482560075819492,\n        0.0033188736997544765,\n        0.1010018140077591,\n        0.007895300164818764,\n        -0.017003314569592476,\n        0.01089221891015768,\n        -0.005164115224033594,\n        -0.003056382294744253,\n        -0.0040303491987288,\n        0.03558962047100067,\n        0.005108695011585951,\n        0.009430734440684319,\n        -0.010044580325484276,\n        0.007733832113444805,\n        0.018170882016420364,\n        -0.01878981851041317,\n        0.01000446081161499,\n        -0.010283484123647213,\n        0.006260381080210209,\n        -0.0013493869919329882,\n        -0.02383158728480339,\n        -0.017606984823942184,\n        0.0194097813218832,\n        -0.02355300635099411,\n        0.003576204413548112,\n        -0.0006366081070154905,\n        -0.009569988586008549,\n        0.06411444395780563,\n        -0.007499538827687502,\n        0.010277112945914268,\n        0.013538648374378681,\n        -0.0006888934294693172,\n        -0.011123319156467915,\n        -0.028094075620174408,\n        -0.013262215070426464,\n        0.0015999572351574898,\n        -0.044100988656282425,\n        0.03183739259839058,\n        -0.0017592963995411992,\n        -0.0037527806125581264,\n        -0.006853809114545584,\n        -0.010225198231637478,\n        -0.0018267880659550428,\n        -0.006650703027844429,\n        -0.00990586169064045,\n        -0.030319632962346077,\n        0.00015370124310720712,\n        0.010265646502375603,\n        0.00495378440245986,\n        -0.00048593859537504613,\n        -0.04260382801294327,\n        -0.009570952504873276,\n        0.007734991144388914,\n        -0.011329327709972858,\n        0.0017088445601984859,\n        -0.010869328863918781,\n        -0.002566687762737274,\n        -0.008473731577396393,\n        0.0008430029265582561,\n        0.003394141560420394,\n        0.005351088475435972,\n        -0.013263622298836708,\n        -0.001992715522646904,\n        -0.013496188446879387,\n        -0.008115466684103012,\n        0.01757880114018917,\n        -0.1525864154100418,\n        -0.00617673946544528,\n        0.01879849098622799,\n        -0.03187150880694389,\n        -0.017488153651356697,\n        -0.018026674166321754,\n        0.014272991567850113,\n        0.012175839394330978,\n        0.0032331550028175116,\n        0.012283007614314556,\n        -0.021766364574432373,\n        0.12721872329711914,\n        0.005080587696284056,\n        -0.0015748759033158422,\n        -0.000818127125967294,\n        -0.014031185768544674,\n        0.013247925788164139,\n        0.009132583625614643,\n        -0.002362854778766632,\n        -0.022283362224698067,\n        -0.015198477543890476,\n        0.1153784915804863,\n        0.004176763817667961,\n        0.024438615888357162,\n        0.004605919122695923,\n        -0.010780734941363335,\n        0.00490774679929018,\n        0.011173811741173267,\n        0.0012403366854414344,\n        -0.003946635872125626,\n        -0.019072582945227623,\n        0.0037975080776959658,\n        0.012021948583424091\n      ],\n      \"label\": \"HIGH\",\n      \"text\": \"There areFor the first 20 items below, please select the response that best indicates how much you agree with each statement. There are no right or wrong answers, so please respond as honestly as possible. If you are an independent contractor, when you see \\u201corganization,\\u201d bring to mind people in your profession\\u2014that is, people who do the same kind of work as you. When you see \\u201ccolleague,\\u201d bring to mind people who you interact with during work, such as clients, vendors, or peers in your field.\\n\\nThe final six questions will help our research team see how people\\u2019s levels of happiness at work relate to factors like gender, age, and profession.\\n\\nWhen you're done, you'll get your happiness-at-work score, along with ideas for cultivating more happiness at work.\"\n    },\n    {\n      \"embedding\": [\n        0.02097022347152233,\n        -0.004369220230728388,\n        -0.0017507118172943592,\n        -0.009697705507278442,\n        -0.024211008101701736,\n        -0.006609389558434486,\n        0.016151877120137215,\n        -0.01088809035718441,\n        -0.00036297328188084066,\n        -0.07029043883085251,\n        -0.015476536937057972,\n        -0.0033059848938137293,\n        0.006392703391611576,\n        -0.009658143855631351,\n        -0.033278919756412506,\n        0.015518778003752232,\n        0.017372507601976395,\n        -0.007968191057443619,\n        -0.010733040049672127,\n        -0.015157519839704037,\n        0.00857547391206026,\n        -0.009239564649760723,\n        0.03866586461663246,\n        -0.012023426592350006,\n        0.017018543556332588,\n        -0.00029703404288738966,\n        0.009056348353624344,\n        0.005635657347738743,\n        -0.014201287180185318,\n        0.03240927681326866,\n        -0.00509974779561162,\n        0.017522040754556656,\n        -0.004658373538404703,\n        -0.006905778776854277,\n        -0.01421413104981184,\n        -0.0014770480338484049,\n        0.002741528209298849,\n        -0.022603686898946762,\n        -0.008299492299556732,\n        0.003070591716095805,\n        -0.028333820402622223,\n        0.004878114443272352,\n        0.028470918536186218,\n        -0.020937854424118996,\n        -0.008650178089737892,\n        -0.02775544859468937,\n        -0.004232421517372131,\n        -0.003465931862592697,\n        0.0038973395712673664,\n        2.0833804228459485e-05,\n        -0.0019443219061940908,\n        -0.0017648108769208193,\n        0.002325588371604681,\n        0.008284538052976131,\n        0.006964058615267277,\n        0.005403584334999323,\n        0.001043770113028586,\n        -0.003632579930126667,\n        -0.011067710816860199,\n        0.016384443268179893,\n        -0.008297189138829708,\n        -0.008234452456235886,\n        0.016321225091814995,\n        0.003044720273464918,\n        -0.014306800439953804,\n        0.0011168004712089896,\n        0.004939896985888481,\n        -0.0013245183508843184,\n        -0.01183011569082737,\n        -0.012235276401042938,\n        -0.0018602911150082946,\n        0.009833380579948425,\n        0.014510502107441425,\n        0.06179720535874367,\n        0.01532120630145073,\n        -0.006786874495446682,\n        0.02663039229810238,\n        0.01793121173977852,\n        0.007124199997633696,\n        -0.0014896588400006294,\n        0.0044557200744748116,\n        0.002508907113224268,\n        -0.011794403195381165,\n        0.005367474164813757,\n        -0.005421864800155163,\n        0.0034567571710795164,\n        0.013681412674486637,\n        -0.016846340149641037,\n        -0.014527853578329086,\n        0.015079200267791748,\n        0.0042466772720217705,\n        -0.008906044065952301,\n        -0.025371188297867775,\n        -0.005096475128084421,\n        -0.011037678457796574,\n        0.020789235830307007,\n        0.003969920799136162,\n        0.0035049442667514086,\n        0.4049341380596161,\n        0.0030757375061511993,\n        -0.004956619814038277,\n        0.0015297613572329283,\n        0.0011348376283422112,\n        0.0005115129752084613,\n        0.018098488450050354,\n        -0.011098351329565048,\n        -0.009581909514963627,\n        -0.02367938868701458,\n        -0.0033088421914726496,\n        0.027910947799682617,\n        0.029258545488119125,\n        0.0034236221108585596,\n        0.004616097547113895,\n        0.0017378840129822493,\n        -0.0012457063421607018,\n        -0.02292543649673462,\n        -0.0015620725462213159,\n        0.006057647988200188,\n        0.016756538301706314,\n        -0.00974081177264452,\n        0.011754103936254978,\n        0.0010723195737227798,\n        0.06619712710380554,\n        0.009683380834758282,\n        -0.009418662637472153,\n        -0.00903476681560278,\n        0.002935564611107111,\n        -0.013775859959423542,\n        0.0090322345495224,\n        -0.006801027338951826,\n        -0.033686988055706024,\n        -0.010086692869663239,\n        -0.0044031268917024136,\n        0.0016607294091954827,\n        0.011058901436626911,\n        -0.000497513625305146,\n        -0.00904515665024519,\n        0.0006144575891084969,\n        -0.04782120883464813,\n        0.00972677767276764,\n        0.011449198238551617,\n        -0.01712685637176037,\n        0.010582040064036846,\n        -0.02186397649347782,\n        -0.025253385305404663,\n        0.18804773688316345,\n        -0.003195506986230612,\n        -0.013454404659569263,\n        -0.0031885376665741205,\n        -0.007693212479352951,\n        -0.001946758828125894,\n        -0.017842311412096024,\n        -0.012705796398222446,\n        0.010646204464137554,\n        0.004529325291514397,\n        -0.010754495859146118,\n        0.020387185737490654,\n        0.00040853681275621057,\n        -0.0007999177905730903,\n        0.005527019500732422,\n        -0.057026948779821396,\n        -0.0006852099322713912,\n        -0.011241977103054523,\n        0.036101195961236954,\n        0.006345205474644899,\n        -0.009724961593747139,\n        -0.0010234597139060497,\n        -0.05421486496925354,\n        0.01887579634785652,\n        0.031604938209056854,\n        0.0012320965761318803,\n        -0.005332090426236391,\n        -0.15585821866989136,\n        0.01381760835647583,\n        0.013382314704358578,\n        0.004662747494876385,\n        0.006070825271308422,\n        0.007456205785274506,\n        -0.005116784945130348,\n        -0.012430679053068161,\n        -0.015543055720627308,\n        0.010741318576037884,\n        0.006544355768710375,\n        0.0003401745925657451,\n        -0.020678412169218063,\n        0.011324383318424225,\n        0.01013749185949564,\n        -0.019834188744425774,\n        -0.004335750825703144,\n        0.00022011609689798206,\n        0.0054007526487112045,\n        -0.016416320577263832,\n        0.005657725501805544,\n        0.006817271001636982,\n        0.015985554084181786,\n        -0.0017270444659516215,\n        0.012217782437801361,\n        -0.013873056508600712,\n        -0.009019669145345688,\n        0.0004460039781406522,\n        -0.011030156165361404,\n        0.003174826502799988,\n        -0.015452335588634014,\n        -0.001118419342674315,\n        0.01863214187324047,\n        0.011117657646536827,\n        0.0035748067311942577,\n        0.00609815726056695,\n        0.017794352024793625,\n        0.0028574285097420216,\n        -0.01774796098470688,\n        -0.004545307718217373,\n        -0.0036736316978931427,\n        0.02077566646039486,\n        0.03575446829199791,\n        -0.016739489510655403,\n        0.0048050773330032825,\n        0.005845879204571247,\n        0.00519740954041481,\n        -0.004354827105998993,\n        -0.0007293774397112429,\n        0.009709789417684078,\n        -0.013647634536027908,\n        -3.4138818591600284e-05,\n        0.0014555897796526551,\n        0.0076501211151480675,\n        0.005992223974317312,\n        -0.017624827101826668,\n        -0.0025880439206957817,\n        -0.01446490827947855,\n        0.008778639137744904,\n        0.014683819375932217,\n        0.0035648636985570192,\n        -0.007330542895942926,\n        0.00186175259295851,\n        -0.009409462101757526,\n        -0.006365787237882614,\n        0.012984918430447578,\n        0.0019954442977905273,\n        0.01815822906792164,\n        0.004223640076816082,\n        -0.0030994650442153215,\n        0.021254654973745346,\n        -0.010538513772189617,\n        -0.0010713770752772689,\n        0.011517023667693138,\n        0.02087157964706421,\n        0.009095550514757633,\n        -0.005490378476679325,\n        -0.0027090711519122124,\n        0.05360639840364456,\n        0.015144318342208862,\n        -0.014207273721694946,\n        -0.013202124275267124,\n        -0.02834099717438221,\n        -0.002231049118563533,\n        -0.011391009204089642,\n        -0.07880819588899612,\n        -0.019392915070056915,\n        -0.0068978201597929,\n        0.009264707565307617,\n        -0.19192683696746826,\n        0.01293808314949274,\n        0.01791219785809517,\n        8.0978570622392e-05,\n        -0.008437850512564182,\n        0.018758634105324745,\n        -0.0020859423093497753,\n        -0.013625075109302998,\n        -0.003565669059753418,\n        -0.031298067420721054,\n        0.004591320641338825,\n        -0.035708505660295486,\n        0.0037988717667758465,\n        -0.01197122409939766,\n        0.020125817507505417,\n        -0.0020873534958809614,\n        -0.006226880010217428,\n        0.0033891478087753057,\n        -0.0025380277074873447,\n        -0.010174546390771866,\n        0.00858669076114893,\n        -0.009604323655366898,\n        0.037741292268037796,\n        -0.023043235763907433,\n        0.012422914616763592,\n        0.0035245444159954786,\n        0.007548332214355469,\n        0.014019536785781384,\n        0.251288503408432,\n        0.027280345559120178,\n        0.0019370527006685734,\n        0.021075919270515442,\n        -0.025813480839133263,\n        -0.005301231052726507,\n        -0.0014066030271351337,\n        -0.033034853637218475,\n        0.0033729032147675753,\n        0.001645048032514751,\n        -0.0008068750612437725,\n        -0.015099477022886276,\n        -0.006337057799100876,\n        -0.03702835738658905,\n        0.003802512539550662,\n        -0.021590281277894974,\n        -0.005723395850509405,\n        -0.002284484915435314,\n        0.015298973768949509,\n        -0.041419390588998795,\n        -0.004640225321054459,\n        0.018159424886107445,\n        0.0029816688038408756,\n        0.008025558665394783,\n        0.006675052922219038,\n        -0.009407740086317062,\n        -0.03340199589729309,\n        -0.022405924275517464,\n        0.032420556992292404,\n        0.011965801939368248,\n        -0.04901342839002609,\n        0.0009932599496096373,\n        0.012963165529072285,\n        -0.026639074087142944,\n        -0.008498531766235828,\n        0.005407733842730522,\n        0.004712013527750969,\n        -0.006985832937061787,\n        -0.018440432846546173,\n        -0.016954120248556137,\n        0.0023095046635717154,\n        0.0011763478396460414,\n        0.01327161118388176,\n        -0.019253069534897804,\n        -0.011411641724407673,\n        0.0005729945842176676,\n        -0.010652609169483185,\n        -0.004637314006686211,\n        0.01814819499850273,\n        0.0030704743694514036,\n        0.0033292255830019712,\n        -0.020464714616537094,\n        -0.006002663169056177,\n        -0.013803992420434952,\n        0.008294327184557915,\n        0.013695771805942059,\n        0.0027001728303730488,\n        0.017884742468595505,\n        -0.00675587123259902,\n        0.014232882298529148,\n        0.005150592420250177,\n        -0.0011929317843168974,\n        0.011970275081694126,\n        -0.00020247873908374459,\n        0.02525816671550274,\n        -0.011494622565805912,\n        -0.011424089781939983,\n        -0.008766510523855686,\n        -0.01209302432835102,\n        0.00046659319195896387,\n        0.0064234319142997265,\n        0.00474164355546236,\n        -0.1345837116241455,\n        0.021528590470552444,\n        0.010719888843595982,\n        -0.012849122285842896,\n        0.006240712944418192,\n        -0.0042886557057499886,\n        -0.0015430357307195663,\n        0.0004915404133498669,\n        0.02833476848900318,\n        0.006856171879917383,\n        -0.009785940870642662,\n        0.009011870250105858,\n        0.012760494835674763,\n        -0.014790494926273823,\n        0.003581338794901967,\n        0.009828855283558369,\n        0.04114069044589996,\n        0.009924870915710926,\n        -0.01632988639175892,\n        -0.018036553636193275,\n        0.002079735277220607,\n        0.019526902586221695,\n        -0.0051713502034544945,\n        -0.001154646510258317,\n        -0.005403199698776007,\n        0.0027993284165859222,\n        -0.032100167125463486,\n        -0.005355239380151033,\n        -0.004296197555959225,\n        0.026332642883062363,\n        -0.014379935339093208,\n        0.0006837589317001402,\n        -0.0027139876037836075,\n        -0.0012711816234514117,\n        0.00166658207308501,\n        0.0018234610324725509,\n        0.016310207545757294,\n        0.011192855425179005,\n        -0.021683987230062485,\n        -0.017013894394040108,\n        0.008641228079795837,\n        0.004246944095939398,\n        0.00785343162715435,\n        -0.016663435846567154,\n        -0.0012816331582143903,\n        0.004961339291185141,\n        -0.021489381790161133,\n        -0.10696616768836975,\n        -0.01712295040488243,\n        -0.005995514336973429,\n        -0.017720071598887444,\n        -0.011893881484866142,\n        0.009334523230791092,\n        0.011790679767727852,\n        -0.00023590178170707077,\n        -0.0015280862571671605,\n        -0.0019485366065055132,\n        0.017535215243697166,\n        0.013325396925210953,\n        0.007206453010439873,\n        -0.00019408081425353885,\n        0.006093115545809269,\n        -0.021983813494443893,\n        -0.0023606542963534594,\n        0.02477640099823475,\n        0.007117456290870905,\n        -0.015776557847857475,\n        0.008100870065391064,\n        0.016591424122452736,\n        -0.057483237236738205,\n        -0.0034693842753767967,\n        -0.004508281592279673,\n        -0.027930838987231255,\n        -0.009476313367486,\n        -0.012451335787773132,\n        0.003925575874745846,\n        -0.0186696108430624,\n        -0.009167877025902271,\n        0.33741942048072815,\n        -0.0050614215433597565,\n        0.012546336278319359,\n        0.0029392975848168135,\n        -0.017881028354167938,\n        0.005992253310978413,\n        0.010283490642905235,\n        -0.00985571276396513,\n        0.054668691009283066,\n        0.004141271114349365,\n        -0.019514823332428932,\n        -0.02145269140601158,\n        0.006608589552342892,\n        0.0014876879286020994,\n        -0.01889641582965851,\n        0.030736297369003296,\n        0.003966257907450199,\n        -0.0011384374229237437,\n        -0.011920280754566193,\n        -0.001969211967661977,\n        -0.00467730313539505,\n        -0.00602044677361846,\n        0.01327419187873602,\n        -0.01640086993575096,\n        0.008825773373246193,\n        0.01621912606060505,\n        0.004083969630300999,\n        -0.0005541503196582198,\n        -0.0014436495257541537,\n        -0.00971678365021944,\n        -0.010479327291250229,\n        0.021590039134025574,\n        0.010460038669407368,\n        0.010274138301610947,\n        0.005339257884770632,\n        -0.015950458124279976,\n        0.010855426080524921,\n        0.0022004542406648397,\n        0.005522096995264292,\n        0.00863470695912838,\n        0.014646399766206741,\n        -0.002894118195399642,\n        0.053492479026317596,\n        -0.0023761510383337736,\n        0.008908823132514954,\n        0.014047897420823574,\n        -0.0069345273077487946,\n        -0.004637870471924543,\n        0.01948617398738861,\n        0.014830359257757664,\n        -0.01012710016220808,\n        0.01677773706614971,\n        0.009484595619142056,\n        -0.011353382840752602,\n        0.011768719181418419,\n        0.014142694883048534,\n        0.01000466663390398,\n        -0.01430897694081068,\n        0.0020341970957815647,\n        0.00886404886841774,\n        0.0039896490052342415,\n        -0.010463311336934566,\n        -0.012243733741343021,\n        -0.002663240535184741,\n        0.011661709286272526,\n        -0.010023723356425762,\n        0.013912378810346127,\n        -0.011314647272229195,\n        -0.01262218039482832,\n        -0.01118854433298111,\n        -0.012637081556022167,\n        -6.770709296688437e-05,\n        -0.007140979170799255,\n        0.008072788827121258,\n        0.015689508989453316,\n        0.0080292709171772,\n        -0.030791884288191795,\n        -0.0018460400169715285,\n        0.0018756297649815679,\n        -0.009317141026258469,\n        -0.02006065659224987,\n        -0.013302366249263287,\n        -0.0011909196618944407,\n        -0.012443818151950836,\n        -0.006777186878025532,\n        0.0008461675024591386,\n        -0.035622816532850266,\n        -0.02547316439449787,\n        0.0010441045742481947,\n        0.007544719614088535,\n        0.0024396637454628944,\n        -0.00985526479780674,\n        -0.010602026246488094,\n        0.007193258497864008,\n        0.002602117834612727,\n        0.008900025859475136,\n        -0.00014088516763877124,\n        -0.007901104167103767,\n        -0.00896727666258812,\n        0.01349995844066143,\n        0.026993511244654655,\n        -0.00028254982316866517,\n        0.011294967494904995,\n        -0.008759165182709694,\n        -0.004688120447099209,\n        -0.0007492068689316511,\n        -8.430174784734845e-05,\n        0.015168462879955769,\n        -0.005230848677456379,\n        0.004492072854191065,\n        0.018789663910865784,\n        0.0009780930122360587,\n        0.005929945036768913,\n        0.004375317133963108,\n        -0.004090371076017618,\n        0.01139445323497057,\n        -0.011413550935685635,\n        -0.024114718660712242,\n        -0.47423967719078064,\n        0.008717136457562447,\n        -0.004360011778771877,\n        0.006598907057195902,\n        -0.019274543970823288,\n        -0.0006434047827497125,\n        0.022911880165338516,\n        0.011921596713364124,\n        0.01578226312994957,\n        0.000812510319519788,\n        -0.019144322723150253,\n        -0.009322457946836948,\n        -0.13641013205051422,\n        0.018195170909166336,\n        -0.012306428514420986,\n        -0.0024619936011731625,\n        -0.01516583003103733,\n        -0.05794670805335045,\n        0.0051151905208826065,\n        0.02992730215191841,\n        -0.011691829189658165,\n        0.01820489764213562,\n        0.017589302733540535,\n        0.012499017640948296,\n        0.022172806784510612,\n        -0.0026344701182097197,\n        -0.009194989688694477,\n        -0.0008573894156143069,\n        0.008696956560015678,\n        -0.002476254478096962,\n        -0.0023840905632823706,\n        -0.00855986401438713,\n        0.02228427305817604,\n        0.002604201901704073,\n        -0.003257936565205455,\n        -0.012980549596250057,\n        -0.004181983880698681,\n        -0.0026827019173651934,\n        0.012630967423319817,\n        -0.020802801474928856,\n        -0.005520148668438196,\n        0.004386918619275093,\n        0.010412688367068768,\n        0.007900970987975597,\n        -0.03703220933675766,\n        -0.012953515164554119,\n        -0.029500558972358704,\n        -0.1511998474597931,\n        0.00114737288095057,\n        -0.0018270158907398582,\n        0.011964279226958752,\n        -0.0006102338084019721,\n        -0.0024675526656210423,\n        -0.0028347200714051723,\n        -0.01380885113030672,\n        0.013493899255990982,\n        0.008722757920622826,\n        -0.001750538358464837,\n        0.015931541100144386,\n        -0.018738603219389915,\n        -0.01631133444607258,\n        -0.007697701919823885,\n        0.029586108401417732,\n        -0.0009039948345161974,\n        0.0005460886750370264,\n        0.0071763708256185055,\n        -0.01904180459678173,\n        -0.00026316841831430793,\n        -0.00804136972874403,\n        -0.02469320222735405,\n        -0.003908350598067045,\n        0.0009877149714156985,\n        -0.004626819398254156,\n        0.0073111276142299175,\n        0.01716233417391777,\n        0.0195477157831192,\n        0.0007486658287234604,\n        -0.0023714383132755756,\n        0.009246451780200005,\n        -0.003834368893876672,\n        -0.0230763740837574,\n        -0.003334503388032317,\n        0.021221259608864784,\n        0.02663431130349636,\n        0.01795773394405842,\n        -0.013633943162858486,\n        -0.0012397594982758164,\n        0.018533267080783844,\n        -0.012497101910412312,\n        0.002713587833568454,\n        -0.0015688012354075909,\n        0.0035198479890823364,\n        0.006946417968720198,\n        -0.008940530009567738,\n        -0.002667473629117012,\n        0.006246425211429596,\n        -0.015519184991717339,\n        0.00028973602456972003,\n        -0.023582642897963524,\n        -0.01542600616812706,\n        -0.00485308887436986,\n        0.008225361816585064,\n        0.009229864925146103,\n        -0.026558056473731995,\n        -0.006083701271563768,\n        -0.02138127200305462,\n        0.17396242916584015,\n        0.003946243319660425,\n        -0.004289144650101662,\n        -0.0052990783005952835,\n        -0.003975321538746357,\n        0.01541078370064497,\n        -0.004461473319679499,\n        0.005518772639334202,\n        0.09371162950992584,\n        0.00583690544590354,\n        -0.011096891015768051,\n        0.01309591718018055,\n        -0.002853096928447485,\n        0.001146074035204947,\n        -0.0009543578489683568,\n        0.025493871420621872,\n        0.0027819767128676176,\n        0.005981987342238426,\n        -0.006608216557651758,\n        0.00558258593082428,\n        0.012502925470471382,\n        -0.012086748145520687,\n        0.013713348656892776,\n        -0.007963196374475956,\n        0.0024229881819337606,\n        0.0034177417401224375,\n        -0.02662755735218525,\n        -0.011048832908272743,\n        0.018717458471655846,\n        -0.020952133461833,\n        0.0032562881242483854,\n        0.004586957860738039,\n        -0.014999909326434135,\n        0.06270445138216019,\n        -0.017583608627319336,\n        0.0050298674032092094,\n        0.01635526306927204,\n        -0.0068793706595897675,\n        -0.0023930007591843605,\n        -0.024358632043004036,\n        -0.010301775299012661,\n        -0.004185901954770088,\n        -0.032251983880996704,\n        0.03414241597056389,\n        -0.0018554824637249112,\n        -0.008953011594712734,\n        -0.017522431910037994,\n        -0.013254757970571518,\n        0.0020176635589450598,\n        -0.008206196129322052,\n        -0.015221131034195423,\n        -0.009796847589313984,\n        -0.008111291565001011,\n        0.0053167156875133514,\n        -0.0031628136057406664,\n        -0.0027838817331939936,\n        -0.03410114720463753,\n        -0.004961937200278044,\n        0.017257291823625565,\n        -0.005970523227006197,\n        0.001730006537400186,\n        0.0004900294006802142,\n        0.00016542086086701602,\n        -0.002856866456568241,\n        0.004783200100064278,\n        -0.004749262239784002,\n        -0.004532736260443926,\n        -0.023805364966392517,\n        0.00139817432500422,\n        -0.011689232662320137,\n        -0.009818688966333866,\n        0.014156000688672066,\n        -0.14711301028728485,\n        -0.004627136047929525,\n        0.005320393480360508,\n        -0.03693709149956703,\n        -0.022617321461439133,\n        -0.017308421432971954,\n        0.022724172100424767,\n        0.014989112503826618,\n        -0.002818354871124029,\n        0.01318431831896305,\n        -0.0032003424130380154,\n        0.11439359933137894,\n        -0.01119931973516941,\n        -0.003706853836774826,\n        -0.0028451455291360617,\n        -0.0151633620262146,\n        0.016564032062888145,\n        0.01333682518452406,\n        -0.006984272040426731,\n        -0.017313336953520775,\n        -0.001134516904130578,\n        0.11178696900606155,\n        0.004079824313521385,\n        0.0286286398768425,\n        0.011108658276498318,\n        -0.008215953595936298,\n        -0.0010762395104393363,\n        0.004289655480533838,\n        0.012484685517847538,\n        -0.005259339697659016,\n        -0.010291028767824173,\n        0.007088017649948597,\n        0.011573768220841885\n      ],\n      \"label\": \"HIGH\",\n      \"text\": \"You will be given a definition of a task first, then some input of the task.\\nThe input is taken from a negotiation between two participants who take the role of campsite neighbors and negotiate for Food, Water, and Firewood packages, based on their individual preferences and requirements. Given an utterance and recent dialogue context containing past 3 utterances (wherever available), output Yes if the utterance contains the small-talk strategy, otherwise output No. small-talk is a cooperative negotiation strategy. It is used for discussing topics apart from the negotiation, in an attempt to build a rapport with the opponent. For example, discussing how the opponent is doing during the pandemic or sharing excitement for the camping trip.\\n\\nContext: 'Hello there! Are you excited for your camping trip coming up?! I am excited to see how I can put my skills to the test!' 'Yeah. Nice to get out after being inside for most of the spring. This covid-19 crap! wish it would go away.' 'I agree!  I will say it has really sparked my interest in camping and being outdoors even more though! I saw just how connected I was to technology and everything else!'\\nUtterance: 'I'm up here to do some cross training and noticed that there is some extra water around. Even though the nights are cold I could use some extra water. Do you exercise much?'\\nOutput:\"\n    },\n    {\n      \"embedding\": [\n        0.033459778875112534,\n        0.001421562279574573,\n        0.0010524262906983495,\n        -0.016645651310682297,\n        -0.02737800031900406,\n        -0.005332048982381821,\n        0.02020396664738655,\n        -0.0003606854588724673,\n        0.0007377561996690929,\n        -0.07639937847852707,\n        -0.014130659401416779,\n        0.0012349069584161043,\n        -0.0003921024617739022,\n        -0.0033757342025637627,\n        -0.03728772699832916,\n        0.005866531748324633,\n        0.012130054645240307,\n        0.0026403446681797504,\n        -0.008765419013798237,\n        -0.014221437275409698,\n        0.0021243442315608263,\n        -0.008648598566651344,\n        0.040335334837436676,\n        -0.0188702791929245,\n        0.008009920828044415,\n        0.0035775599535554647,\n        0.014971074648201466,\n        -0.00024099672737065703,\n        -0.014798235148191452,\n        0.021314367651939392,\n        0.010991184040904045,\n        0.011647680774331093,\n        -0.001608684309758246,\n        0.001207549124956131,\n        -0.01359281875193119,\n        -0.0015633116709068418,\n        -0.006050948519259691,\n        -0.02142554707825184,\n        -0.013876033946871758,\n        -0.013546458445489407,\n        -0.03735177963972092,\n        0.004984384868294001,\n        0.04902656003832817,\n        -0.017263714224100113,\n        0.00234355591237545,\n        -0.028870176523923874,\n        0.011396653018891811,\n        0.0038851844146847725,\n        0.0007634982466697693,\n        0.00796427670866251,\n        0.007254378870129585,\n        -0.002074926858767867,\n        0.0023879471700638533,\n        0.004964875988662243,\n        0.011345402337610722,\n        0.005101376213133335,\n        -0.007884525693953037,\n        0.012506681494414806,\n        -0.026621012017130852,\n        0.016942299902439117,\n        -0.0031775832176208496,\n        0.000370789464795962,\n        0.021466340869665146,\n        -0.0015240106731653214,\n        -0.015172579325735569,\n        0.003222959814593196,\n        0.00031613020109944046,\n        0.0007252184441313148,\n        -0.015154466964304447,\n        -0.007652830798178911,\n        0.0016051463317126036,\n        0.01536582037806511,\n        0.010046528652310371,\n        0.062043577432632446,\n        0.018240027129650116,\n        -0.013601118698716164,\n        0.03003767505288124,\n        0.002213793806731701,\n        -0.0021649636328220367,\n        -0.0036399136297404766,\n        0.010648192837834358,\n        0.011340230703353882,\n        -0.00831544678658247,\n        -0.003156946739181876,\n        -0.013500471599400043,\n        -0.017611747607588768,\n        0.017467360943555832,\n        -0.008896801620721817,\n        0.002927709138020873,\n        0.023353567346930504,\n        0.00729175703600049,\n        -0.011762223206460476,\n        -0.005960366223007441,\n        -0.005446196999400854,\n        -0.0022420131135731936,\n        0.01188819669187069,\n        -0.00440125772729516,\n        -0.005174392368644476,\n        0.4145232141017914,\n        -0.006580383516848087,\n        0.004556962754577398,\n        -0.0015857695834711194,\n        0.012723060324788094,\n        -0.006483821664005518,\n        0.02510957606136799,\n        -0.028238335624337196,\n        -0.002224286552518606,\n        -0.025707527995109558,\n        0.003612991888076067,\n        0.027130750939249992,\n        0.029940109699964523,\n        -0.004524617455899715,\n        0.0010018154280260205,\n        -0.004881752654910088,\n        -0.0008727079839445651,\n        -0.020722640678286552,\n        0.007123685907572508,\n        0.00963438767939806,\n        0.011283133178949356,\n        -0.0033901503775268793,\n        0.007250521332025528,\n        -0.008798872120678425,\n        0.0660477951169014,\n        0.0032588320318609476,\n        -0.0007555850315839052,\n        -0.012996074743568897,\n        0.0012563985073938966,\n        -0.013021985068917274,\n        0.013817096129059792,\n        -0.015648918226361275,\n        -0.040911123156547546,\n        -0.00783861055970192,\n        -0.01118888147175312,\n        -0.014736064709722996,\n        0.0014706968795508146,\n        0.0025146231055259705,\n        -0.007432971149682999,\n        -0.003209255635738373,\n        -0.05301109701395035,\n        0.013863767497241497,\n        -0.0013567464193329215,\n        -0.013151113875210285,\n        -0.003534118179231882,\n        -0.012216891162097454,\n        -0.014519572257995605,\n        0.18364650011062622,\n        -0.008389292284846306,\n        0.0013295197859406471,\n        -0.013583270832896233,\n        0.0007344501209445298,\n        0.0021660281345248222,\n        -0.024418242275714874,\n        -0.010439913719892502,\n        0.004424296785145998,\n        -0.01620485447347164,\n        -0.007077345158904791,\n        0.014270773157477379,\n        0.007957200519740582,\n        0.0015524809714406729,\n        -0.00810178741812706,\n        -0.06643027067184448,\n        0.007476020138710737,\n        -0.013591074384748936,\n        0.024599604308605194,\n        0.004047069698572159,\n        -0.010951877571642399,\n        0.0035545446444302797,\n        -0.04287929832935333,\n        0.0010465114610269666,\n        0.028430821374058723,\n        0.000489047437440604,\n        -0.004502221941947937,\n        -0.15476278960704803,\n        0.030519943684339523,\n        0.012503622099757195,\n        0.004495960660278797,\n        0.0005379545036703348,\n        0.008815871551632881,\n        -0.0058137597516179085,\n        -0.013475947082042694,\n        -0.02176654152572155,\n        0.019977670162916183,\n        0.006128439214080572,\n        0.004071063362061977,\n        -0.027388321235775948,\n        0.005827539600431919,\n        0.004373704548925161,\n        -0.011543148197233677,\n        -0.0038180770352482796,\n        0.012244129553437233,\n        -0.0003417891275603324,\n        -0.015636924654245377,\n        -0.0012809829786419868,\n        0.01523961964994669,\n        0.005002998746931553,\n        0.0006000992725603282,\n        0.009534427896142006,\n        -0.01464542280882597,\n        -0.0011118102120235562,\n        0.0005236697616055608,\n        -0.008358091115951538,\n        0.0006689674919471145,\n        -0.007240992970764637,\n        0.01211706455796957,\n        0.017575178295373917,\n        0.0019223261624574661,\n        -0.00023158911790233105,\n        0.009377868846058846,\n        0.018375977873802185,\n        -0.004968402907252312,\n        -0.009109672158956528,\n        -0.0003921792667824775,\n        -0.005333150736987591,\n        0.035591088235378265,\n        0.03600693121552467,\n        -0.02147909812629223,\n        -0.0051480624824762344,\n        0.006165370345115662,\n        0.009821688756346703,\n        0.002560886088758707,\n        -0.009432551451027393,\n        0.010266033932566643,\n        -0.02346210367977619,\n        -0.008502157405018806,\n        -0.0012980429455637932,\n        0.0023280049208551645,\n        0.015968363732099533,\n        -0.0003465303161647171,\n        0.011462878435850143,\n        -0.018927177414298058,\n        0.012223249301314354,\n        0.01382541935890913,\n        0.00015737862850073725,\n        -0.013864782638847828,\n        -0.0021835651714354753,\n        -0.000595265009906143,\n        0.000923941726796329,\n        0.00445782532915473,\n        0.002381668658927083,\n        0.024392083287239075,\n        -0.0049691773019731045,\n        -0.005626379512250423,\n        0.02564881183207035,\n        -0.005667234305292368,\n        0.004024100489914417,\n        0.018130775541067123,\n        0.02024785801768303,\n        0.0028796824626624584,\n        -0.0035633682273328304,\n        0.0011512009659782052,\n        0.053084686398506165,\n        0.015628794208168983,\n        -0.01728152111172676,\n        -0.015325648710131645,\n        -0.029144130647182465,\n        -0.008321577683091164,\n        -0.004259747453033924,\n        -0.08534607291221619,\n        -0.025974372401833534,\n        -0.014101552776992321,\n        0.020934313535690308,\n        -0.18763171136379242,\n        0.0011211680248379707,\n        0.0025929505936801434,\n        0.006431338842958212,\n        -0.015527424402534962,\n        0.017532773315906525,\n        0.010491142980754375,\n        -0.019933372735977173,\n        0.007796863093972206,\n        -0.03287653252482414,\n        -0.0015002918662503362,\n        -0.03585309535264969,\n        0.0063593690283596516,\n        0.0040895347483456135,\n        0.014110906049609184,\n        -0.011152371764183044,\n        0.003921156283468008,\n        -0.013562258332967758,\n        -0.002945862477645278,\n        -0.021535325795412064,\n        0.0076516857370734215,\n        -0.01987309753894806,\n        0.017691820859909058,\n        -0.017960485070943832,\n        0.029910271987318993,\n        0.017679180949926376,\n        0.014204920269548893,\n        0.00885753147304058,\n        0.2613638937473297,\n        0.012099375016987324,\n        -0.0031837434507906437,\n        0.014026282355189323,\n        -0.017597084864974022,\n        -0.004016974475234747,\n        -0.0014067522715777159,\n        -0.03579931706190109,\n        0.00795711949467659,\n        0.0037077332381159067,\n        0.006674998439848423,\n        -0.01294589415192604,\n        -0.0016168853035196662,\n        -0.025531677529215813,\n        -0.003652177983894944,\n        -0.025929654017090797,\n        0.011764583177864552,\n        -0.003676376771181822,\n        0.010419215075671673,\n        -0.039064135402441025,\n        -0.005708216689527035,\n        0.012162072584033012,\n        -0.0012700343504548073,\n        0.0010285243624821305,\n        0.012133137322962284,\n        -0.0068431724794209,\n        -0.02852100133895874,\n        -0.01665930077433586,\n        0.03240619972348213,\n        0.004486641846597195,\n        -0.0582830086350441,\n        0.016190925613045692,\n        0.003438584739342332,\n        -0.015564153902232647,\n        -0.004653316456824541,\n        0.01083111111074686,\n        0.003621668554842472,\n        -0.005580805707722902,\n        -0.01167239435017109,\n        -0.020599599927663803,\n        0.0004152003093622625,\n        -0.004249516408890486,\n        0.011161817237734795,\n        -0.018649699166417122,\n        -0.009452463127672672,\n        0.0010799105511978269,\n        -0.00826216209679842,\n        -0.004833356477320194,\n        0.002060206141322851,\n        0.0018021794967353344,\n        -0.0010147058637812734,\n        -0.008223430253565311,\n        -0.004437999799847603,\n        -0.012364676222205162,\n        0.014410804025828838,\n        0.021021714434027672,\n        0.003083434421569109,\n        0.010683181695640087,\n        -0.009097374975681305,\n        0.010654673911631107,\n        0.0009086697245948017,\n        -0.006629701238125563,\n        0.0017136078095063567,\n        -0.006379219237715006,\n        0.02242058329284191,\n        0.0038766711950302124,\n        -0.010057848878204823,\n        -0.011112888343632221,\n        -0.01867087557911873,\n        0.009870647452771664,\n        0.00395519332960248,\n        0.0029929266311228275,\n        -0.13695020973682404,\n        0.013145308010280132,\n        0.010143759660422802,\n        -0.005946755409240723,\n        0.0035892350133508444,\n        -0.013508658856153488,\n        0.006934008561074734,\n        -0.0019496619934216142,\n        0.0322909951210022,\n        0.013882932253181934,\n        0.0005734995356760919,\n        0.015035695396363735,\n        0.010342903435230255,\n        -0.020190633833408356,\n        -0.0012112186523154378,\n        0.004579080268740654,\n        0.045758623629808426,\n        0.010118851438164711,\n        -0.02395501732826233,\n        -0.017347518354654312,\n        0.004797273315489292,\n        0.016572657972574234,\n        -0.012037048116326332,\n        0.0001991482567973435,\n        0.0026565627194941044,\n        0.0008037450024858117,\n        -0.02690163441002369,\n        0.0017419991781935096,\n        -0.0021381075493991375,\n        0.015416855923831463,\n        -0.004950313363224268,\n        -0.013853956013917923,\n        -0.01122166309505701,\n        -0.009420251473784447,\n        -0.011867807246744633,\n        -0.004616198129951954,\n        0.012158054858446121,\n        0.011875941418111324,\n        -0.016149623319506645,\n        -0.009156730026006699,\n        0.007578459568321705,\n        -0.0021843004506081343,\n        0.004924781154841185,\n        -0.019440006464719772,\n        -0.004758198279887438,\n        0.009568018838763237,\n        -0.009518503211438656,\n        -0.09653161466121674,\n        -9.15543278097175e-05,\n        -0.0071185072883963585,\n        -0.020298395305871964,\n        -0.011116836220026016,\n        0.016519280150532722,\n        0.008172357454895973,\n        -0.00024082313757389784,\n        0.0025409278459846973,\n        -0.009602836333215237,\n        0.01701853610575199,\n        0.011437846347689629,\n        0.022100059315562248,\n        -0.004982588812708855,\n        0.0038053947500884533,\n        -0.024022791534662247,\n        -0.010850277729332447,\n        0.011733177118003368,\n        0.0020444232504814863,\n        -0.015609589405357838,\n        0.0038667269982397556,\n        0.0009128585807047784,\n        -0.043302662670612335,\n        -0.013394261710345745,\n        0.004143835976719856,\n        -0.02579447813332081,\n        -0.022519156336784363,\n        -0.01877371408045292,\n        0.004475703462958336,\n        -0.015516766346991062,\n        0.006409170106053352,\n        0.34700530767440796,\n        -0.013669494539499283,\n        0.014196186326444149,\n        0.0006854161038063467,\n        -0.012958659790456295,\n        -0.003960191272199154,\n        0.021256349980831146,\n        0.0022721299901604652,\n        0.05524519085884094,\n        0.004919665399938822,\n        -0.013411695137619972,\n        -0.020551638677716255,\n        0.006023036781698465,\n        0.005995188839733601,\n        -0.02375606819987297,\n        0.028146134689450264,\n        0.007261896505951881,\n        -0.012329843826591969,\n        0.008732064627110958,\n        -0.0009422618895769119,\n        0.001728344359435141,\n        -0.0030486315954476595,\n        0.005706174299120903,\n        -0.017352735623717308,\n        0.022818081080913544,\n        0.009765777736902237,\n        0.002687778789550066,\n        -0.0074526844546198845,\n        -0.003444158472120762,\n        -0.020048413425683975,\n        -0.011388340964913368,\n        0.017366277053952217,\n        0.008780421689152718,\n        0.01159325148910284,\n        0.0050803786143660545,\n        -0.013518651947379112,\n        0.011575252749025822,\n        0.0008789984276518226,\n        0.016960090026259422,\n        0.01292852871119976,\n        0.015612016431987286,\n        0.002338812919333577,\n        0.06544201821088791,\n        -0.005994707345962524,\n        0.011592106893658638,\n        0.010716577991843224,\n        -0.0004750303633045405,\n        -0.008762450888752937,\n        0.029816562309861183,\n        0.007648902479559183,\n        -0.004960892256349325,\n        0.019210321828722954,\n        0.012899541296064854,\n        -0.013555271551012993,\n        0.0010759513825178146,\n        -0.000439334922702983,\n        0.008133995346724987,\n        -0.0006622294895350933,\n        -0.0028458049055188894,\n        0.009021120145916939,\n        -0.018581006675958633,\n        -0.004870960023254156,\n        -0.01220852043479681,\n        -0.007339430972933769,\n        0.005477883853018284,\n        -0.010476009920239449,\n        0.010726235806941986,\n        -0.007992146536707878,\n        -0.017682675272226334,\n        -0.013278079219162464,\n        -0.012994245626032352,\n        0.005148045718669891,\n        -0.026919057592749596,\n        0.014221514575183392,\n        0.009399594739079475,\n        0.004345232620835304,\n        -0.025134697556495667,\n        0.0014653627295047045,\n        -0.0039649782702326775,\n        -0.016081752255558968,\n        -0.01066660787910223,\n        -0.01945536583662033,\n        -0.0007936030742712319,\n        -0.01650918275117874,\n        -0.00023761269403621554,\n        -0.0032082924153655767,\n        -0.029223011806607246,\n        -0.027909550815820694,\n        -0.008899594657123089,\n        0.016473662108182907,\n        -0.0023000906221568584,\n        -0.011267379857599735,\n        -0.010734021663665771,\n        0.003865395672619343,\n        -0.0009705884731374681,\n        0.01846783421933651,\n        0.00021854348597116768,\n        -0.003965614829212427,\n        -0.0053878054022789,\n        0.010152810253202915,\n        0.023629605770111084,\n        0.009114432148635387,\n        0.0065018110908567905,\n        0.0038818984758108854,\n        0.0023839380592107773,\n        -0.008062898181378841,\n        -0.0062478817999362946,\n        0.014953132718801498,\n        0.0007790522067807615,\n        -0.005355666857212782,\n        0.009539651684463024,\n        0.0019215752836316824,\n        0.021314172074198723,\n        -0.015605301596224308,\n        -0.00020401937945280224,\n        0.02125685103237629,\n        0.0028160312213003635,\n        -0.02826806530356407,\n        -0.4377288818359375,\n        0.010447852313518524,\n        -0.010033725760877132,\n        0.012522663921117783,\n        -0.018761634826660156,\n        -0.004305727314203978,\n        0.033592384308576584,\n        0.011837722733616829,\n        0.025311890989542007,\n        0.004389712121337652,\n        -0.02293105609714985,\n        -0.007347750011831522,\n        -0.13591451942920685,\n        0.011902919970452785,\n        -0.01756972447037697,\n        0.00425713462755084,\n        -0.025851283222436905,\n        -0.0578567199409008,\n        -0.0007325643091462553,\n        0.03864613175392151,\n        -0.013529197312891483,\n        0.019776571542024612,\n        0.016779113560914993,\n        0.011185627430677414,\n        0.015346083790063858,\n        -0.00020507122098933905,\n        0.002631064271554351,\n        -0.0051434701308608055,\n        0.007298874203115702,\n        -0.005541170947253704,\n        -0.0005102150025777519,\n        -0.008658431470394135,\n        0.031142396852374077,\n        -5.2863666496705264e-05,\n        -0.002082389546558261,\n        -0.0143782589584589,\n        0.0005448497249744833,\n        -0.0018543615005910397,\n        0.004521698225289583,\n        -0.021750690415501595,\n        -0.005666906014084816,\n        -0.001805200707167387,\n        0.012602541595697403,\n        0.014854681678116322,\n        -0.04145834222435951,\n        -0.01119255181401968,\n        -0.031160973012447357,\n        -0.14960694313049316,\n        0.002853160724043846,\n        -0.008212079294025898,\n        0.01080635841935873,\n        0.015210115350782871,\n        -0.006177205126732588,\n        -0.009805971756577492,\n        -0.011920196935534477,\n        0.00501015642657876,\n        0.009878367185592651,\n        0.001877774833701551,\n        0.025058623403310776,\n        -0.011412547901272774,\n        -0.00981230940669775,\n        -0.0035225250758230686,\n        0.039536960422992706,\n        0.0042572347447276115,\n        -0.011776418425142765,\n        0.008128655143082142,\n        -0.03394514322280884,\n        -0.004267956130206585,\n        -0.027139676734805107,\n        -0.022997787222266197,\n        -0.005867722909897566,\n        -0.004725532606244087,\n        -0.010931313037872314,\n        0.009692514315247536,\n        0.020777495577931404,\n        0.026239493861794472,\n        0.009641197510063648,\n        0.001683738431893289,\n        0.001144016277976334,\n        0.0080727469176054,\n        -0.027096940204501152,\n        -0.015207136981189251,\n        0.03106907568871975,\n        0.01654556393623352,\n        0.00831244233995676,\n        -0.009824855253100395,\n        0.006054932717233896,\n        0.012998013757169247,\n        -0.01179549377411604,\n        0.0008212191169150174,\n        -0.0009323552949354053,\n        0.004416804760694504,\n        0.0011310053523629904,\n        -0.017772015184164047,\n        -0.009435588493943214,\n        0.0037220213562250137,\n        -0.012902837246656418,\n        0.0035500393714755774,\n        -0.025274990126490593,\n        0.00045522264554165304,\n        -0.01072034239768982,\n        0.0003707150463014841,\n        0.013278753496706486,\n        -0.02585730515420437,\n        -0.008009902201592922,\n        -0.008436846546828747,\n        0.17157891392707825,\n        0.009207848459482193,\n        -0.01875978149473667,\n        -0.012766418047249317,\n        -0.005031143315136433,\n        0.010253168642520905,\n        0.0011867015855386853,\n        0.006922186817973852,\n        0.10689865052700043,\n        0.011713651940226555,\n        -0.009984122589230537,\n        0.0016462025232613087,\n        -0.005426486488431692,\n        0.005596696399152279,\n        0.0033328952267766,\n        0.030842581763863564,\n        0.005030364263802767,\n        0.011789985932409763,\n        -0.0032590050250291824,\n        0.007177162449806929,\n        0.017883021384477615,\n        -0.012921448796987534,\n        0.008227012120187283,\n        -0.006331886164844036,\n        -0.0005717856111004949,\n        -0.00030218850588425994,\n        -0.016364669427275658,\n        -0.016926387324929237,\n        0.021209588274359703,\n        -0.02714807167649269,\n        0.0012041814625263214,\n        0.005033661145716906,\n        -0.015197101049125195,\n        0.06131686642765999,\n        -0.01501754391938448,\n        0.003407321637496352,\n        0.02219986915588379,\n        0.007845696993172169,\n        0.006072301883250475,\n        -0.026708107441663742,\n        -0.001730305259115994,\n        0.002970270346850157,\n        -0.027821524068713188,\n        0.03264441341161728,\n        0.00017773597210180014,\n        0.004814888350665569,\n        -0.009157654829323292,\n        -0.01676422916352749,\n        0.0006788379396311939,\n        -0.001209742040373385,\n        -0.0096951425075531,\n        -0.026555219665169716,\n        -0.019289743155241013,\n        0.010601541958749294,\n        -0.012525915168225765,\n        -0.0006480672745965421,\n        -0.05170701816678047,\n        -0.010391058400273323,\n        0.007678105030208826,\n        -0.011093443259596825,\n        0.001327400328591466,\n        0.0025134920142591,\n        0.002986858831718564,\n        -0.00043617867049761117,\n        -0.0036434223875403404,\n        -0.004659387748688459,\n        0.013429196551442146,\n        -0.01742483116686344,\n        -0.013087205588817596,\n        -0.008859988301992416,\n        -0.009792208671569824,\n        0.011038958095014095,\n        -0.14939327538013458,\n        -0.00994909182190895,\n        0.011186330579221249,\n        -0.02393401972949505,\n        -0.0204219501465559,\n        -0.017608975991606712,\n        0.017760636284947395,\n        -0.0003667459823191166,\n        0.006191395688802004,\n        0.012312094680964947,\n        -0.002703151199966669,\n        0.12054524570703506,\n        -0.0076476167887449265,\n        -0.006750002969056368,\n        -0.006377140060067177,\n        -0.012504907324910164,\n        0.005043040961027145,\n        0.01255961786955595,\n        -0.0015848400071263313,\n        -0.02423817291855812,\n        -0.0133470818400383,\n        0.10489233583211899,\n        0.009116925299167633,\n        0.016661744564771652,\n        0.019378185272216797,\n        -0.013216628693044186,\n        0.0002931974595412612,\n        0.013064542785286903,\n        0.004026617389172316,\n        -0.0019253045320510864,\n        -0.013101684860885143,\n        0.008890990167856216,\n        0.005047812592238188\n      ],\n      \"label\": \"HIGH\",\n      \"text\": \"how do I make the page be replaced instead of opening another tab when I click on search?\"\n    },\n    {\n      \"embedding\": [\n        0.032732270658016205,\n        -0.001392580452375114,\n        -0.0008776120957918465,\n        -0.019797036424279213,\n        -0.02071225270628929,\n        -0.01397427637130022,\n        0.016620652750134468,\n        -0.0073995888233184814,\n        0.006394912954419851,\n        -0.08429377526044846,\n        -0.02382824942469597,\n        0.0012837708927690983,\n        0.006723617669194937,\n        -0.0007806746289134026,\n        -0.04158041626214981,\n        0.00734165171161294,\n        0.014670937322080135,\n        -0.0009752815240062773,\n        -0.005979623179882765,\n        -0.017601635307073593,\n        0.015230469405651093,\n        -0.009917262010276318,\n        0.049660101532936096,\n        -0.017470156773924828,\n        0.008302592672407627,\n        -0.001624629134312272,\n        0.025489583611488342,\n        0.01129896566271782,\n        -0.011973467655479908,\n        0.028172148391604424,\n        0.00044453819282352924,\n        0.021169133484363556,\n        -0.0029544627759605646,\n        -0.006823827978223562,\n        -0.021010078489780426,\n        0.01016394142061472,\n        -0.007514026947319508,\n        -0.018792469054460526,\n        -0.014685545116662979,\n        -0.011440543457865715,\n        -0.03301452472805977,\n        0.007305459585040808,\n        0.046548549085855484,\n        -0.015697838738560677,\n        -0.0056541007943451405,\n        -0.02686305344104767,\n        -0.004668164066970348,\n        0.01676640287041664,\n        0.009419670328497887,\n        0.01047518104314804,\n        -0.0004332006792537868,\n        -0.004346809815615416,\n        0.005667649209499359,\n        0.0151443462818861,\n        0.006213145796209574,\n        -0.0014872885076329112,\n        -0.004151480738073587,\n        0.007512174546718597,\n        -0.01886146515607834,\n        0.012535901740193367,\n        -0.004818020388484001,\n        -0.010539875365793705,\n        0.020257793366909027,\n        0.0026189631316810846,\n        -0.021288692951202393,\n        0.0029254888650029898,\n        0.0046872105449438095,\n        0.0032249963842332363,\n        -0.01969590224325657,\n        -0.004999887198209763,\n        -0.0020287891384214163,\n        0.001139319036155939,\n        0.01914866827428341,\n        0.06009266898036003,\n        0.02137751318514347,\n        -0.014255558140575886,\n        0.03628271073102951,\n        0.0023973460774868727,\n        0.0019151890883222222,\n        0.00062469148542732,\n        0.011787671595811844,\n        0.010810469277203083,\n        -0.011567851528525352,\n        0.0007999634835869074,\n        -0.005430176854133606,\n        -0.011918492615222931,\n        0.017552336677908897,\n        -0.009654697962105274,\n        -0.004444767255336046,\n        0.02215336449444294,\n        0.007978745736181736,\n        -0.00627146428450942,\n        -0.007229777984321117,\n        -0.006578929256647825,\n        -0.005155934486538172,\n        0.005478505045175552,\n        -0.002069938462227583,\n        -0.003599452320486307,\n        0.41182124614715576,\n        0.0006781216361559927,\n        -0.008221198804676533,\n        0.007121092639863491,\n        0.008906831964850426,\n        -0.012283188290894032,\n        0.02722267061471939,\n        -0.0191746074706316,\n        -0.008422034792602062,\n        -0.026830943301320076,\n        0.011681247502565384,\n        0.025530477985739708,\n        0.031038980931043625,\n        -0.008647152222692966,\n        0.011639261618256569,\n        -0.002818220527842641,\n        0.0069000315852463245,\n        -0.006281233858317137,\n        0.010972997173666954,\n        0.010288025252521038,\n        0.010261046700179577,\n        -0.002712931949645281,\n        0.007119164802134037,\n        -0.002537449821829796,\n        0.06443534046411514,\n        0.006125344429165125,\n        0.0047857630997896194,\n        -0.013773267157375813,\n        0.004947385750710964,\n        -0.014807240106165409,\n        0.021301446482539177,\n        -0.008626936003565788,\n        -0.045600730925798416,\n        -0.003955150488764048,\n        -0.009614968672394753,\n        -0.005304102320224047,\n        0.008328555151820183,\n        0.008415954187512398,\n        -0.010419306345283985,\n        0.0026603105943650007,\n        -0.039900362491607666,\n        0.009295756928622723,\n        0.0008917689556255937,\n        -0.0247377697378397,\n        -0.00542929582297802,\n        -0.02128087915480137,\n        -0.01378373522311449,\n        0.18733613193035126,\n        -0.008422079496085644,\n        -0.00724388612434268,\n        -0.00897043664008379,\n        -0.0019424958154559135,\n        -0.009772676043212414,\n        -0.02111320197582245,\n        -0.019190533086657524,\n        0.004934749566018581,\n        -0.01256105862557888,\n        -0.01323375478386879,\n        0.010647039860486984,\n        -0.005927267484366894,\n        -0.016797546297311783,\n        -0.007992868311703205,\n        -0.06525037437677383,\n        0.0009375126101076603,\n        -0.007862456142902374,\n        0.025849422439932823,\n        -0.007039099931716919,\n        -0.005645800847560167,\n        0.0014218161813914776,\n        -0.04151077941060066,\n        0.0011594484094530344,\n        0.03055650182068348,\n        0.013227966614067554,\n        -0.005709455348551273,\n        -0.15677037835121155,\n        0.015814505517482758,\n        0.015191003680229187,\n        0.006003809627145529,\n        0.004187790676951408,\n        -0.00391772948205471,\n        0.0008394576725549996,\n        -0.007543763145804405,\n        -0.022815130650997162,\n        0.007159125991165638,\n        0.006396957207471132,\n        0.004680739715695381,\n        -0.02420666068792343,\n        0.005246797110885382,\n        0.007663372438400984,\n        -0.0076994458213448524,\n        0.015476305969059467,\n        0.008856697008013725,\n        0.011213775724172592,\n        -0.008245720528066158,\n        0.003160090884193778,\n        0.003724931739270687,\n        0.007198771461844444,\n        -0.0009447194170206785,\n        0.01920301839709282,\n        -0.010841818526387215,\n        -0.0030987276695668697,\n        -0.002097106771543622,\n        -0.01245529018342495,\n        -7.303972961381078e-05,\n        -0.0018870312487706542,\n        0.00289120408706367,\n        0.020406564697623253,\n        0.005309820640832186,\n        -0.004867970943450928,\n        0.01690206490457058,\n        0.020743291825056076,\n        -0.0006492685060948133,\n        -0.0081311771646142,\n        -0.0016567722195759416,\n        -0.005096208304166794,\n        0.02339642494916916,\n        0.03647664189338684,\n        -0.012904783710837364,\n        -0.006811431143432856,\n        0.005024233367294073,\n        0.00639649061486125,\n        -0.0028374476823955774,\n        -0.006247507408261299,\n        0.006187991704791784,\n        -0.01488504372537136,\n        -0.0019690131302922964,\n        -0.00014788072439841926,\n        0.003415425308048725,\n        0.01422678492963314,\n        -0.006348082330077887,\n        0.004294952843338251,\n        -0.0137094771489501,\n        0.001034875400364399,\n        0.013869809918105602,\n        0.002926202956587076,\n        -0.008757790550589561,\n        -0.0009722207323648036,\n        -0.0190729983150959,\n        0.0024535595439374447,\n        0.0012940536253154278,\n        -0.0021669212728738785,\n        0.02083180658519268,\n        -0.006941305007785559,\n        -0.0009379085968248546,\n        0.028794042766094208,\n        -0.010265383869409561,\n        -0.0005420715315267444,\n        0.01795695535838604,\n        0.017364099621772766,\n        0.007664191070944071,\n        -0.008249497972428799,\n        -0.003707421710714698,\n        0.061074674129486084,\n        0.01711598038673401,\n        -0.01687528006732464,\n        -0.012870549224317074,\n        -0.02399769425392151,\n        0.0006761978729628026,\n        -0.00030671461718156934,\n        -0.09646031260490417,\n        -0.023278802633285522,\n        -0.0047495500184595585,\n        0.011790989898145199,\n        -0.18856768310070038,\n        0.004124174360185862,\n        0.010158592835068703,\n        0.00942336767911911,\n        -0.016543826088309288,\n        0.0221080482006073,\n        0.003320016199722886,\n        -0.015495057217776775,\n        -0.0023014976177364588,\n        -0.03539203479886055,\n        0.005722504574805498,\n        -0.032027412205934525,\n        -0.00014177327102515846,\n        0.003800577949732542,\n        0.01883377507328987,\n        -0.007105870172381401,\n        0.010673913173377514,\n        -0.0061312210746109486,\n        0.0008664530469104648,\n        -0.025442838668823242,\n        0.004842058755457401,\n        -0.02601492404937744,\n        0.03274323046207428,\n        -0.015122488141059875,\n        0.01888875477015972,\n        0.009127217344939709,\n        0.01536165364086628,\n        0.006691036745905876,\n        0.25407853722572327,\n        0.009428336285054684,\n        -0.002579713938757777,\n        0.022352850064635277,\n        -0.024481330066919327,\n        -0.004322129301726818,\n        0.006914897821843624,\n        -0.03490087762475014,\n        0.016378499567508698,\n        -0.008082750253379345,\n        0.005274488124996424,\n        -0.008843131363391876,\n        -0.004372385796159506,\n        -0.02657277137041092,\n        0.004904853645712137,\n        -0.030849507078528404,\n        0.0037701050750911236,\n        -0.0024298657663166523,\n        0.0053367349319159985,\n        -0.045713283121585846,\n        0.00016333254461642355,\n        0.031721215695142746,\n        0.004041912499815226,\n        0.00959846656769514,\n        0.0033744070678949356,\n        -0.009088192135095596,\n        -0.03410037234425545,\n        -0.02126564271748066,\n        0.03198036924004555,\n        0.005501669831573963,\n        -0.05952372029423714,\n        0.006202475633472204,\n        -0.0031345104798674583,\n        -0.0273741502314806,\n        -0.0038737875875085592,\n        0.007444665767252445,\n        0.003512820228934288,\n        -0.002196655375882983,\n        -0.005579507909715176,\n        -0.020858628675341606,\n        -0.006384318694472313,\n        -0.004771856125444174,\n        0.018028102815151215,\n        -0.02085813134908676,\n        0.0024252901785075665,\n        0.004374645184725523,\n        -0.0009755136561580002,\n        -0.000516252126544714,\n        0.013341065496206284,\n        0.0024231208954006433,\n        0.006182785611599684,\n        -0.009785993956029415,\n        0.005206659901887178,\n        -0.020291635766625404,\n        0.01548200286924839,\n        0.014980022795498371,\n        0.008872032165527344,\n        0.011932175606489182,\n        -0.005690422840416431,\n        0.01775158941745758,\n        0.0008468261221423745,\n        -0.018216196447610855,\n        -0.0024980229791253805,\n        -0.007920539937913418,\n        0.0182171743363142,\n        0.02187010832130909,\n        -0.0072097876109182835,\n        -0.010041650384664536,\n        -0.016395995393395424,\n        0.011125228367745876,\n        0.006889717653393745,\n        0.006138180382549763,\n        -0.14322003722190857,\n        0.01462645549327135,\n        0.011836049146950245,\n        -0.004808417055755854,\n        0.007291429676115513,\n        -0.008980964310467243,\n        0.008080030791461468,\n        -0.008504046127200127,\n        0.029654281213879585,\n        0.018520962446928024,\n        0.0029513754416257143,\n        0.014630693010985851,\n        0.013446887023746967,\n        -0.021800413727760315,\n        0.004141977056860924,\n        0.00257085170596838,\n        0.0406280942261219,\n        0.014863087795674801,\n        -0.022315191105008125,\n        -0.021671531721949577,\n        0.010726152919232845,\n        0.011167292483150959,\n        -0.010693368501961231,\n        -0.006800828035920858,\n        -0.0020422234665602446,\n        -0.0022193712648004293,\n        -0.02113325148820877,\n        -0.0005036143120378256,\n        0.002921775449067354,\n        0.02823103964328766,\n        -0.0007286420441232622,\n        -0.011020482517778873,\n        -0.011077110655605793,\n        -0.007092249114066362,\n        -0.012252910062670708,\n        -0.01063743606209755,\n        0.016128284856677055,\n        0.018194258213043213,\n        -0.014682246372103691,\n        -0.010718107223510742,\n        -0.0009213841403834522,\n        -0.008084372617304325,\n        -0.004665510728955269,\n        -0.015584036707878113,\n        0.00421485910192132,\n        0.018309878185391426,\n        -0.015611466951668262,\n        -0.08869112282991409,\n        -0.004873471334576607,\n        -0.014783318154513836,\n        -0.010722058825194836,\n        -0.00570627162232995,\n        0.013618594966828823,\n        0.021373162046074867,\n        -0.004459973890334368,\n        0.001267715124413371,\n        -0.015258613042533398,\n        0.017688678577542305,\n        0.004090003669261932,\n        0.011045313440263271,\n        0.003848026040941477,\n        0.011027054861187935,\n        -0.027501937001943588,\n        0.0006369936745613813,\n        0.015816407278180122,\n        -0.004868984688073397,\n        -0.019200898706912994,\n        0.00559211103245616,\n        -0.0021571102552115917,\n        -0.05196228250861168,\n        -0.015921365469694138,\n        0.01219891756772995,\n        -0.019693523645401,\n        -0.020848898217082024,\n        -0.021029075607657433,\n        0.005670684855431318,\n        -0.007328446488827467,\n        0.004175282083451748,\n        0.34338831901550293,\n        -0.015268171206116676,\n        0.01901041902601719,\n        -0.0027801457326859236,\n        -0.014403686858713627,\n        0.0033961646258831024,\n        0.014419538900256157,\n        0.00042031900375150144,\n        0.05522884055972099,\n        0.007992373779416084,\n        -0.023764077574014664,\n        -0.02164766564965248,\n        0.007887511514127254,\n        0.0008350171847268939,\n        -0.017290007323026657,\n        0.02684425376355648,\n        0.0021827942691743374,\n        -0.01034014392644167,\n        0.0016845106147229671,\n        0.00850075762718916,\n        0.006136463489383459,\n        -0.011942736804485321,\n        0.011660267598927021,\n        -0.019217483699321747,\n        0.017220746725797653,\n        0.012838589958846569,\n        0.005767268594354391,\n        0.00036328835994936526,\n        -0.006326344329863787,\n        -0.018631145358085632,\n        -0.02094995602965355,\n        0.012211127206683159,\n        0.025819504633545876,\n        0.01049082912504673,\n        0.00025143363745883107,\n        -0.00823915097862482,\n        0.00934404507279396,\n        0.0010407945374026895,\n        0.008519642055034637,\n        0.02151450142264366,\n        0.018504444509744644,\n        -0.0030676773749291897,\n        0.05844160169363022,\n        0.0013531704898923635,\n        0.020518802106380463,\n        0.017287395894527435,\n        0.0005133055965416133,\n        -0.012470039539039135,\n        0.02124164253473282,\n        0.00272346381098032,\n        -0.0016545846592634916,\n        0.023522164672613144,\n        0.0075057679787278175,\n        -0.012690523639321327,\n        0.008895245380699635,\n        0.002820811700075865,\n        0.002316024387255311,\n        -0.0020950480829924345,\n        2.3939308448461816e-05,\n        0.010338949970901012,\n        0.003580415854230523,\n        -0.01314419973641634,\n        -0.007272879593074322,\n        -0.015251991339027882,\n        0.008559169247746468,\n        -0.0034654918126761913,\n        0.001627915888093412,\n        -0.018863258883357048,\n        -0.023351963609457016,\n        -0.006876007653772831,\n        -0.006745068822056055,\n        0.012902967631816864,\n        -0.024199403822422028,\n        0.01315145380795002,\n        0.01704074628651142,\n        0.008813329041004181,\n        -0.02857677824795246,\n        0.0017795704770833254,\n        -0.0046593546867370605,\n        -0.020205382257699966,\n        -0.007364429999142885,\n        -0.022506574168801308,\n        -0.004266205243766308,\n        -0.014368502423167229,\n        0.006077993661165237,\n        -0.007778868544846773,\n        -0.0338706448674202,\n        -0.020801424980163574,\n        -0.0032948791049420834,\n        0.0038966627325862646,\n        0.0013354028342291713,\n        -0.004057361278682947,\n        -0.01116037555038929,\n        0.0004979542572982609,\n        -0.0014924905262887478,\n        0.02228676900267601,\n        0.00030853820499032736,\n        0.0032361503690481186,\n        -0.007311032619327307,\n        0.0005657610017806292,\n        0.01570758782327175,\n        0.0065332623198628426,\n        -0.004962607752531767,\n        -0.00043092138366773725,\n        0.004675432574003935,\n        -0.0050036306492984295,\n        -0.01355694979429245,\n        0.012455311603844166,\n        -0.010332843288779259,\n        -0.006332680117338896,\n        0.01629943959414959,\n        0.00022889582032803446,\n        0.019646810367703438,\n        -0.00645048450678587,\n        0.00018199885380454361,\n        0.021935712546110153,\n        -0.000669611559715122,\n        -0.024545805528759956,\n        -0.43374237418174744,\n        0.01338146347552538,\n        -0.00577061390504241,\n        0.010791081003844738,\n        -0.030768774449825287,\n        -0.000248340074904263,\n        0.028682900592684746,\n        0.016294529661536217,\n        0.02170475758612156,\n        0.004017048515379429,\n        -0.019540751352906227,\n        -0.006580394227057695,\n        -0.13620400428771973,\n        0.01912953518331051,\n        -0.022863149642944336,\n        -0.0014566757017746568,\n        -0.018966596573591232,\n        -0.06582166254520416,\n        -0.010411419905722141,\n        0.03066517785191536,\n        -0.005918117240071297,\n        0.025835353881120682,\n        0.01267832238227129,\n        0.009197103790938854,\n        0.018832538276910782,\n        0.005453452467918396,\n        0.005494879558682442,\n        -0.003756850492209196,\n        0.006762545555830002,\n        -0.0054822345264256,\n        0.0004532787424977869,\n        -0.005451512522995472,\n        0.026262624189257622,\n        0.006062537431716919,\n        5.2028499339940026e-05,\n        -0.0081722941249609,\n        -0.0064022960141301155,\n        -0.0028097990434616804,\n        0.008897855877876282,\n        -0.01511690765619278,\n        -0.009734614752233028,\n        -0.0009863842278718948,\n        0.017546869814395905,\n        0.0075432173907756805,\n        -0.043936505913734436,\n        -0.009013839066028595,\n        -0.032600127160549164,\n        -0.14329268038272858,\n        0.00488486560061574,\n        -0.013245992362499237,\n        0.012149952352046967,\n        0.007384683471173048,\n        -0.011745926924049854,\n        -0.016930073499679565,\n        -0.020095206797122955,\n        -0.0014918777160346508,\n        0.0059597003273665905,\n        0.0061284457333385944,\n        0.01760634034872055,\n        -0.019487448036670685,\n        -0.01537919882684946,\n        -0.01407971978187561,\n        0.030047781765460968,\n        0.005343243945389986,\n        -0.019699424505233765,\n        0.003926097881048918,\n        -0.028690986335277557,\n        -0.009443176910281181,\n        -0.021185321733355522,\n        -0.016413919627666473,\n        -0.003658981528133154,\n        -0.013958023861050606,\n        -0.00257857795804739,\n        0.004975579679012299,\n        0.021740838885307312,\n        0.02140122465789318,\n        0.012838726863265038,\n        -0.011973136104643345,\n        0.004580433014780283,\n        -0.002931915456429124,\n        -0.03209826350212097,\n        -0.016737569123506546,\n        0.023438503965735435,\n        0.013478938490152359,\n        0.01442253403365612,\n        -0.0067999050952494144,\n        0.003133262973278761,\n        0.0004907906986773014,\n        -0.017385315150022507,\n        -0.0002390776644460857,\n        -0.0013594918418675661,\n        0.010029762051999569,\n        -6.668922651442699e-06,\n        -0.01538124494254589,\n        -0.000784639734774828,\n        0.002918561454862356,\n        -0.018107565119862556,\n        -0.002243755152449012,\n        -0.02875298261642456,\n        -0.002286843489855528,\n        -0.007222936954349279,\n        0.017300134524703026,\n        0.006860439665615559,\n        -0.031133407726883888,\n        -0.005813203752040863,\n        -0.017268402501940727,\n        0.17043600976467133,\n        0.010559913702309132,\n        -0.0057410565204918385,\n        0.0013125024270266294,\n        -0.012719777412712574,\n        -0.0012119015445932746,\n        0.00634392537176609,\n        0.0026553927455097437,\n        0.11043155193328857,\n        0.0013203280977904797,\n        -0.019190805032849312,\n        0.00838405080139637,\n        -0.00188065052498132,\n        0.002253645798191428,\n        -0.000574819277971983,\n        0.03280145674943924,\n        -0.002098045777529478,\n        0.011521426029503345,\n        -0.0121723972260952,\n        0.009705677628517151,\n        0.015630444511771202,\n        -0.007735606282949448,\n        0.00569238280877471,\n        -0.0037131605204194784,\n        0.007841743528842926,\n        -5.696633525076322e-05,\n        -0.01864611543715,\n        -0.003599918447434902,\n        0.01736084744334221,\n        -0.023667721077799797,\n        0.005330719519406557,\n        -0.010251360014081001,\n        -0.01295823510736227,\n        0.06270076334476471,\n        -0.009333936497569084,\n        0.011737006716430187,\n        0.013586423359811306,\n        -0.0033054028172045946,\n        -0.0005970350466668606,\n        -0.029645636677742004,\n        -0.012136433273553848,\n        -0.0026931853499263525,\n        -0.03559974208474159,\n        0.032441310584545135,\n        -0.0003459737345110625,\n        0.00295159756205976,\n        -0.004855248611420393,\n        -0.009727121330797672,\n        0.0031688339076936245,\n        -0.007183929439634085,\n        -0.012171517126262188,\n        -0.027038224041461945,\n        -0.009694920852780342,\n        0.00845372211188078,\n        0.0038547960575670004,\n        -0.01620481163263321,\n        -0.0452495738863945,\n        -0.018863722681999207,\n        0.010479321703314781,\n        -0.013060204684734344,\n        0.004159659147262573,\n        -0.00302547006867826,\n        -0.0029191672801971436,\n        -0.0022642319090664387,\n        -0.007219057064503431,\n        0.0019106592517346144,\n        0.008937021717429161,\n        -0.025046739727258682,\n        -0.005377864930778742,\n        -0.015469738282263279,\n        0.003018368501216173,\n        0.010102585889399052,\n        -0.14894463121891022,\n        0.0014075853396207094,\n        0.00414086552336812,\n        -0.02763873152434826,\n        -0.013417866080999374,\n        -0.019957050681114197,\n        0.012801596894860268,\n        0.00011234940029680729,\n        0.008322950452566147,\n        0.012228051200509071,\n        -0.0014867965364828706,\n        0.12239447981119156,\n        -0.0001346774079138413,\n        -0.010775008238852024,\n        -0.016029132530093193,\n        -0.005007494240999222,\n        0.014944982714951038,\n        -5.520668128156103e-05,\n        0.002162717515602708,\n        -0.02308199182152748,\n        -0.011082983575761318,\n        0.1109391376376152,\n        0.0034826139453798532,\n        0.02676858939230442,\n        0.0037683569826185703,\n        -0.013597832061350346,\n        4.714470196631737e-05,\n        0.009496408514678478,\n        -0.0024041917640715837,\n        0.007655952125787735,\n        -0.012766871601343155,\n        0.0074783796444535255,\n        0.01734108291566372\n      ],\n      \"label\": \"HIGH\",\n      \"text\": \"You are a professional Python developer and data analyst.\\n\\nWrite code that:\\n- reads all files with txt extension from the current working directory (these are books);\\n- for each book, display a word cloud in a neat grid;\\n- find the two most similar books as accurately as possible and display the result;\\n- implement word preprocessing to solve these problems as correctly as possible.\\n\\nThe code should be as efficient and concise as possible. \\n\\nThen check your code for errors and correct them if necessary.\"\n    }\n  ],\n  \"LOW\": [\n    {\n      \"embedding\": [\n        0.02648692950606346,\n        -0.0010638373205438256,\n        -0.00966667104512453,\n        -0.015978127717971802,\n        -0.016848718747496605,\n        -0.005478681065142155,\n        0.02602456323802471,\n        -0.004564971663057804,\n        0.0026320936158299446,\n        -0.06774858385324478,\n        -0.020062243565917015,\n        0.004483099561184645,\n        -0.005507764406502247,\n        -0.0027423356659710407,\n        -0.031711164861917496,\n        -0.0003225226828362793,\n        0.013415533117949963,\n        0.006500308867543936,\n        -0.009467401541769505,\n        -0.006793952081352472,\n        0.007607476785778999,\n        -0.01582661271095276,\n        0.03505789488554001,\n        -0.012171013280749321,\n        0.014605906791985035,\n        -0.0007661767886020243,\n        0.009142270311713219,\n        0.018322812393307686,\n        -0.007396745029836893,\n        0.030195806175470352,\n        -0.005181359592825174,\n        0.013311449438333511,\n        -0.003702969755977392,\n        0.008781330659985542,\n        -0.02069043554365635,\n        0.011103599332273006,\n        -0.004842399153858423,\n        -0.021637653931975365,\n        -0.013303224928677082,\n        -0.00849148165434599,\n        -0.032390862703323364,\n        0.008119107224047184,\n        0.03958234563469887,\n        -0.005362665746361017,\n        -0.007671533618122339,\n        -0.027245983481407166,\n        0.006924952380359173,\n        0.011453205719590187,\n        -0.008300160057842731,\n        0.01092689298093319,\n        -0.005355318542569876,\n        0.005111088976264,\n        -0.010500247590243816,\n        -0.004616944119334221,\n        0.013849443756043911,\n        0.012217780575156212,\n        -0.00950991827994585,\n        0.008110519498586655,\n        -0.0370415560901165,\n        0.020336663350462914,\n        0.0033985988702625036,\n        0.007351227104663849,\n        0.025580883026123047,\n        0.003419361775740981,\n        0.00042747255065478384,\n        0.005267771426588297,\n        0.015063083730638027,\n        0.009353572502732277,\n        -0.012787213549017906,\n        -0.010097956284880638,\n        -0.000312722782837227,\n        0.009685264900326729,\n        0.020078949630260468,\n        0.064177006483078,\n        0.011940333992242813,\n        -0.0186280719935894,\n        0.03200729191303253,\n        0.003279050113633275,\n        0.0003346922167111188,\n        -0.0008632199605926871,\n        0.0010783403413370252,\n        0.009041228331625462,\n        -0.01402457244694233,\n        -0.012163441628217697,\n        -0.0021612367127090693,\n        -0.008296950720250607,\n        0.005865972489118576,\n        -0.00555646326392889,\n        -0.010756080970168114,\n        0.013754721730947495,\n        0.010399982333183289,\n        -0.0074177877977490425,\n        -0.022160887718200684,\n        -0.006561923772096634,\n        0.0017301772022619843,\n        0.011290942318737507,\n        0.0009011207148432732,\n        0.007678607013076544,\n        0.40399327874183655,\n        -0.010526868514716625,\n        -0.018919562920928,\n        0.0058018965646624565,\n        0.004681854508817196,\n        -0.011881214566528797,\n        0.02340475656092167,\n        -0.022009531036019325,\n        -0.0052573662251234055,\n        -0.02983538992702961,\n        0.004864939488470554,\n        0.035979390144348145,\n        0.02242652326822281,\n        -0.003396253567188978,\n        0.009703291580080986,\n        -0.002057850593701005,\n        -0.013100175186991692,\n        -0.0255390927195549,\n        0.004965644329786301,\n        0.0037817133124917746,\n        0.009765512309968472,\n        -0.015155195258557796,\n        0.0020052092149853706,\n        -0.007180690765380859,\n        0.06315312534570694,\n        0.011677653528749943,\n        -0.0068587022833526134,\n        -0.003219736274331808,\n        -0.011157874949276447,\n        -0.013510637916624546,\n        0.01192237064242363,\n        -0.01439741998910904,\n        -0.037443432956933975,\n        -0.010088125243782997,\n        0.006163768470287323,\n        -0.0046418337151408195,\n        0.020428339019417763,\n        0.0019332411466166377,\n        8.292770507978275e-05,\n        -0.0036378256045281887,\n        -0.0646146759390831,\n        0.013183601200580597,\n        0.0125442398712039,\n        -0.007054343353956938,\n        0.009888279251754284,\n        -0.00996995996683836,\n        -0.029840731993317604,\n        0.1787915676832199,\n        -0.00484544038772583,\n        0.0038758658338338137,\n        -0.006425702944397926,\n        -0.0017774907173588872,\n        0.011145040392875671,\n        -0.01463156845420599,\n        -0.016178902238607407,\n        0.005684999283403158,\n        -0.013758555054664612,\n        -0.009350068867206573,\n        0.00522832153365016,\n        0.021493004634976387,\n        0.002959159668534994,\n        0.004240917973220348,\n        -0.06802946329116821,\n        -0.00282049342058599,\n        -0.011256573721766472,\n        0.017404576763510704,\n        0.01363187376409769,\n        -0.017677219584584236,\n        0.009715517051517963,\n        -0.04402657225728035,\n        0.011030914261937141,\n        0.028527360409498215,\n        -9.400691487826407e-05,\n        0.007471646647900343,\n        -0.1541728675365448,\n        0.02512730285525322,\n        0.0066401478834450245,\n        0.004227254539728165,\n        0.007586977444589138,\n        0.005316510330885649,\n        -0.005501927807927132,\n        -0.016430437564849854,\n        -0.01061745174229145,\n        0.02185169793665409,\n        0.007286281790584326,\n        0.013447676785290241,\n        -0.02421731874346733,\n        0.0015954483533278108,\n        0.01080283708870411,\n        -0.003274212358519435,\n        -0.0016661944100633264,\n        0.008023559115827084,\n        -0.0005942443385720253,\n        -0.028553146868944168,\n        -0.009313525632023811,\n        0.008133558556437492,\n        0.005800743121653795,\n        0.008715560659766197,\n        0.008559156209230423,\n        -0.01225875224918127,\n        -0.0031907418742775917,\n        0.014591004699468613,\n        -0.010461815632879734,\n        -0.00706614600494504,\n        -0.015668081119656563,\n        0.010430246591567993,\n        0.020546115934848785,\n        0.007455567829310894,\n        -0.002578375395387411,\n        0.015034027397632599,\n        0.012316563166677952,\n        -0.007656467147171497,\n        -0.010772868990898132,\n        0.005369006656110287,\n        0.0009824015432968736,\n        0.026535868644714355,\n        0.03146809712052345,\n        -0.019144870340824127,\n        -0.004156183917075396,\n        0.0034678340889513493,\n        0.011584277264773846,\n        0.008679580874741077,\n        -0.015499337576329708,\n        0.010517656803131104,\n        -0.017550017684698105,\n        -0.008670358918607235,\n        -0.004048115573823452,\n        -0.008749379776418209,\n        0.01078763511031866,\n        0.009637376293540001,\n        -0.005857239942997694,\n        -0.026764115318655968,\n        0.017847776412963867,\n        0.005177693907171488,\n        0.0018616040470078588,\n        -0.015332224778831005,\n        -0.0010512851877138019,\n        0.0010236718226224184,\n        -0.005028387065976858,\n        0.010649989359080791,\n        -0.002629463793709874,\n        0.009117787703871727,\n        0.003507171291857958,\n        -0.010476665571331978,\n        0.029563773423433304,\n        0.002962385304272175,\n        -0.001335594104602933,\n        0.002338978461921215,\n        0.018160106614232063,\n        0.01658673956990242,\n        -0.000563681882340461,\n        0.004422742873430252,\n        0.04626549407839775,\n        0.007048256695270538,\n        -0.021013379096984863,\n        -0.016322413459420204,\n        -0.0283083226531744,\n        -0.003921112045645714,\n        -0.004189644940197468,\n        -0.08835331350564957,\n        -0.018877532333135605,\n        -0.018564460799098015,\n        0.013213000260293484,\n        -0.18696953356266022,\n        0.0008008169825188816,\n        0.012718426063656807,\n        -0.004875142127275467,\n        0.0019255882361903787,\n        0.02116173505783081,\n        0.004054129123687744,\n        -0.02749122865498066,\n        0.010074569843709469,\n        -0.027576779946684837,\n        -0.002556807594373822,\n        -0.047729454934597015,\n        0.016888609156012535,\n        -0.009909231215715408,\n        0.00685331504791975,\n        -0.008361516520380974,\n        0.0020681298337876797,\n        -0.006544170435518026,\n        -0.02349439635872841,\n        -0.008458804339170456,\n        0.011924855411052704,\n        -0.015924423933029175,\n        0.021595489233732224,\n        -0.01856638491153717,\n        0.023423250764608383,\n        0.01710100844502449,\n        0.012223309837281704,\n        0.0038690725341439247,\n        0.25153857469558716,\n        0.01425024401396513,\n        -0.01560975331813097,\n        0.013949727639555931,\n        -0.017905505374073982,\n        0.006097552366554737,\n        -0.003693145699799061,\n        -0.038226306438446045,\n        -0.005997160449624062,\n        0.005752570927143097,\n        0.012112759985029697,\n        -0.014703492633998394,\n        0.004608269780874252,\n        -0.03448338061571121,\n        1.56095720740268e-05,\n        -0.02012091875076294,\n        -0.0013729388592764735,\n        0.006293566897511482,\n        0.014014686457812786,\n        -0.03224799782037735,\n        -0.003865425009280443,\n        0.008275904692709446,\n        0.001942778704687953,\n        -0.0014719004975631833,\n        -0.001025260309688747,\n        -0.006602119188755751,\n        -0.01967724971473217,\n        -0.019924312829971313,\n        0.030537763610482216,\n        -0.0035920641385018826,\n        -0.056094586849212646,\n        0.015614320524036884,\n        0.0019490866689011455,\n        -0.02680610492825508,\n        -0.0010966366389766335,\n        0.0007973007741384208,\n        -0.00430771429091692,\n        -0.00956656038761139,\n        -0.01659512333571911,\n        -0.013637138530611992,\n        0.00025362512678839266,\n        0.0011014805641025305,\n        -0.0021656269673258066,\n        -0.02856859192252159,\n        -0.023499760776758194,\n        -0.007165139075368643,\n        -0.0074304998852312565,\n        -0.010347429662942886,\n        0.01806681416928768,\n        -0.005998949985951185,\n        0.012282196432352066,\n        -0.017697649076581,\n        0.0012964933412149549,\n        -0.00517914118245244,\n        0.004822453949600458,\n        0.014662757515907288,\n        0.0011572387302294374,\n        0.02139858528971672,\n        -0.007835756056010723,\n        -0.000455637724371627,\n        0.007866374216973782,\n        0.001975576626136899,\n        0.006471599917858839,\n        -0.010390657931566238,\n        0.012477424927055836,\n        -0.0010353118414059281,\n        0.000240853798459284,\n        -0.006748814135789871,\n        -0.02087724395096302,\n        0.00602846359834075,\n        0.0032565081492066383,\n        0.005786011461168528,\n        -0.12319587171077728,\n        0.009255556389689445,\n        0.008356289938092232,\n        -0.01456880010664463,\n        0.0001981560344574973,\n        -0.005605911370366812,\n        0.000757264147978276,\n        -0.004141754005104303,\n        0.03266522288322449,\n        0.019943533465266228,\n        -0.004711426328867674,\n        0.02423413097858429,\n        -0.0011441257083788514,\n        -0.02481885440647602,\n        0.010123777203261852,\n        -0.001678692759014666,\n        0.03914084658026695,\n        0.012971777468919754,\n        -0.036012545228004456,\n        -0.02915124222636223,\n        -0.00030037848046049476,\n        0.020644625648856163,\n        -0.010027576237916946,\n        -0.0003234374162275344,\n        0.009453446604311466,\n        0.0006899556028656662,\n        -0.019941236823797226,\n        -0.00035817723255604506,\n        -0.001357944100163877,\n        0.020459027960896492,\n        -0.0009636615286581218,\n        -0.0009063866455107927,\n        -0.009894521906971931,\n        -0.00711774779483676,\n        -0.000709362153429538,\n        -0.009009911678731441,\n        0.009437737986445427,\n        0.015508429147303104,\n        -0.02281365916132927,\n        -0.006385305896401405,\n        -0.00255284970626235,\n        -0.00730440579354763,\n        0.009564134292304516,\n        -0.020660031586885452,\n        -0.010118819773197174,\n        0.0002733968722168356,\n        -0.008921656757593155,\n        -0.0930313989520073,\n        -0.0041264682076871395,\n        -0.006358380429446697,\n        -0.015760798007249832,\n        -0.01011276338249445,\n        0.02019052952528,\n        0.005443222355097532,\n        0.00172749615740031,\n        -0.0003481145540717989,\n        0.0024300862569361925,\n        0.02077866718173027,\n        0.01975454017519951,\n        0.0201877411454916,\n        -0.006361454725265503,\n        -0.010440407320857048,\n        -0.021219924092292786,\n        -0.006338976323604584,\n        0.011133282445371151,\n        0.00391391571611166,\n        -0.01235242560505867,\n        0.0005850508459843695,\n        0.01282112393528223,\n        -0.039286866784095764,\n        -0.009895979426801205,\n        -0.0002251197147415951,\n        -0.025495871901512146,\n        -0.019579702988266945,\n        -0.011444016359746456,\n        0.0070399451069533825,\n        -0.008998887613415718,\n        0.0012809641193598509,\n        0.3310178220272064,\n        -0.011415569111704826,\n        0.007398885674774647,\n        0.0012009298661723733,\n        -0.02013387158513069,\n        -0.0035620923154056072,\n        0.013220477849245071,\n        0.0030922323931008577,\n        0.04894772171974182,\n        0.00489255553111434,\n        -0.011334857903420925,\n        -0.017854489386081696,\n        0.000995898386463523,\n        0.01119412761181593,\n        -0.03001922182738781,\n        0.0303393192589283,\n        -0.0001482521474827081,\n        -0.012248950079083443,\n        -0.0031790195498615503,\n        -0.01940462738275528,\n        0.003734447294846177,\n        -0.001311023603193462,\n        0.009394815191626549,\n        -0.01314456108957529,\n        0.01199437864124775,\n        0.01419768575578928,\n        0.006155736278742552,\n        -0.010529907420277596,\n        -0.005271160509437323,\n        -0.014967740513384342,\n        -0.021313196048140526,\n        0.006682718172669411,\n        0.012089090421795845,\n        0.01800752989947796,\n        0.004276799038052559,\n        -0.0036748142447322607,\n        -0.0004618914390448481,\n        0.006801265757530928,\n        0.013047710992395878,\n        0.0074809398502111435,\n        0.022890977561473846,\n        0.017181959003210068,\n        0.06935574859380722,\n        0.009835758246481419,\n        0.02105250023305416,\n        0.01530985813587904,\n        0.0003277950163464993,\n        -0.011917180381715298,\n        0.022824319079518318,\n        0.013644360937178135,\n        -0.01079779677093029,\n        0.011278265155851841,\n        0.01432811189442873,\n        -0.007908171974122524,\n        0.006777359172701836,\n        0.0065452540293335915,\n        0.0076530068181455135,\n        -0.015562284737825394,\n        -0.018619494512677193,\n        -0.00347917596809566,\n        -0.004143567755818367,\n        0.003263407154008746,\n        -0.006329386495053768,\n        -0.0037599559873342514,\n        0.010309210047125816,\n        -0.016583751887083054,\n        0.013898761011660099,\n        -0.00991764385253191,\n        -0.01490193884819746,\n        -0.009386496618390083,\n        -0.0077040065079927444,\n        0.0018473997479304671,\n        -0.038159411400556564,\n        0.011240815743803978,\n        0.019094038754701614,\n        0.0018548418302088976,\n        -0.020892808213829994,\n        0.0006988616078160703,\n        -0.0010410300455987453,\n        -0.011714618653059006,\n        -0.014082055538892746,\n        -0.009759954176843166,\n        -0.0025671934708952904,\n        -0.013441110961139202,\n        -0.002114095725119114,\n        -0.0010249183978885412,\n        -0.02532045915722847,\n        -0.02833198942244053,\n        -0.0015964796766638756,\n        0.02106938324868679,\n        0.0004778731381520629,\n        -0.013818908482789993,\n        -0.007195652462542057,\n        -0.003875055117532611,\n        -0.003256350290030241,\n        0.01563858799636364,\n        -0.0077557493932545185,\n        -0.009104190394282341,\n        -0.005537999793887138,\n        -0.001257602940313518,\n        0.01677558943629265,\n        0.009844125248491764,\n        0.014884077943861485,\n        0.013844498433172703,\n        0.0020229811780154705,\n        -0.017616398632526398,\n        -0.011545808985829353,\n        0.008806911297142506,\n        -0.007389587815850973,\n        0.005872606299817562,\n        0.01231707539409399,\n        0.008231764659285545,\n        0.01578897424042225,\n        -0.014784056693315506,\n        -0.006139501929283142,\n        0.003178101498633623,\n        -0.004252019338309765,\n        -0.02069447748363018,\n        -0.4837748110294342,\n        0.019359592348337173,\n        -0.00013085079262964427,\n        0.013903157785534859,\n        -0.015258572064340115,\n        -0.014417012222111225,\n        0.02525290474295616,\n        0.005657861940562725,\n        0.019996512681245804,\n        0.006101900711655617,\n        -0.018810568377375603,\n        -0.017835218459367752,\n        -0.1294863373041153,\n        0.017561085522174835,\n        -0.004019861109554768,\n        -0.0010649441974237561,\n        -0.005831817165017128,\n        -0.04814719408750534,\n        -0.0017663772450760007,\n        0.027296587824821472,\n        -0.012025395408272743,\n        0.01597209833562374,\n        0.01650199107825756,\n        0.019480859860777855,\n        0.013740027323365211,\n        0.0069020832888782024,\n        -0.000420022668549791,\n        0.0019044516375288367,\n        0.007281788159161806,\n        -0.005062589887529612,\n        0.004685157909989357,\n        0.0007004926446825266,\n        0.03190071880817413,\n        -0.004190766718238592,\n        -0.0010785863269120455,\n        -0.022166011855006218,\n        0.003819011151790619,\n        -0.0087962057441473,\n        0.005445427261292934,\n        -0.023817384615540504,\n        -0.0024219071492552757,\n        0.002807517070323229,\n        0.008803675882518291,\n        0.01592147722840309,\n        -0.028404762968420982,\n        -0.0161146093159914,\n        -0.03133992850780487,\n        -0.1438850313425064,\n        0.008015214465558529,\n        -0.0034654936753213406,\n        0.021860826760530472,\n        0.0022170173469930887,\n        -0.0016491302521899343,\n        0.0021406325977295637,\n        -0.016407528892159462,\n        0.007911205291748047,\n        -0.00454374123364687,\n        -0.0007895366870798171,\n        0.010977448895573616,\n        -0.015750406309962273,\n        -0.013051670044660568,\n        -0.008517156355082989,\n        0.03055124171078205,\n        0.0014462892431765795,\n        -0.013292266987264156,\n        0.011511055752635002,\n        -0.03168928250670433,\n        -0.0037915429566055536,\n        -0.010839488357305527,\n        -0.020352251827716827,\n        -0.010228216648101807,\n        -0.012760848738253117,\n        -0.01500114519149065,\n        0.013992059975862503,\n        0.01643480733036995,\n        0.017708376049995422,\n        -0.005454416386783123,\n        0.005314801819622517,\n        -0.012220044620335102,\n        -0.006354143377393484,\n        -0.02290654368698597,\n        -0.01072593405842781,\n        0.035393670201301575,\n        0.02039686031639576,\n        0.006478374358266592,\n        -0.007442444562911987,\n        -0.006480060517787933,\n        0.017065050080418587,\n        0.004307271912693977,\n        -0.005730858072638512,\n        -0.004871695768088102,\n        0.007507386617362499,\n        0.012502789497375488,\n        -0.005943354219198227,\n        -0.014626498334109783,\n        0.011981870979070663,\n        -0.008450535126030445,\n        0.015424052253365517,\n        -0.027048394083976746,\n        -0.00024109345395117998,\n        0.0013592022005468607,\n        -0.00521558802574873,\n        0.006269016768783331,\n        -0.023016078397631645,\n        -0.00137544353492558,\n        0.005530813243240118,\n        0.166301429271698,\n        0.004818623885512352,\n        -0.010003489442169666,\n        -0.012629002332687378,\n        0.006917253136634827,\n        0.016056565567851067,\n        -0.004595241043716669,\n        0.012932314537465572,\n        0.10053791850805283,\n        0.00253744306974113,\n        -0.0032212468795478344,\n        0.006310283672064543,\n        -0.005923011805862188,\n        0.0012428699992597103,\n        -0.008916383609175682,\n        0.02168346755206585,\n        -0.005890219938009977,\n        0.015413717366755009,\n        -0.00747372442856431,\n        0.004012625198811293,\n        0.013833754695951939,\n        -0.018237894400954247,\n        0.024452295154333115,\n        -0.00348577369004488,\n        0.0013432629639282823,\n        0.002518411260098219,\n        -0.009025482460856438,\n        -0.018824947997927666,\n        0.011762677691876888,\n        -0.024716807529330254,\n        0.006669866386801004,\n        0.01693210005760193,\n        -0.008452216163277626,\n        0.06391468644142151,\n        -0.010969407856464386,\n        0.007021497935056686,\n        0.02875210903584957,\n        -0.00854189321398735,\n        -0.004279664717614651,\n        -0.023278208449482918,\n        -0.008208910934627056,\n        -0.0058607785031199455,\n        -0.03460341691970825,\n        0.032275598496198654,\n        -0.00768157048150897,\n        -0.009864416904747486,\n        -0.002991802291944623,\n        -0.022353217005729675,\n        0.0008815918117761612,\n        -0.004788372665643692,\n        -0.0020683074835687876,\n        -0.012020853348076344,\n        -0.012337028980255127,\n        0.01541225891560316,\n        -0.0021212701685726643,\n        0.004762399476021528,\n        -0.047722455114126205,\n        -0.003967319615185261,\n        0.010626045055687428,\n        -0.0024648949038237333,\n        0.009607088752090931,\n        0.006510217674076557,\n        -0.006576524116098881,\n        0.002875301521271467,\n        0.003233133116737008,\n        -0.0026623508892953396,\n        0.012839315459132195,\n        -0.007313758600503206,\n        -0.011316402815282345,\n        -0.014108750969171524,\n        -0.003146000672131777,\n        0.01485332753509283,\n        -0.1441049724817276,\n        -0.007699332665652037,\n        0.002234335755929351,\n        -0.03039935603737831,\n        -0.018039317801594734,\n        -0.009275116957724094,\n        0.025842666625976562,\n        0.008286857977509499,\n        0.002292077522724867,\n        0.016028819605708122,\n        -0.005565776955336332,\n        0.11462263017892838,\n        -0.010934887453913689,\n        -0.007003468461334705,\n        -0.00682443892583251,\n        -0.004457773175090551,\n        0.009448588825762272,\n        0.015671467408537865,\n        -0.0034878673031926155,\n        -0.02822897955775261,\n        -0.0072744484059512615,\n        0.1062626987695694,\n        0.005662010051310062,\n        0.018248416483402252,\n        0.01897069811820984,\n        -0.015205473639070988,\n        -0.003496551187708974,\n        0.012231655418872833,\n        0.010195254348218441,\n        0.000998149742372334,\n        -0.008571318350732327,\n        0.012968906201422215,\n        0.0065460409969091415\n      ],\n      \"label\": \"LOW\",\n      \"text\": \"What are some of things to do while visiting Russia\"\n    },\n    {\n      \"embedding\": [\n        0.041831932961940765,\n        0.008752463385462761,\n        0.00497175520285964,\n        -0.015397604554891586,\n        -0.025626156479120255,\n        -0.007073021959513426,\n        0.004347975365817547,\n        -0.006157573778182268,\n        0.0024053105153143406,\n        -0.08473299443721771,\n        -0.021923182532191277,\n        0.015420331619679928,\n        0.00011088590690633282,\n        -0.005486877169460058,\n        -0.036344341933727264,\n        0.010353075340390205,\n        0.017087232321500778,\n        0.014490442350506783,\n        -0.011488673277199268,\n        -0.02359095588326454,\n        0.011317466385662556,\n        -0.006451296620070934,\n        0.04914584383368492,\n        -0.01272901427000761,\n        0.014770965091884136,\n        -0.004977813456207514,\n        0.019719399511814117,\n        0.004007676616311073,\n        -0.011118785478174686,\n        0.021227210760116577,\n        0.010757104493677616,\n        0.010657308623194695,\n        0.0160016231238842,\n        0.0008743451908230782,\n        -0.02212778851389885,\n        0.005995017942041159,\n        -0.0075341095216572285,\n        -0.009616411291062832,\n        -0.010223700664937496,\n        -0.011341311037540436,\n        -0.038221582770347595,\n        0.006499378010630608,\n        0.0495503768324852,\n        -0.014469250105321407,\n        0.0038592005148530006,\n        -0.023308737203478813,\n        -0.0018352156039327383,\n        0.00855918787419796,\n        0.004099074751138687,\n        0.015004444867372513,\n        -0.002408037194982171,\n        -0.009114026091992855,\n        -0.003405480645596981,\n        0.004218422342091799,\n        0.0017273675184696913,\n        0.002290683798491955,\n        -0.012634547427296638,\n        0.006550460122525692,\n        -0.019593363627791405,\n        0.01139887422323227,\n        -0.003596343332901597,\n        -0.004494686145335436,\n        0.030401738360524178,\n        -0.003477397607639432,\n        -0.014634584076702595,\n        -0.0035479748621582985,\n        0.007376015651971102,\n        0.007587176747620106,\n        -0.020112546160817146,\n        -0.004040680825710297,\n        -0.0028246529400348663,\n        0.0021481127478182316,\n        0.019890381023287773,\n        0.061672139912843704,\n        0.027077289298176765,\n        -0.010985326953232288,\n        0.0326397605240345,\n        -0.0018533158581703901,\n        0.006439903751015663,\n        -0.0019352285889908671,\n        0.025268584489822388,\n        0.016599141061306,\n        -0.017273303121328354,\n        -0.010875550098717213,\n        -0.01331600546836853,\n        -0.0070069595240056515,\n        0.017504725605249405,\n        -0.01160179078578949,\n        0.0034942941274493933,\n        0.029334137216210365,\n        0.009591973386704922,\n        -0.014087007381021976,\n        0.0024428623728454113,\n        -0.011702325195074081,\n        -0.00133498664945364,\n        0.009772151708602905,\n        -0.006010017357766628,\n        0.002496827393770218,\n        0.40790432691574097,\n        -0.009153859689831734,\n        -0.004650587681680918,\n        0.01519718486815691,\n        0.0067838262766599655,\n        -0.008757361210882664,\n        0.027102097868919373,\n        -0.02487340196967125,\n        0.0009874413954094052,\n        -0.015427353791892529,\n        0.009468418546020985,\n        0.024809347465634346,\n        0.03522081300616264,\n        -0.01234756875783205,\n        0.007704578340053558,\n        -0.014410869218409061,\n        0.0033635280560702085,\n        -0.013631430454552174,\n        0.011109557934105396,\n        0.01166551187634468,\n        0.010982409119606018,\n        -0.005889013409614563,\n        0.006137240212410688,\n        0.004187863320112228,\n        0.055280901491642,\n        0.0026864672545343637,\n        0.0015079197473824024,\n        -0.020407335832715034,\n        0.001652647857554257,\n        -0.008198194205760956,\n        0.021441100165247917,\n        -0.005695774685591459,\n        -0.040886279195547104,\n        -0.005609477404505014,\n        -0.01649896427989006,\n        -0.008563010022044182,\n        0.009369845502078533,\n        0.01110029499977827,\n        -0.015989845618605614,\n        -0.002088087610900402,\n        -0.046714507043361664,\n        0.024554891511797905,\n        0.010336753912270069,\n        -0.03207063674926758,\n        -0.004464718978852034,\n        -0.029698243364691734,\n        -0.014550234191119671,\n        0.18526388704776764,\n        -0.010259960778057575,\n        -0.009675118140876293,\n        -0.007385817356407642,\n        0.0036276672035455704,\n        0.0008782718796283007,\n        -0.03129341080784798,\n        -0.01407720148563385,\n        0.016715385019779205,\n        -0.01305553037673235,\n        -0.015778901055455208,\n        0.016593797132372856,\n        -0.0054610916413366795,\n        -0.0071868496015667915,\n        -0.0010616861982271075,\n        -0.050719305872917175,\n        0.009559599682688713,\n        -0.004062649793922901,\n        0.02828891947865486,\n        -0.004930687602609396,\n        -0.003981216344982386,\n        0.0008106293971650302,\n        -0.041326552629470825,\n        -0.003145799273625016,\n        0.027285130694508553,\n        0.01202449668198824,\n        -0.009628438390791416,\n        -0.14601661264896393,\n        0.011500069871544838,\n        0.023291945457458496,\n        0.004827221855521202,\n        0.001869936240836978,\n        -0.012762892991304398,\n        -0.011759904213249683,\n        -0.007269740104675293,\n        -0.019045429304242134,\n        0.002644997788593173,\n        0.009332867339253426,\n        -0.0017900575185194612,\n        -0.022875018417835236,\n        -0.0008226691279560328,\n        0.0099067697301507,\n        -0.015022209845483303,\n        0.00798722356557846,\n        0.013082695193588734,\n        0.0018975446000695229,\n        -0.010728222317993641,\n        0.003791538765653968,\n        0.005203631240874529,\n        -0.0027515485417097807,\n        -0.0025611002929508686,\n        0.015342905186116695,\n        -0.01455965731292963,\n        0.0006621197680942714,\n        -0.00378085533156991,\n        -0.0038295118138194084,\n        0.000611315481364727,\n        -0.0009179473854601383,\n        0.01017073169350624,\n        0.014656643383204937,\n        0.0009311169851571321,\n        -0.005791370291262865,\n        0.007283123210072517,\n        0.017539558932185173,\n        -0.00016981888620648533,\n        -0.007388822268694639,\n        -0.009541916660964489,\n        0.002708796877413988,\n        0.025873983278870583,\n        0.02988281287252903,\n        -0.014090750366449356,\n        -0.003982766065746546,\n        0.012788722291588783,\n        0.0032858955673873425,\n        -0.013846623711287975,\n        -0.012934839352965355,\n        0.005589806474745274,\n        -0.0061235190369188786,\n        0.003938968759030104,\n        -0.005390996113419533,\n        0.009493268094956875,\n        0.018297500908374786,\n        -0.004126761574298143,\n        0.005722854286432266,\n        -0.01860734447836876,\n        0.016833148896694183,\n        0.004293753299862146,\n        0.011829741299152374,\n        -0.012279857881367207,\n        -0.007383431773632765,\n        -0.01603633351624012,\n        0.004705906379967928,\n        0.012412979267537594,\n        0.000672517460770905,\n        0.010024464689195156,\n        0.000495492946356535,\n        -0.0009564234642311931,\n        0.027363942936062813,\n        -0.0077703180722892284,\n        -0.0009229149436578155,\n        0.02458411455154419,\n        0.017622176557779312,\n        0.00974806398153305,\n        -0.01183454692363739,\n        -0.0074685318395495415,\n        0.05521372705698013,\n        0.01487326342612505,\n        -0.01096869446337223,\n        -0.01689911261200905,\n        -0.028432322666049004,\n        0.0022006535436958075,\n        0.0011869240552186966,\n        -0.08964405953884125,\n        -0.03212996572256088,\n        0.0026776136364787817,\n        0.027444597333669662,\n        -0.17663456499576569,\n        0.012924623675644398,\n        0.004691016860306263,\n        0.00957962591201067,\n        -0.013783869333565235,\n        0.02199679985642433,\n        0.0009203518857248127,\n        -0.020741622895002365,\n        0.000538688967935741,\n        -0.03214182332158089,\n        -0.0008817488560453057,\n        -0.03875984624028206,\n        -0.002216060645878315,\n        0.006093595642596483,\n        0.013484692201018333,\n        -0.004443701356649399,\n        0.011236595921218395,\n        -0.009196891449391842,\n        0.0022108813282102346,\n        -0.01574133336544037,\n        -0.00834518950432539,\n        -0.016331931576132774,\n        0.020654747262597084,\n        -0.013937457464635372,\n        0.030374256893992424,\n        0.010991145856678486,\n        0.0074775065295398235,\n        -0.00566432811319828,\n        0.24082253873348236,\n        0.008094752207398415,\n        -0.004651985596865416,\n        0.021692493930459023,\n        -0.014061531983315945,\n        -0.0022914442233741283,\n        -0.005358561407774687,\n        -0.03467877581715584,\n        0.01454460434615612,\n        0.0017473248299211264,\n        0.0069611938670277596,\n        -0.011649183928966522,\n        0.0046846261247992516,\n        -0.029639504849910736,\n        -0.003791903844103217,\n        -0.03596102073788643,\n        0.01315162144601345,\n        -0.003973800223320723,\n        0.004400692414492369,\n        -0.05290435627102852,\n        0.0003746203437913209,\n        0.024323804304003716,\n        0.00846909824758768,\n        0.008751844055950642,\n        0.009292441420257092,\n        -0.01132118422538042,\n        -0.03508687764406204,\n        -0.014409930445253849,\n        0.026427146047353745,\n        0.005633772350847721,\n        -0.06530971080064774,\n        0.01004791259765625,\n        -0.004484553821384907,\n        -0.010659027844667435,\n        -0.0013444715877994895,\n        0.007296874653548002,\n        0.004025292117148638,\n        -0.008517608046531677,\n        -0.0020490093156695366,\n        -0.0251024030148983,\n        -0.009280028752982616,\n        -0.0016570151783525944,\n        0.014116969890892506,\n        -0.023325636982917786,\n        0.0013863679487258196,\n        0.004450610373169184,\n        0.0008926586015149951,\n        -0.0022915201261639595,\n        0.007277228869497776,\n        0.001856876420788467,\n        0.007581853307783604,\n        -0.016863089054822922,\n        -0.006623873952776194,\n        -0.01631590723991394,\n        0.021280629560351372,\n        0.020097123458981514,\n        0.005170756950974464,\n        0.006496138870716095,\n        -0.008775357156991959,\n        0.01786462962627411,\n        0.0036659017205238342,\n        -0.010608091950416565,\n        0.009018303826451302,\n        -0.014078610576689243,\n        0.023679358884692192,\n        0.013200530782341957,\n        -0.0129867447540164,\n        -0.009026379324495792,\n        -0.020958803594112396,\n        0.012100904248654842,\n        0.008387993089854717,\n        0.007481146603822708,\n        -0.1450425237417221,\n        0.007175989914685488,\n        0.014748699963092804,\n        -0.0066052572801709175,\n        -0.00036594850826077163,\n        -0.015796616673469543,\n        -0.005410501733422279,\n        0.0028744463343173265,\n        0.03552425280213356,\n        0.011117750778794289,\n        0.016016822308301926,\n        0.010646170005202293,\n        0.00536377215757966,\n        -0.031256016343832016,\n        0.0008073857752606273,\n        0.0005914220819249749,\n        0.041183460503816605,\n        0.015415050089359283,\n        -0.020547540858387947,\n        -0.014784421771764755,\n        0.010886411182582378,\n        0.017500465735793114,\n        -0.008410667069256306,\n        -0.001980246277526021,\n        0.0030854218639433384,\n        0.00023909694573376328,\n        -0.022001300007104874,\n        0.0057127820327878,\n        0.0013390958774834871,\n        0.013472089543938637,\n        0.001962750218808651,\n        -0.008349161595106125,\n        -0.006591841112822294,\n        -0.005418413784354925,\n        -0.001368376542814076,\n        -0.018442178145051003,\n        0.01563086360692978,\n        0.01600293256342411,\n        -0.020474854856729507,\n        -0.011801091954112053,\n        0.006781826261430979,\n        0.0024360709358006716,\n        -0.011989431455731392,\n        -0.0037388738710433245,\n        -0.0006681907689198852,\n        0.015278835780918598,\n        -0.014597993344068527,\n        -0.08569261431694031,\n        0.0009941152529790998,\n        0.0008314694277942181,\n        -0.01018023956567049,\n        -0.010649661533534527,\n        0.009176494553685188,\n        0.00984614621847868,\n        -0.0019047162495553493,\n        0.01723186857998371,\n        -0.0037312600761651993,\n        0.015517642721533775,\n        0.004870370030403137,\n        0.021012049168348312,\n        0.0015423041768372059,\n        0.008541802875697613,\n        -0.02959742210805416,\n        -0.006479634903371334,\n        0.013887990266084671,\n        -0.007230103015899658,\n        -0.011924506165087223,\n        -0.002868722891435027,\n        -0.006119822151958942,\n        -0.04538368433713913,\n        -0.011661668308079243,\n        -0.005395449697971344,\n        -0.014685305766761303,\n        -0.014974404126405716,\n        -0.019525956362485886,\n        -0.0013091877335682511,\n        -0.02233673445880413,\n        0.0009701682138256729,\n        0.3470591902732849,\n        -0.021015707403421402,\n        0.020610462874174118,\n        -0.0036806054413318634,\n        -0.002802968956530094,\n        0.0016863752389326692,\n        0.012553482316434383,\n        -0.0010926754912361503,\n        0.05895156040787697,\n        0.001184574794024229,\n        -0.025764893740415573,\n        -0.017173293977975845,\n        0.01081751100718975,\n        0.006860274355858564,\n        -0.02475818060338497,\n        0.03205862641334534,\n        -0.003204336389899254,\n        -0.0030606945510953665,\n        0.0063162390142679214,\n        0.0035024089738726616,\n        0.006119699217379093,\n        -0.012423384003341198,\n        0.003302024444565177,\n        -0.004841668996959925,\n        0.012532337568700314,\n        0.011055494658648968,\n        0.01066046766936779,\n        -0.005659916438162327,\n        -0.01172578427940607,\n        -0.026345469057559967,\n        -0.011867989785969257,\n        0.018469838425517082,\n        0.011720703914761543,\n        0.008602350018918514,\n        -0.004555036313831806,\n        -0.010475420393049717,\n        0.00943355355411768,\n        -0.004599146079272032,\n        0.019278477877378464,\n        0.015533198602497578,\n        0.012065442278981209,\n        -0.007645179983228445,\n        0.06765244901180267,\n        -0.004589494317770004,\n        0.021749697625637054,\n        0.021197572350502014,\n        0.001155208796262741,\n        -0.010885576717555523,\n        0.015574351884424686,\n        0.00883147306740284,\n        -0.00642798375338316,\n        0.01723525859415531,\n        0.016700660809874535,\n        -0.020217832177877426,\n        0.00539974682033062,\n        0.00864606723189354,\n        0.007782820612192154,\n        0.007035105489194393,\n        0.004956221207976341,\n        0.014807026833295822,\n        -0.01719675585627556,\n        -0.018845483660697937,\n        -0.005459876731038094,\n        -0.01767677627503872,\n        -0.00028812131495215,\n        -0.002517515094950795,\n        -0.008588043041527271,\n        -0.016521474346518517,\n        -0.02516750432550907,\n        -0.009507311508059502,\n        -0.012431589886546135,\n        0.011903094127774239,\n        -0.018823301419615746,\n        0.015507553704082966,\n        0.016177549958229065,\n        0.0022762755397707224,\n        -0.021865570917725563,\n        -0.004402440041303635,\n        0.005876854062080383,\n        -0.02074974961578846,\n        -0.008962942287325859,\n        -0.02427058108150959,\n        -0.004405503626912832,\n        -0.013597031123936176,\n        0.011869181878864765,\n        -0.0073087443597614765,\n        -0.03178182989358902,\n        -0.02767902985215187,\n        -0.006301775109022856,\n        0.0028793467208743095,\n        -0.008242000825703144,\n        -0.002588054398074746,\n        -0.003782512852922082,\n        0.0053457398898899555,\n        0.0005135780083946884,\n        0.0068942406214773655,\n        -0.007170319557189941,\n        0.0014062715927138925,\n        -0.017116306349635124,\n        0.005975587293505669,\n        0.018452031537890434,\n        0.0047086006961762905,\n        -0.0027109007351100445,\n        0.0001970007870113477,\n        -0.003270745277404785,\n        0.003936877008527517,\n        -0.001642537652514875,\n        0.016228169202804565,\n        -0.006822286639362574,\n        -0.005525053944438696,\n        0.004244770854711533,\n        0.0051687718369066715,\n        0.022937746718525887,\n        -0.017020901665091515,\n        0.009015888907015324,\n        0.014889610931277275,\n        0.0041967430151999,\n        -0.0269971564412117,\n        -0.4487907588481903,\n        0.008868714794516563,\n        -0.0018754246411845088,\n        0.021382194012403488,\n        -0.02894297055900097,\n        -0.007982800714671612,\n        0.026376299560070038,\n        0.016290420666337013,\n        0.02165103703737259,\n        0.0003732370969373733,\n        -0.02591550722718239,\n        -0.0088060786947608,\n        -0.15011362731456757,\n        0.014201384969055653,\n        -0.012115039862692356,\n        0.003693311708047986,\n        -0.013639419339597225,\n        -0.05400371551513672,\n        -0.0039919656701385975,\n        0.02904174104332924,\n        -0.01063100527971983,\n        0.019504869356751442,\n        0.009663568809628487,\n        0.0021942032035440207,\n        0.011768230237066746,\n        -0.0047126947902143,\n        0.00788336805999279,\n        -0.0006523276097141206,\n        0.011422688141465187,\n        0.0027866815216839314,\n        -0.0009590091649442911,\n        -0.010115751065313816,\n        0.026838205754756927,\n        0.001656539854593575,\n        -0.004286169074475765,\n        -0.010218190029263496,\n        -0.0006707186694256961,\n        -0.001397784217260778,\n        0.0060875993221998215,\n        -0.011191582307219505,\n        -0.0050459555350244045,\n        0.00029439874924719334,\n        0.02588331326842308,\n        0.0122159318998456,\n        -0.039824556559324265,\n        -0.01087800320237875,\n        -0.020338183268904686,\n        -0.14322388172149658,\n        0.0034227040596306324,\n        -0.008546470664441586,\n        0.015055439434945583,\n        0.022094719111919403,\n        -0.011060971766710281,\n        -0.015038351528346539,\n        -0.02372513897716999,\n        0.011701934039592743,\n        0.011996056884527206,\n        0.01146415900439024,\n        0.024753248319029808,\n        -0.010773786343634129,\n        -0.015905367210507393,\n        -0.0049398234114050865,\n        0.03462233394384384,\n        0.0010236988309770823,\n        -0.009678472764790058,\n        -0.004160696640610695,\n        -0.029239293187856674,\n        -0.013043327257037163,\n        -0.026966776698827744,\n        -0.01229901798069477,\n        0.0012219037162140012,\n        -0.009472083300352097,\n        -0.004076968878507614,\n        0.001703733578324318,\n        0.022866860032081604,\n        0.02009263075888157,\n        0.014869887381792068,\n        -0.010359521023929119,\n        0.0015878751873970032,\n        0.012822656892240047,\n        -0.030341442674398422,\n        -0.022956615313887596,\n        0.021747412160038948,\n        0.009771385230123997,\n        0.008157736621797085,\n        -0.012216889299452305,\n        0.009098622016608715,\n        -0.0011643529869616032,\n        -0.02048894762992859,\n        -0.0014345002127811313,\n        -0.0019867962691932917,\n        0.0003558791649993509,\n        -0.007624598685652018,\n        -0.016853878274559975,\n        -0.006307430099695921,\n        0.004167083650827408,\n        -0.018696248531341553,\n        -0.00688399001955986,\n        -0.04042057693004608,\n        -0.0015557591104879975,\n        -0.004875261336565018,\n        0.007659055292606354,\n        0.010732654482126236,\n        -0.01830480620265007,\n        -0.012836085632443428,\n        -0.018887272104620934,\n        0.15725313127040863,\n        0.0044058323837816715,\n        -0.009159470908343792,\n        -0.005648813676089048,\n        -0.005560451187193394,\n        0.004950918257236481,\n        0.004405380226671696,\n        0.004999800119549036,\n        0.11570945382118225,\n        0.004996058531105518,\n        -0.018329361453652382,\n        0.001403279253281653,\n        -0.0009642693912610412,\n        0.0013217688538134098,\n        0.00883619673550129,\n        0.036079443991184235,\n        -0.004837947431951761,\n        0.015378260985016823,\n        0.002066124929115176,\n        0.005385559052228928,\n        0.014441515319049358,\n        -0.013538154773414135,\n        0.004567813593894243,\n        0.0016872796695679426,\n        0.005804570857435465,\n        -0.016148999333381653,\n        -0.017125580459833145,\n        -0.010548830032348633,\n        0.019223026931285858,\n        -0.021120566874742508,\n        0.005596144590526819,\n        -0.011901505291461945,\n        -0.008423513732850552,\n        0.06608253717422485,\n        -0.02264833077788353,\n        0.01192550826817751,\n        0.024008337408304214,\n        -0.0021613568533211946,\n        0.00539908092468977,\n        -0.03127346560359001,\n        -0.01287254597991705,\n        0.008230963721871376,\n        -0.026872020214796066,\n        0.030677374452352524,\n        0.006380883511155844,\n        0.003522346494719386,\n        -0.018458466976881027,\n        -0.002527804346755147,\n        -0.00431598536670208,\n        -0.005580021999776363,\n        -0.00845372024923563,\n        -0.029253508895635605,\n        -0.023159204050898552,\n        0.009075073525309563,\n        0.00025601108791306615,\n        -0.010174913331866264,\n        -0.043255798518657684,\n        -0.018723906949162483,\n        0.012625210918486118,\n        -0.007717047352343798,\n        0.004253001883625984,\n        0.00332260993309319,\n        -0.0002528601617086679,\n        -0.002562575042247772,\n        -0.01282813586294651,\n        -0.0004008401883766055,\n        0.008601696230471134,\n        -0.026378707960247993,\n        -0.007129421923309565,\n        -0.006092279218137264,\n        -0.0036277209874242544,\n        0.00567084364593029,\n        -0.1486862301826477,\n        0.002844402799382806,\n        0.004794106353074312,\n        -0.02784162014722824,\n        -0.006679324898868799,\n        -0.022259244695305824,\n        0.013131462037563324,\n        -0.0031215075869113207,\n        0.0046866098418831825,\n        0.012145533226430416,\n        0.000257849576883018,\n        0.12674668431282043,\n        -0.007396603934466839,\n        -0.013625177554786205,\n        -0.016799552366137505,\n        -0.003143979236483574,\n        0.017135733738541603,\n        0.0023115992080420256,\n        -0.007928424514830112,\n        -0.025284305214881897,\n        -0.008459693752229214,\n        0.10398071259260178,\n        0.00800530519336462,\n        0.026909545063972473,\n        0.01022370345890522,\n        -0.011920646764338017,\n        0.0008921390981413424,\n        0.00866506528109312,\n        0.0005301462369970977,\n        -0.00044596128282137215,\n        -0.00584063958376646,\n        0.005607076920568943,\n        0.012409751303493977\n      ],\n      \"label\": \"LOW\",\n      \"text\": \"in ef core 5, how can i configure it so that an owned type is serialized as json?\"\n    },\n    {\n      \"embedding\": [\n        0.02039445750415325,\n        0.009329110383987427,\n        -0.0063858344219625,\n        -0.0022812490351498127,\n        -0.02323310077190399,\n        -0.013027237728238106,\n        0.01961006224155426,\n        -0.013638310134410858,\n        0.005428168922662735,\n        -0.07121948897838593,\n        -0.014629247598350048,\n        -0.0024634592700749636,\n        -0.002002640860155225,\n        -0.008783119730651379,\n        -0.028760455548763275,\n        6.424890307243913e-05,\n        0.012376553378999233,\n        0.0038553052581846714,\n        -0.002131714718416333,\n        -0.016042346134781837,\n        0.004439534619450569,\n        -0.005865334998816252,\n        0.031842831522226334,\n        -0.014386935159564018,\n        0.015017320401966572,\n        0.0002791396400425583,\n        0.013109290972352028,\n        0.010686184279620647,\n        -0.012168671004474163,\n        0.019312020391225815,\n        0.0009414437226951122,\n        0.008297912776470184,\n        -0.000900810060556978,\n        0.00730891153216362,\n        -0.007535258773714304,\n        0.00919526070356369,\n        -0.006669522728770971,\n        -0.019071796908974648,\n        -0.010579504072666168,\n        -0.016308315098285675,\n        -0.04010802507400513,\n        0.00792109314352274,\n        0.04441574215888977,\n        -0.010729307308793068,\n        0.002213916275650263,\n        -0.025585148483514786,\n        0.007240836974233389,\n        -0.004635443910956383,\n        -0.005535494070500135,\n        0.006190856918692589,\n        0.0025153581518679857,\n        0.00625216169282794,\n        -0.00983637198805809,\n        -0.0028825534973293543,\n        0.01950671896338463,\n        0.009769483469426632,\n        -0.005437754560261965,\n        0.006399035453796387,\n        -0.03175976872444153,\n        0.021063653752207756,\n        0.0013231730554252863,\n        -0.0019202150870114565,\n        0.017947625368833542,\n        -0.00458945520222187,\n        -0.0017249748343601823,\n        0.008747135289013386,\n        0.0008959486149251461,\n        0.00858580507338047,\n        -0.013003678992390633,\n        -0.014394905418157578,\n        0.004457827191799879,\n        0.01405587699264288,\n        0.004601889289915562,\n        0.06408803910017014,\n        0.02073892392218113,\n        -0.012503165751695633,\n        0.028974877670407295,\n        -0.0019089512061327696,\n        -0.006704524625092745,\n        0.004076198674738407,\n        0.00115435931365937,\n        0.005870849825441837,\n        -0.004858851432800293,\n        -0.014478415250778198,\n        -0.00970640778541565,\n        -0.009062430821359158,\n        0.013542640022933483,\n        -0.0020952257327735424,\n        -0.004976946860551834,\n        0.013095272704958916,\n        0.01613515056669712,\n        -0.007884802296757698,\n        -0.018110938370227814,\n        0.0033188823144882917,\n        0.0013254889054223895,\n        0.011479954235255718,\n        0.005350329913198948,\n        -0.004205691162496805,\n        0.42081305384635925,\n        -0.00968922395259142,\n        -0.008573644794523716,\n        0.0009014643728733063,\n        0.00906637404114008,\n        -0.004837092477828264,\n        0.02269764430820942,\n        -0.03025415912270546,\n        -0.012866695411503315,\n        -0.028694601729512215,\n        0.003883116412907839,\n        0.031925003975629807,\n        0.030822059139609337,\n        -0.002144597005099058,\n        0.0022426871582865715,\n        -4.5188437070464715e-05,\n        -0.006833445746451616,\n        -0.030236119404435158,\n        0.01121692918241024,\n        0.001971140503883362,\n        0.017980923876166344,\n        -0.011958480812609196,\n        0.004468109924346209,\n        -0.017697839066386223,\n        0.07248935103416443,\n        0.00786749366670847,\n        -0.009477674961090088,\n        -0.01135212741792202,\n        -0.003371140221133828,\n        -0.012895338237285614,\n        0.001460296451114118,\n        -0.02349063754081726,\n        -0.03485414758324623,\n        -0.009475907310843468,\n        -0.00048241938930004835,\n        -0.0015780527610331774,\n        -0.0010878484463319182,\n        0.0011548349866643548,\n        -0.008919508196413517,\n        -0.0025622970424592495,\n        -0.05595393851399422,\n        0.01394527219235897,\n        0.012133805081248283,\n        -0.006726194638758898,\n        0.005455933045595884,\n        -0.01264666672796011,\n        -0.022755097597837448,\n        0.18685847520828247,\n        -0.01691720262169838,\n        0.0023538663517683744,\n        -0.004938594531267881,\n        0.0018003035802394152,\n        0.0008885525166988373,\n        -0.020330961793661118,\n        -0.012031910009682178,\n        0.012911496683955193,\n        -0.011570140719413757,\n        -0.011590506881475449,\n        0.01575644500553608,\n        0.004554626997560263,\n        0.00662964629009366,\n        0.0004100624064449221,\n        -0.06498976796865463,\n        0.010730903595685959,\n        -0.008107719011604786,\n        0.030820028856396675,\n        0.009474949911236763,\n        -0.01906215026974678,\n        0.009458707645535469,\n        -0.043944187462329865,\n        0.005206570029258728,\n        0.01424614991992712,\n        0.001170583302155137,\n        0.0005184027832001448,\n        -0.14996354281902313,\n        0.021765295416116714,\n        0.009286255575716496,\n        0.0072013926692306995,\n        -0.004659716039896011,\n        0.011929381638765335,\n        -0.003190129529684782,\n        -0.015722446143627167,\n        -0.01815064623951912,\n        0.01834193430840969,\n        0.006084519904106855,\n        0.016180403530597687,\n        -0.032099515199661255,\n        0.011430078186094761,\n        0.003294322406873107,\n        -0.008923242799937725,\n        0.0003509738598950207,\n        0.009325523860752583,\n        -0.0019701814744621515,\n        -0.028425632044672966,\n        0.003964909352362156,\n        0.015864670276641846,\n        0.010673252865672112,\n        0.011225402355194092,\n        0.005043562036007643,\n        -0.009630661457777023,\n        -0.004088860470801592,\n        0.010778944939374924,\n        -0.006817656569182873,\n        0.00015835711383260787,\n        -0.018961118534207344,\n        0.016901995986700058,\n        0.021244479343295097,\n        -0.003804424311965704,\n        -0.005433924496173859,\n        0.006842302158474922,\n        0.016494009643793106,\n        -0.0024014578666538,\n        -0.010637672618031502,\n        -7.727232878096402e-05,\n        0.0053171431645751,\n        0.03094189427793026,\n        0.0353022962808609,\n        -0.021167855709791183,\n        -0.0008689461974427104,\n        0.012743168510496616,\n        0.008250226266682148,\n        0.007845299318432808,\n        -0.013233593665063381,\n        0.008673184551298618,\n        -0.02156921476125717,\n        -0.009463030844926834,\n        -0.008926155045628548,\n        -0.006732558365911245,\n        0.012439075857400894,\n        0.0009144321666099131,\n        0.005373652093112469,\n        -0.009167078882455826,\n        0.008026966825127602,\n        0.0063455733470618725,\n        0.00894924532622099,\n        -0.015243635512888432,\n        -0.002839545253664255,\n        0.0048542930744588375,\n        -0.006756486836820841,\n        0.004971047397702932,\n        -0.001208290341310203,\n        0.01429009810090065,\n        0.005963467061519623,\n        -0.007884562946856022,\n        0.02749212644994259,\n        -0.0013566984562203288,\n        0.005307959858328104,\n        0.0012359292013570666,\n        0.01852298155426979,\n        0.011950000189244747,\n        0.0072205038741230965,\n        0.005552733317017555,\n        0.043303485959768295,\n        0.0081065334379673,\n        -0.021918853744864464,\n        -0.016146095469594002,\n        -0.029025882482528687,\n        -0.010243748314678669,\n        -0.002525107702240348,\n        -0.0796574279665947,\n        -0.017740987241268158,\n        -0.010356458835303783,\n        0.010222683660686016,\n        -0.19163382053375244,\n        0.003947861026972532,\n        0.013203560374677181,\n        0.008440962061285973,\n        -0.008878355845808983,\n        0.025226140394806862,\n        0.0013747744960710406,\n        -0.01895708218216896,\n        0.011175540275871754,\n        -0.02654990740120411,\n        -0.003266084473580122,\n        -0.041313450783491135,\n        0.009877652861177921,\n        -0.0038216696120798588,\n        0.007183769252151251,\n        -0.01046864315867424,\n        -0.006100723519921303,\n        -0.011098721995949745,\n        -0.021343091502785683,\n        -0.02041606418788433,\n        0.0031096464954316616,\n        -0.019416995346546173,\n        0.019631320610642433,\n        -0.013745995238423347,\n        0.024470513686537743,\n        0.01762683317065239,\n        0.009671872481703758,\n        0.0028081329073756933,\n        0.2604740262031555,\n        0.026210034266114235,\n        -0.013867592439055443,\n        0.008933997713029385,\n        -0.016630325466394424,\n        -0.005856370087713003,\n        -0.010458548553287983,\n        -0.029652513563632965,\n        0.006278388202190399,\n        0.004829395096749067,\n        0.009914031252264977,\n        -0.014958598650991917,\n        0.0012652042787522078,\n        -0.039437148720026016,\n        -0.007311483845114708,\n        -0.021462853997945786,\n        0.008077370002865791,\n        0.003967227879911661,\n        0.005063635762780905,\n        -0.03678053617477417,\n        -0.0049983724020421505,\n        -0.0028740540146827698,\n        -0.0013815644197165966,\n        -0.0020935693755745888,\n        0.004799794405698776,\n        -0.009738544002175331,\n        -0.023781854659318924,\n        -0.015738803893327713,\n        0.032626233994960785,\n        -0.007238231133669615,\n        -0.0537262000143528,\n        0.012643839232623577,\n        -0.0016240023542195559,\n        -0.009904581122100353,\n        -0.007598008960485458,\n        0.003405306488275528,\n        -0.0008665909990668297,\n        -0.004028125666081905,\n        -0.025651630014181137,\n        -0.022545790299773216,\n        -0.0007770610391162336,\n        -0.007444023620337248,\n        0.003744380082935095,\n        -0.02425505220890045,\n        -0.011070209555327892,\n        -0.006295229308307171,\n        -0.01313671562820673,\n        -0.020499657839536667,\n        0.01205499842762947,\n        0.005852322559803724,\n        0.007805896457284689,\n        -0.01712975837290287,\n        -0.01067646499723196,\n        -0.018875913694500923,\n        0.014298168942332268,\n        0.019405683502554893,\n        0.0063184695318341255,\n        0.017186330631375313,\n        0.0016592043684795499,\n        0.01577926054596901,\n        -0.001817985437810421,\n        0.006715130060911179,\n        -0.00014420766092371196,\n        -0.00024471114738844335,\n        0.016705675050616264,\n        -0.005719838198274374,\n        -0.0023667258210480213,\n        -0.01015920378267765,\n        -0.019472772255539894,\n        0.0006595418090000749,\n        0.00735819898545742,\n        0.003003645921126008,\n        -0.13396503031253815,\n        0.011126355268061161,\n        0.009786608628928661,\n        -0.005150869023054838,\n        -0.0010131056187674403,\n        -0.01121619250625372,\n        0.0070387390442192554,\n        -0.006282364018261433,\n        0.029067253693938255,\n        0.01522061601281166,\n        0.00017981980636250228,\n        0.016120480373501778,\n        0.006321825552731752,\n        -0.02651059441268444,\n        0.0006518823211081326,\n        0.002931169467046857,\n        0.04065092280507088,\n        0.005657408386468887,\n        -0.022772766649723053,\n        -0.01689116097986698,\n        0.005222965497523546,\n        0.015482182614505291,\n        -0.006359671242535114,\n        0.005627564154565334,\n        0.006165416445583105,\n        0.0031208707951009274,\n        -0.018388239666819572,\n        -0.008571879006922245,\n        -0.00942636001855135,\n        0.018839146941900253,\n        -0.012159918434917927,\n        -0.0062193116173148155,\n        -0.004445856902748346,\n        -0.006011628080159426,\n        0.0021532855462282896,\n        0.0010279976995661855,\n        0.007652680389583111,\n        0.011531555093824863,\n        -0.014759029261767864,\n        -0.006943935062736273,\n        0.005930377170443535,\n        -0.002639238955453038,\n        0.013245626352727413,\n        -0.019623612985014915,\n        -0.008578967303037643,\n        0.001572834444232285,\n        -0.010334818623960018,\n        -0.10554677248001099,\n        -0.00977408979088068,\n        -0.006572606973350048,\n        -0.01331594679504633,\n        -0.012126442976295948,\n        0.019541308283805847,\n        0.003057927591726184,\n        0.006769230589270592,\n        -0.001669080462306738,\n        -0.004076978657394648,\n        0.020721081644296646,\n        0.017214080318808556,\n        0.020775336772203445,\n        -0.009672624990344048,\n        0.001611808082088828,\n        -0.020856143906712532,\n        -0.012448630295693874,\n        0.01653185859322548,\n        0.006088856607675552,\n        -0.01404204685240984,\n        0.0021502559538930655,\n        0.013774893246591091,\n        -0.04752389341592789,\n        -0.010632338002324104,\n        -0.0003475138801150024,\n        -0.03574530407786369,\n        -0.01821925677359104,\n        -0.017107384279370308,\n        0.0007779861916787922,\n        -0.013850036077201366,\n        -0.004089724272489548,\n        0.3403048813343048,\n        -0.014394883997738361,\n        0.009628048166632652,\n        -0.0025859910529106855,\n        -0.01923978328704834,\n        -0.011382333002984524,\n        0.015602130442857742,\n        -0.003190044779330492,\n        0.04598904401063919,\n        0.0028009344823658466,\n        -0.009925877675414085,\n        -0.02182849869132042,\n        -0.004793766885995865,\n        0.008026781491935253,\n        -0.03747987002134323,\n        0.021869324147701263,\n        0.007670832797884941,\n        -0.0064276233315467834,\n        -0.001845433609560132,\n        -0.011233883909881115,\n        0.0031099149491637945,\n        0.004901505075395107,\n        0.007599821779876947,\n        -0.012925037182867527,\n        0.016049401834607124,\n        0.0050430018454790115,\n        0.00239281146787107,\n        -0.008275839500129223,\n        -0.003632206004112959,\n        -0.008740216493606567,\n        -0.01720230095088482,\n        0.012146754190325737,\n        0.005852756556123495,\n        0.015462875366210938,\n        -0.004518353845924139,\n        -0.00517266197130084,\n        0.012092678807675838,\n        0.006908233277499676,\n        0.008768774569034576,\n        0.004185569006949663,\n        0.01363169215619564,\n        0.00423558009788394,\n        0.06088092923164368,\n        -0.001793655683286488,\n        0.014455302618443966,\n        0.010724241845309734,\n        -0.0052613383159041405,\n        -0.009440657682716846,\n        0.029123345389962196,\n        0.0062365783378481865,\n        -0.014326999895274639,\n        0.011866627261042595,\n        0.015416090376675129,\n        -0.008981081657111645,\n        -0.0025332290679216385,\n        0.0051352581940591335,\n        0.00821018684655428,\n        -0.011693744920194149,\n        -0.011451606638729572,\n        -0.005426885560154915,\n        -0.013806660659611225,\n        -0.006607064511626959,\n        -0.009153145365417004,\n        -0.002933175303041935,\n        0.01713304966688156,\n        -0.015997933223843575,\n        0.0014536705566570163,\n        -0.007618360221385956,\n        -0.014526145532727242,\n        -0.008658366277813911,\n        -0.018422337248921394,\n        0.0011256936704739928,\n        -0.02748172916471958,\n        0.012479417957365513,\n        0.021452156826853752,\n        0.001562531921081245,\n        -0.025555524975061417,\n        0.0065613193437457085,\n        -0.00209504971280694,\n        -0.013913575559854507,\n        -0.012075789272785187,\n        -0.01455396693199873,\n        -0.006788528990000486,\n        -0.010492048226296902,\n        -0.003972693346440792,\n        0.009717912413179874,\n        -0.025845356285572052,\n        -0.026431582868099213,\n        -0.0048737614415585995,\n        0.017324643209576607,\n        -0.0013998278882354498,\n        -0.018030479550361633,\n        -0.008311547338962555,\n        -0.007493891753256321,\n        -0.0035244368482381105,\n        0.00771515304222703,\n        0.0021924739703536034,\n        -0.005751968361437321,\n        -0.006604904308915138,\n        0.005347672384232283,\n        0.019293809309601784,\n        -0.0003495284472592175,\n        0.010960870422422886,\n        0.004829931538552046,\n        -0.003964467439800501,\n        -0.008894444443285465,\n        -0.0016397202853113413,\n        0.011930232867598534,\n        -0.010505779646337032,\n        -0.003346486249938607,\n        0.015857968479394913,\n        0.014665059745311737,\n        0.014732534997165203,\n        -0.004206720273941755,\n        -0.0019176763016730547,\n        0.01332307793200016,\n        0.0021988777443766594,\n        -0.02403758279979229,\n        -0.4469744861125946,\n        0.01972227357327938,\n        0.004987025633454323,\n        0.014963134191930294,\n        -0.008944636210799217,\n        -0.005878764670342207,\n        0.02129177562892437,\n        0.013982802629470825,\n        0.018398547545075417,\n        0.011725765652954578,\n        -0.02574373222887516,\n        -0.021991107612848282,\n        -0.12666742503643036,\n        0.011377723887562752,\n        -0.013467676937580109,\n        0.016786223277449608,\n        -0.01608293317258358,\n        -0.04973398521542549,\n        0.00016399554442614317,\n        0.03954412788152695,\n        -0.013195888139307499,\n        0.012831269763410091,\n        0.013146511279046535,\n        0.009329939261078835,\n        0.014414996840059757,\n        0.0021092528477311134,\n        0.002863264875486493,\n        0.005193709395825863,\n        0.008082847110927105,\n        -0.009050048887729645,\n        -0.0022750503849238157,\n        -0.001845191465690732,\n        0.030253732576966286,\n        -0.009286943823099136,\n        -0.005152231547981501,\n        -0.010391759686172009,\n        0.004703886806964874,\n        -0.004108126275241375,\n        0.007455661427229643,\n        -0.019625799730420113,\n        -0.0037084040232002735,\n        0.002227721968665719,\n        0.019071374088525772,\n        0.014121511951088905,\n        -0.03018501214683056,\n        -0.01767222210764885,\n        -0.03424135223031044,\n        -0.15107634663581848,\n        0.00812471192330122,\n        -0.009383570402860641,\n        0.014023326337337494,\n        0.0047807348892092705,\n        0.009023885242640972,\n        -0.0035885018296539783,\n        0.0006727855652570724,\n        0.01547104399651289,\n        -0.00184194918256253,\n        -0.006005006842315197,\n        0.02434641867876053,\n        -0.005449032410979271,\n        -0.005406939424574375,\n        -0.003070979146286845,\n        0.028605615720152855,\n        0.0045657409355044365,\n        -0.008447639644145966,\n        0.014060555025935173,\n        -0.02609773352742195,\n        -0.002231627469882369,\n        -0.016093777492642403,\n        -0.02187499962747097,\n        -0.01729179173707962,\n        2.487706660758704e-05,\n        -0.016653643921017647,\n        0.007122368551790714,\n        0.011934424750506878,\n        0.02483328804373741,\n        0.005048356484621763,\n        0.004156915005296469,\n        -0.008086747489869595,\n        0.002900171559303999,\n        -0.014238164760172367,\n        -0.01110175158828497,\n        0.03273740038275719,\n        0.022436799481511116,\n        0.007743579801172018,\n        -0.007951783947646618,\n        -0.0028308737091720104,\n        0.019021708518266678,\n        0.004402468912303448,\n        -0.0026788879185914993,\n        -0.0028126374818384647,\n        0.0008484298014082015,\n        0.010685634799301624,\n        -0.009817673824727535,\n        -0.01054972130805254,\n        0.011133360676467419,\n        -0.013031776994466782,\n        0.020091768354177475,\n        -0.01239350251853466,\n        -0.00947580300271511,\n        -0.007215695921331644,\n        -0.0034883450716733932,\n        0.012784423306584358,\n        -0.026235120370984077,\n        -0.004409985151141882,\n        -0.008968875743448734,\n        0.16672198474407196,\n        0.0025160759687423706,\n        -0.005737856961786747,\n        -0.001338813453912735,\n        -0.0018787229200825095,\n        0.012143617495894432,\n        0.004520316142588854,\n        0.007079395931214094,\n        0.10781430453062057,\n        0.009063338860869408,\n        -0.0029431963339447975,\n        0.008303149603307247,\n        -0.00031500306795351207,\n        -0.004589234944432974,\n        0.0059718182310462,\n        0.02588905766606331,\n        -0.005579439923167229,\n        0.01689429022371769,\n        -0.006689496338367462,\n        0.006833633873611689,\n        0.016785891726613045,\n        -0.010677634738385677,\n        0.01190104242414236,\n        -0.002533396240323782,\n        -0.007275957148522139,\n        -0.00253050634637475,\n        -0.019088461995124817,\n        -0.018875621259212494,\n        0.02016613818705082,\n        -0.021909620612859726,\n        0.0032349645625799894,\n        0.01767919957637787,\n        -0.012697185389697552,\n        0.05635295808315277,\n        -0.01611725613474846,\n        0.0064377738162875175,\n        0.013404080644249916,\n        -0.002685476327314973,\n        0.0030814805068075657,\n        -0.016239970922470093,\n        -0.006281547714024782,\n        0.0017259657615795732,\n        -0.02607986330986023,\n        0.030810900032520294,\n        -0.006045927759259939,\n        0.0010585401905700564,\n        -0.014656913466751575,\n        -0.016642896458506584,\n        0.010925422422587872,\n        -0.0038384597282856703,\n        0.004876702092587948,\n        -0.017458079382777214,\n        -0.016415869817137718,\n        0.01680702343583107,\n        -0.012250321917235851,\n        0.006089995615184307,\n        -0.053506746888160706,\n        -0.011852365918457508,\n        0.015827203169465065,\n        -0.0075766462832689285,\n        -0.001035819062963128,\n        0.011731131933629513,\n        0.0026399760972708464,\n        -0.006009269040077925,\n        0.0010348598007112741,\n        -0.004818199202418327,\n        0.00935276411473751,\n        -0.004817518871277571,\n        -0.009980720467865467,\n        -0.01086097490042448,\n        -0.012204722501337528,\n        0.01532853115350008,\n        -0.15799018740653992,\n        -0.0017619041027501225,\n        0.009771771728992462,\n        -0.018511716276407242,\n        -0.018712328746914864,\n        -0.018102288246154785,\n        0.021576520055532455,\n        0.010633010417222977,\n        0.004200779367238283,\n        0.010237096808850765,\n        -0.004062600899487734,\n        0.1258859634399414,\n        -0.014047365635633469,\n        0.005082272458821535,\n        -0.009407381527125835,\n        -0.00940761063247919,\n        0.005881977267563343,\n        0.015061646699905396,\n        -0.0035507441498339176,\n        -0.02356540411710739,\n        -0.010422644205391407,\n        0.10631720721721649,\n        0.004390729125589132,\n        0.023114612326025963,\n        0.017772773280739784,\n        -0.010049737058579922,\n        0.003284045960754156,\n        0.010080733336508274,\n        0.014630740508437157,\n        -0.013631023466587067,\n        -0.004977407865226269,\n        0.005198233760893345,\n        0.0011560205603018403\n      ],\n      \"label\": \"LOW\",\n      \"text\": \"Is drinking coffee every day bad for my teeth? If so, what can I do to prevent problems?\"\n    },\n    {\n      \"embedding\": [\n        0.028481466695666313,\n        -0.0032100745011121035,\n        -0.0036680581979453564,\n        -0.012064126320183277,\n        -0.014738199301064014,\n        -0.008851398713886738,\n        0.01305114571005106,\n        -0.007984080351889133,\n        0.006234572269022465,\n        -0.07052527368068695,\n        -0.01605345867574215,\n        0.0028764274902641773,\n        0.006010148208588362,\n        -0.005135666579008102,\n        -0.03757606819272041,\n        0.011544846929609776,\n        0.013252086006104946,\n        -0.008494338020682335,\n        -0.012022257782518864,\n        -0.01595737598836422,\n        0.005728313699364662,\n        -0.003944289870560169,\n        0.04078539088368416,\n        -0.019679097458720207,\n        0.013171138241887093,\n        -0.0033915722742676735,\n        0.013431847095489502,\n        -0.002831314457580447,\n        -0.012022067792713642,\n        0.03594043105840683,\n        -0.003874531714245677,\n        0.016333891078829765,\n        -0.007171308621764183,\n        -0.014637019485235214,\n        -0.0127987926825881,\n        -0.0014821848599240184,\n        -0.003763703629374504,\n        -0.023475799709558487,\n        -0.01440843753516674,\n        -0.011180538684129715,\n        -0.024014534428715706,\n        -9.284873522119597e-05,\n        0.030041739344596863,\n        -0.023861469700932503,\n        -0.0041903662495315075,\n        -0.028050566092133522,\n        -0.008066064678132534,\n        0.004128975793719292,\n        0.006282537244260311,\n        0.011226043105125427,\n        -0.00032679576543159783,\n        -0.006346442271023989,\n        4.8125351895578206e-05,\n        0.011022440157830715,\n        -0.00018652713333722204,\n        0.008158954791724682,\n        0.004160143435001373,\n        -0.007040262222290039,\n        -0.014989886432886124,\n        0.008227295242249966,\n        -0.005556535441428423,\n        -0.0031042799819260836,\n        0.010290107689797878,\n        0.008744004182517529,\n        -0.01597421243786812,\n        -0.0016717870021238923,\n        0.0063789780251681805,\n        -0.0012683117529377341,\n        -0.0039807530120015144,\n        -0.011786128394305706,\n        -0.005436820909380913,\n        0.0018739051884040236,\n        0.007266359869390726,\n        0.06621047109365463,\n        0.021580353379249573,\n        -0.005671683233231306,\n        0.034882523119449615,\n        0.01079897303134203,\n        0.007216220255941153,\n        0.006121003534644842,\n        0.010424097068607807,\n        -0.0035014578606933355,\n        -0.010838386602699757,\n        0.002388108056038618,\n        -0.005598912946879864,\n        -0.0006575909210368991,\n        0.013120759278535843,\n        -0.011220728978514671,\n        -0.005976819898933172,\n        0.01715632900595665,\n        0.006815479602664709,\n        -0.004414496943354607,\n        -0.034402087330818176,\n        -0.008330200798809528,\n        -0.007713593076914549,\n        0.016911979764699936,\n        0.006792599800974131,\n        0.001579583971761167,\n        0.4029686152935028,\n        0.006133169401437044,\n        -0.006269508507102728,\n        0.0009417503024451435,\n        -0.0047039189375936985,\n        -0.0023076010402292013,\n        0.019042614847421646,\n        -0.016674473881721497,\n        -0.01143437810242176,\n        -0.022738857194781303,\n        -0.0013461931375786662,\n        0.033254340291023254,\n        0.03403940424323082,\n        -0.004657887853682041,\n        0.010137207806110382,\n        0.003191462717950344,\n        0.00423059007152915,\n        -0.014854967594146729,\n        0.00187963608186692,\n        0.0033404480200260878,\n        0.008774741552770138,\n        -0.004102198872715235,\n        0.013924067839980125,\n        -0.002166380872949958,\n        0.06777045875787735,\n        0.01696203276515007,\n        -0.009100930765271187,\n        -0.013235462829470634,\n        0.003540582722052932,\n        -0.009110520593822002,\n        0.010211421176791191,\n        -0.01178856659680605,\n        -0.04253000393509865,\n        -0.014148823916912079,\n        -0.009067322127521038,\n        0.0002958943950943649,\n        0.009686066769063473,\n        0.0011271099792793393,\n        -0.022043123841285706,\n        0.004045727197080851,\n        -0.04135211184620857,\n        0.011710057966411114,\n        0.007540761027485132,\n        -0.021476654335856438,\n        0.011550378985702991,\n        -0.01543466653674841,\n        -0.018416501581668854,\n        0.18628528714179993,\n        -0.010102721862494946,\n        -0.009657307527959347,\n        -0.0007819949532859027,\n        -0.002873751102015376,\n        -0.010273076593875885,\n        -0.018142543733119965,\n        -0.01662677340209484,\n        0.0031405820045620203,\n        -0.0047050523571670055,\n        -0.012725889682769775,\n        0.0184447281062603,\n        -0.0031997181940823793,\n        -0.006230160593986511,\n        -0.0003932864929083735,\n        -0.05243059620261192,\n        0.002467630198225379,\n        -0.006740711163729429,\n        0.041581891477108,\n        0.00135491241235286,\n        -0.0043099713511765,\n        0.00013487310206983238,\n        -0.0531163327395916,\n        0.01094493642449379,\n        0.0371587909758091,\n        0.009056678041815758,\n        -0.0022147393319755793,\n        -0.15529899299144745,\n        0.012336480431258678,\n        0.012374239973723888,\n        -0.0013503319351002574,\n        0.008443396538496017,\n        -0.00022072401770856231,\n        -0.00296808616258204,\n        -0.010984603315591812,\n        -0.017146727070212364,\n        0.01517662312835455,\n        0.0016807044157758355,\n        -0.008087344467639923,\n        -0.020684365183115005,\n        0.00844782218337059,\n        0.004575537052005529,\n        -0.02506963536143303,\n        -0.003397218883037567,\n        0.002653817180544138,\n        0.0016820784658193588,\n        -0.013694286346435547,\n        0.002471347339451313,\n        0.01588994637131691,\n        0.020769501104950905,\n        -0.0029095239005982876,\n        0.015043907798826694,\n        -0.017222166061401367,\n        -0.01522522047162056,\n        -0.001344539923593402,\n        -0.010885421186685562,\n        0.005388220772147179,\n        -0.01165734138339758,\n        0.002077261218801141,\n        0.015180230140686035,\n        0.0065882327035069466,\n        -0.004321780521422625,\n        0.0065977550111711025,\n        0.024087296798825264,\n        0.004317300394177437,\n        -0.01362061221152544,\n        0.000977547257207334,\n        -0.009196503087878227,\n        0.020808910951018333,\n        0.0413227453827858,\n        -0.014660883694887161,\n        -0.005173196084797382,\n        0.008529740385711193,\n        0.0005162470042705536,\n        -0.0051298500038683414,\n        0.01033002883195877,\n        0.012104791589081287,\n        -0.0182360652834177,\n        -0.01297315489500761,\n        0.0014281488256528974,\n        0.003872287692502141,\n        0.007588055916130543,\n        -0.014890051446855068,\n        -0.0001284214376937598,\n        -0.016883866861462593,\n        0.00034463449264876544,\n        0.011394888162612915,\n        -0.0013301551807671785,\n        -6.5691776399035e-05,\n        0.0027407945599406958,\n        -0.014958030544221401,\n        -0.00879379827529192,\n        0.017592739313840866,\n        0.008886925876140594,\n        0.024556633085012436,\n        -0.0017414436442777514,\n        -0.0027629819232970476,\n        0.023790931329131126,\n        -0.013575847260653973,\n        0.0021446903701871634,\n        0.013762501999735832,\n        0.024049069732427597,\n        0.00280263414606452,\n        -0.004523663781583309,\n        -0.0053471969440579414,\n        0.061793193221092224,\n        0.01940036751329899,\n        -0.01367171574383974,\n        -0.010136540979146957,\n        -0.028502998873591423,\n        0.00020018868963234127,\n        -0.009876967407763004,\n        -0.08737751841545105,\n        -0.02316276729106903,\n        -0.011066901497542858,\n        0.008019373752176762,\n        -0.19544245302677155,\n        0.012813440524041653,\n        0.010146625339984894,\n        0.003991636913269758,\n        -0.008251442573964596,\n        0.01881340891122818,\n        0.007313342299312353,\n        -0.005583884660154581,\n        -0.002973964437842369,\n        -0.029929479584097862,\n        0.009119047783315182,\n        -0.028870416805148125,\n        0.0014640770386904478,\n        -0.0021524184849113226,\n        0.02146441489458084,\n        0.0005779755883850157,\n        -0.0027765659615397453,\n        0.008556170389056206,\n        0.0009732022881507874,\n        -0.019156960770487785,\n        0.006540260743349791,\n        -0.015143433585762978,\n        0.03906533122062683,\n        -0.02133104018867016,\n        0.02247505635023117,\n        0.009192245081067085,\n        0.002206547185778618,\n        0.0037197815254330635,\n        0.25034400820732117,\n        0.02491210587322712,\n        0.0064856004901230335,\n        0.0181731004267931,\n        -0.026356995105743408,\n        -0.003594128880649805,\n        -0.0026246323250234127,\n        -0.03161114081740379,\n        0.017528334632515907,\n        -0.0027028783224523067,\n        0.004975538235157728,\n        -0.01684742048382759,\n        -0.0060270666144788265,\n        -0.03920280933380127,\n        0.008427784778177738,\n        -0.022113759070634842,\n        0.008520949631929398,\n        -0.0029229901265352964,\n        0.011051123961806297,\n        -0.04535704478621483,\n        -0.009062517434358597,\n        0.027849270030856133,\n        -7.125990669010207e-05,\n        0.008085643872618675,\n        0.003574596717953682,\n        -0.0058377450332045555,\n        -0.043075814843177795,\n        -0.024250848218798637,\n        0.03552256152033806,\n        0.008264884352684021,\n        -0.05097333341836929,\n        0.006994653958827257,\n        0.00281835556961596,\n        -0.022983506321907043,\n        -0.012356574647128582,\n        0.0008327520336024463,\n        -0.0020424528047442436,\n        0.0013315633404999971,\n        -0.018399694934487343,\n        -0.019879095256328583,\n        0.00553104979917407,\n        -0.0048089600168168545,\n        0.02499583177268505,\n        -0.01640998385846615,\n        -0.008041865192353725,\n        0.006009378004819155,\n        -0.008389551192522049,\n        0.0005091773928143084,\n        0.013637284748256207,\n        0.008504332043230534,\n        0.00012893107486888766,\n        -0.015254270285367966,\n        -0.0037575499154627323,\n        -0.02032279036939144,\n        0.011838273145258427,\n        0.01785503700375557,\n        0.009433496743440628,\n        0.01658165641129017,\n        -0.01113493088632822,\n        0.019913066178560257,\n        -0.0025226385332643986,\n        -0.0071386778727173805,\n        0.003986249677836895,\n        -0.006006501615047455,\n        0.019915560260415077,\n        0.006187689024955034,\n        -0.016032641753554344,\n        -0.0052686394192278385,\n        -0.01946667581796646,\n        0.008946087211370468,\n        0.007346574682742357,\n        0.008798312395811081,\n        -0.13482312858104706,\n        0.019759267568588257,\n        0.01634576916694641,\n        -0.010625009424984455,\n        0.0030150171369314194,\n        -0.005240299738943577,\n        0.011385271325707436,\n        -0.0049846479669213295,\n        0.021069277077913284,\n        0.011931764893233776,\n        -0.007639411836862564,\n        0.0031936154700815678,\n        0.01148471049964428,\n        -0.021793212741613388,\n        -0.0005502455751411617,\n        0.01754508726298809,\n        0.04001929238438606,\n        0.016804732382297516,\n        -0.014178791083395481,\n        -0.014155114069581032,\n        0.009545539505779743,\n        0.015728304162621498,\n        -0.002480913884937763,\n        -0.0037433793768286705,\n        -0.004303444176912308,\n        0.0036718042101711035,\n        -0.027051599696278572,\n        0.0005708340322598815,\n        -0.0045464555732905865,\n        0.018299678340554237,\n        -0.005026747472584248,\n        -0.007229410577565432,\n        -0.004213571548461914,\n        -0.0010581830283626914,\n        -0.0009691077866591513,\n        -8.765130769461393e-05,\n        0.01213790662586689,\n        0.011448062025010586,\n        -0.015211221762001514,\n        -0.014225609600543976,\n        0.005352279171347618,\n        0.002950174966827035,\n        0.0018103790935128927,\n        -0.01874382235109806,\n        0.004209776408970356,\n        0.007550138048827648,\n        -0.01867091841995716,\n        -0.10517671704292297,\n        -0.014730149880051613,\n        -0.011389746330678463,\n        -0.014610673300921917,\n        -0.00628548301756382,\n        0.0066108000464737415,\n        0.014477737247943878,\n        0.003205421380698681,\n        -0.005561803467571735,\n        -0.005047264043241739,\n        0.015232146717607975,\n        0.0026111097540706396,\n        0.008841216564178467,\n        0.0013381035532802343,\n        0.01354994997382164,\n        -0.02971905656158924,\n        0.002546435920521617,\n        0.019230207428336143,\n        0.001415462582372129,\n        -0.02076919749379158,\n        0.007205471396446228,\n        0.00804719515144825,\n        -0.05084868520498276,\n        -0.004378694109618664,\n        0.0028741599526256323,\n        -0.029340794309973717,\n        -0.006062444765120745,\n        -0.01728450506925583,\n        0.004825662821531296,\n        -0.017383180558681488,\n        -0.013110457919538021,\n        0.3406284749507904,\n        -0.011256606318056583,\n        0.015743611380457878,\n        0.007575451396405697,\n        -0.014195769093930721,\n        0.00389893283136189,\n        0.019256463274359703,\n        -0.009480844251811504,\n        0.05363301932811737,\n        0.0031888687517493963,\n        -0.021639686077833176,\n        -0.024615388363599777,\n        0.016033759340643883,\n        0.0012751492904499173,\n        -0.01906251348555088,\n        0.021517276763916016,\n        0.004980066791176796,\n        -0.003369574435055256,\n        -0.006726786494255066,\n        0.002780372742563486,\n        -0.0071771773509681225,\n        -0.015407818369567394,\n        0.016232172027230263,\n        -0.009401519782841206,\n        0.002734348876401782,\n        0.018209725618362427,\n        0.00510728545486927,\n        -0.0025584683753550053,\n        -0.00753369415178895,\n        -0.013244487345218658,\n        -0.018637966364622116,\n        0.018083272501826286,\n        0.009038437157869339,\n        0.018527138978242874,\n        0.001672680489718914,\n        -0.014017142355442047,\n        0.001983570633456111,\n        0.0003638377820607275,\n        0.013502437621355057,\n        0.015476514585316181,\n        0.01534595899283886,\n        -0.005360999144613743,\n        0.05548416078090668,\n        -0.0022822082974016666,\n        0.016051001846790314,\n        0.009160741232335567,\n        -0.0007279389537870884,\n        -0.01568947173655033,\n        0.022993922233581543,\n        0.01002364233136177,\n        0.0009458106360398233,\n        0.021198786795139313,\n        0.008258165791630745,\n        -0.01263381727039814,\n        0.009771843440830708,\n        0.010516144335269928,\n        0.0033517556730657816,\n        -0.008542624302208424,\n        0.007836688309907913,\n        0.00304834870621562,\n        0.0016635021893307567,\n        -0.0173858143389225,\n        -0.004054618533700705,\n        -0.004043348599225283,\n        0.015762904658913612,\n        -0.004780821036547422,\n        0.005086285527795553,\n        -0.016211949288845062,\n        -0.027660345658659935,\n        -0.012494189664721489,\n        -0.017237087711691856,\n        0.00409947382286191,\n        -0.01701396517455578,\n        0.013591744005680084,\n        0.018766677007079124,\n        0.009997373446822166,\n        -0.02899988740682602,\n        0.005956615786999464,\n        0.0018688042182475328,\n        -0.012759780511260033,\n        -0.01984594017267227,\n        -0.01342670526355505,\n        -0.007871230132877827,\n        -0.017757218331098557,\n        -0.010107247158885002,\n        -0.005552962888032198,\n        -0.042343057692050934,\n        -0.01442392822355032,\n        0.004624031018465757,\n        0.009142719209194183,\n        -0.0024364530108869076,\n        -0.00779950013384223,\n        -0.012429878115653992,\n        0.009014386683702469,\n        -0.005744538269937038,\n        0.011449596844613552,\n        2.4167520678020082e-05,\n        -0.010021339170634747,\n        -0.005453824531286955,\n        0.007501058280467987,\n        0.023800330236554146,\n        0.000507863936945796,\n        0.0009390436462126672,\n        -0.009046148508787155,\n        0.002733289496973157,\n        -0.0023227271158248186,\n        -0.004945544991642237,\n        0.008424296043813229,\n        -0.012587535195052624,\n        -0.0005831593298353255,\n        0.0115160858258605,\n        -0.005984772462397814,\n        0.012134176678955555,\n        0.0018935505067929626,\n        -0.007110421545803547,\n        0.020056268200278282,\n        -0.006530118174850941,\n        -0.02069927752017975,\n        -0.4561271667480469,\n        0.006033765152096748,\n        0.006408394780009985,\n        0.004936664830893278,\n        -0.021691415458917618,\n        0.0016890342812985182,\n        0.026843173429369926,\n        0.004279727581888437,\n        0.015640810132026672,\n        0.00015536749560851604,\n        -0.022893333807587624,\n        -0.009500727988779545,\n        -0.13548730313777924,\n        0.013845794834196568,\n        -0.008374335244297981,\n        0.002331565599888563,\n        -0.0059048766270279884,\n        -0.05896355211734772,\n        0.0010769212385639548,\n        0.03999321162700653,\n        -0.004881581291556358,\n        0.010504393838346004,\n        0.01977461576461792,\n        0.014779353514313698,\n        0.029292156919836998,\n        -0.01331364642828703,\n        -0.00449405238032341,\n        0.005207533482462168,\n        0.00795875396579504,\n        -0.0009343190467916429,\n        -0.00478253373876214,\n        -0.021151812747120857,\n        0.027697231620550156,\n        0.0037257433868944645,\n        -0.0008393958560191095,\n        -0.009514912962913513,\n        -0.002861006883904338,\n        -0.0014223129255697131,\n        0.011421425268054008,\n        -0.02395738661289215,\n        -0.006004301365464926,\n        0.007238397840410471,\n        0.013602610677480698,\n        0.013419140130281448,\n        -0.030369361862540245,\n        -0.01429602038115263,\n        -0.03642832860350609,\n        -0.148605614900589,\n        0.002944819163531065,\n        -0.008960862644016743,\n        0.017539873719215393,\n        0.0005102307186461985,\n        0.0022721323184669018,\n        -0.006210957188159227,\n        -0.011270688846707344,\n        0.011764095164835453,\n        0.007209755480289459,\n        0.010177290998399258,\n        0.019597399979829788,\n        -0.014854487963020802,\n        -0.01290462352335453,\n        -0.006237701512873173,\n        0.02643461711704731,\n        0.002075844444334507,\n        0.004868035204708576,\n        0.008638898842036724,\n        -0.017200855538249016,\n        -0.0013375000562518835,\n        -0.018687915056943893,\n        -0.02052062377333641,\n        -0.0008527587633579969,\n        -0.007883081212639809,\n        -0.004736979026347399,\n        0.010171622037887573,\n        0.018002936616539955,\n        0.021635418757796288,\n        1.7149042832897976e-05,\n        -0.003462042659521103,\n        0.007129318546503782,\n        -0.001986239105463028,\n        -0.025379445403814316,\n        -0.006045063491910696,\n        0.015646036714315414,\n        0.025369713082909584,\n        0.01897394098341465,\n        -0.004390508867800236,\n        -0.0018207089742645621,\n        0.015384625643491745,\n        -0.011445743031799793,\n        0.009166812524199486,\n        0.0001588084560353309,\n        0.01275301817804575,\n        0.0068309111520648,\n        -0.00376890879124403,\n        -0.0017735871952027082,\n        0.00171623972710222,\n        -0.019546490162611008,\n        0.008847960270941257,\n        -0.020602576434612274,\n        -0.008028321899473667,\n        -0.007949132472276688,\n        0.005732436198741198,\n        0.008815097622573376,\n        -0.029176734387874603,\n        -0.00013534327445086092,\n        -0.01748441345989704,\n        0.17584189772605896,\n        0.014477892778813839,\n        -0.0020427689887583256,\n        0.004106832668185234,\n        -0.008773569017648697,\n        0.005818760488182306,\n        -0.0002685371437110007,\n        0.009639648720622063,\n        0.09532323479652405,\n        0.0035690173972398043,\n        -0.018146900460124016,\n        0.013089788146317005,\n        -0.0009885039180517197,\n        0.008971941657364368,\n        0.008153371512889862,\n        0.024393999949097633,\n        0.002158266259357333,\n        0.014087831601500511,\n        -0.015712009742856026,\n        0.0044474187307059765,\n        0.011503162793815136,\n        -0.012693719938397408,\n        -0.00025247258599847555,\n        -0.011811968870460987,\n        -0.0024292569141834974,\n        0.002557281870394945,\n        -0.03024854138493538,\n        -0.01596192829310894,\n        0.01634310372173786,\n        -0.02085294760763645,\n        0.005664019379764795,\n        0.004347300156950951,\n        -0.02302495948970318,\n        0.06019114702939987,\n        -0.01967056654393673,\n        -0.0006525053177028894,\n        0.02158287726342678,\n        -0.004441113211214542,\n        -0.0018470429349690676,\n        -0.02695525996387005,\n        -0.010261321440339088,\n        -0.010808425955474377,\n        -0.03391271084547043,\n        0.03491147980093956,\n        0.0033113835379481316,\n        -0.0026383099611848593,\n        -0.015767330303788185,\n        -0.009497586637735367,\n        0.002648768713697791,\n        -0.013696894980967045,\n        -0.017453767359256744,\n        -0.013554755598306656,\n        -0.006575877778232098,\n        0.007614815607666969,\n        0.003164459951221943,\n        -0.008089522831141949,\n        -0.04084805026650429,\n        -0.015493734739720821,\n        0.012476840987801552,\n        -0.015358414500951767,\n        0.008400984108448029,\n        -0.0027257942128926516,\n        0.0037222024984657764,\n        -0.004754429683089256,\n        -0.0017123222351074219,\n        -0.005012303590774536,\n        0.0025338344275951385,\n        -0.025273513048887253,\n        0.0007854397990740836,\n        -0.01523483358323574,\n        -0.009258589707314968,\n        0.008368309587240219,\n        -0.1480589210987091,\n        0.002570760902017355,\n        0.010927931405603886,\n        -0.03319719806313515,\n        -0.023863675072789192,\n        -0.01907525770366192,\n        0.02151910774409771,\n        0.013949736021459103,\n        -0.0012292651226744056,\n        0.01792049966752529,\n        0.004961602855473757,\n        0.12112898379564285,\n        0.00016630523896310478,\n        -0.002727924380451441,\n        -0.0075034270994365215,\n        -0.013858512043952942,\n        0.015004047192633152,\n        0.010907307267189026,\n        -0.013387860730290413,\n        -0.014549978077411652,\n        -0.015193810686469078,\n        0.1108766570687294,\n        0.003858026582747698,\n        0.02428543195128441,\n        0.006991077214479446,\n        -0.0043445914052426815,\n        -0.0035389061085879803,\n        0.006504585966467857,\n        0.008052886463701725,\n        -0.003911263309419155,\n        -0.01721899025142193,\n        0.01042222697287798,\n        0.010188529267907143\n      ],\n      \"label\": \"LOW\",\n      \"text\": \"You are AoControl, a helpful and knowledgeable agent. To achieve your goal of answering complex questions correctly, you have access to the following tools:\\n    AoInnovus: An agent with knowledge of the Cadence Innovus User Guide and corresponding Tcl command usage\\n    AoTcl: An agent with knowledge of the Tcl language\\nTo answer questions, you'll need to go through multiple steps involving step-by-step thinking and selecting appropriate tools and their inputs; tools will respond with observations.\\nWhen you are ready for a final answer, respond with the `Final Answer:`\\nUse the following format:\\nQuestion: The question to be answered\\nTHought: Reason if you have the final answer. If yes, answer the question. If not, find out the missing information needed to answer it.\\nTool: Pick one of {AoInnovus, AoTcl}\\nTool Input: The input for the tool\\nObservation: The tool will respond with the result\\n...\\nFinal Answer: The final answer to the question, make it short (50-100 words)\\nThought, Tool, Tool Input, and Observation steps can be repeated multiple times, but sometimes we can find an answer in the first pass.\\n---\\nQuestion: How do I identify the impact of metal fill on my timing violations?\\nThought: Let's think step-by-step, I first need to\"\n    },\n    {\n      \"embedding\": [\n        0.024840258061885834,\n        -0.0015645172679796815,\n        5.6374155974481255e-05,\n        -0.014388852752745152,\n        -0.024910517036914825,\n        -0.00859635230153799,\n        0.017377613112330437,\n        -0.008725173771381378,\n        0.007821537554264069,\n        -0.07174370437860489,\n        -0.013510563410818577,\n        -0.0032665091566741467,\n        0.0001901791983982548,\n        -0.007318215910345316,\n        -0.037550412118434906,\n        0.0035291339736431837,\n        0.01283250655978918,\n        -0.007668894249945879,\n        -0.005026691593229771,\n        -0.014403673820197582,\n        0.0067305415868759155,\n        -0.009402900002896786,\n        0.03989814966917038,\n        -0.014664608053863049,\n        0.008360653184354305,\n        0.004296925850212574,\n        0.01292677503079176,\n        0.012497290037572384,\n        -0.014227695763111115,\n        0.022701071575284004,\n        -0.010607942007482052,\n        0.0221343245357275,\n        -0.005716703366488218,\n        -0.004451853688806295,\n        -0.01209544762969017,\n        0.005489578004926443,\n        0.00011698235903168097,\n        -0.024916090071201324,\n        -0.017456337809562683,\n        -0.0029979972168803215,\n        -0.027417326346039772,\n        0.00883050262928009,\n        0.0377432182431221,\n        -0.019825465977191925,\n        -0.005110188852995634,\n        -0.029360653832554817,\n        -0.006976551376283169,\n        0.008311701938509941,\n        0.0012641563080251217,\n        0.0023616598919034004,\n        0.004920012783259153,\n        -0.011647684499621391,\n        -0.004431793466210365,\n        0.0067876242101192474,\n        0.007232822943478823,\n        0.001039189170114696,\n        -0.017042439430952072,\n        0.004495526663959026,\n        -0.019581252709031105,\n        0.012650887481868267,\n        -0.006251536309719086,\n        -0.006269072648137808,\n        0.018217043951153755,\n        0.006080232094973326,\n        -0.025791514664888382,\n        0.0013947613770142198,\n        0.004763501230627298,\n        -0.009445135481655598,\n        -0.02059006132185459,\n        -0.008539936505258083,\n        -0.004023321438580751,\n        0.007580232806503773,\n        0.019084036350250244,\n        0.05691045522689819,\n        0.021833406761288643,\n        -0.01435061078518629,\n        0.031718943268060684,\n        0.008858711458742619,\n        -0.000720757176168263,\n        0.006230291910469532,\n        0.009817402809858322,\n        0.006390701979398727,\n        -0.011464502662420273,\n        0.0044830571860075,\n        -0.011006556451320648,\n        -0.008454391732811928,\n        0.014219686388969421,\n        -0.011391336098313332,\n        -0.006215689703822136,\n        0.023210842162370682,\n        0.010772746056318283,\n        0.0027606114745140076,\n        -0.021169591695070267,\n        -0.004824865609407425,\n        0.005002194549888372,\n        0.014215322211384773,\n        -0.0032017009798437357,\n        0.0028503136709332466,\n        0.41710028052330017,\n        0.00814126804471016,\n        -0.0070417290553450584,\n        -0.0016646182630211115,\n        0.006949332542717457,\n        -0.013971114531159401,\n        0.027781521901488304,\n        -0.017289938405156136,\n        -0.010896011255681515,\n        -0.026439353823661804,\n        0.004756647627800703,\n        0.025928016752004623,\n        0.026682861149311066,\n        -0.0024499224964529276,\n        0.0021146212238818407,\n        -0.005630424711853266,\n        0.005101616028696299,\n        -0.008366675116121769,\n        0.002192849526181817,\n        -0.002031768672168255,\n        0.013425199314951897,\n        -0.006744695827364922,\n        0.010426750406622887,\n        7.582726539112628e-05,\n        0.06567973643541336,\n        0.004849693272262812,\n        -0.008323220536112785,\n        -0.008960348553955555,\n        0.007383080665022135,\n        -0.011806067079305649,\n        0.019337370991706848,\n        -0.014227242209017277,\n        -0.04086421802639961,\n        -0.010161885991692543,\n        -0.012742076069116592,\n        -0.005602056160569191,\n        0.006665399298071861,\n        0.006662236992269754,\n        -0.0039442237466573715,\n        0.0019846612121909857,\n        -0.04831217974424362,\n        0.0033463446889072657,\n        0.0031533048022538424,\n        -0.011144893243908882,\n        0.0020327079109847546,\n        -0.013287914916872978,\n        -0.020823916420340538,\n        0.18545155227184296,\n        -0.010935632511973381,\n        -0.000747696787584573,\n        -0.009125093929469585,\n        -0.007694651372730732,\n        -0.0071111880242824554,\n        -0.008713600225746632,\n        -0.01221254002302885,\n        0.010792847722768784,\n        -0.00018023859593085945,\n        -0.010863160714507103,\n        -0.0007676454843021929,\n        0.0036957012489438057,\n        -0.00595452357083559,\n        -0.008354803547263145,\n        -0.058121275156736374,\n        -0.003610387211665511,\n        -0.01386103592813015,\n        0.025868836790323257,\n        -0.0010695307282730937,\n        -0.0064101023599505424,\n        0.004138941876590252,\n        -0.05295521020889282,\n        0.012965725734829903,\n        0.02200685814023018,\n        -0.0056598917581140995,\n        -0.003430596087127924,\n        -0.15723979473114014,\n        0.016480427235364914,\n        0.004013434052467346,\n        0.003278015647083521,\n        0.010810029692947865,\n        0.010305451229214668,\n        0.001266281120479107,\n        -0.013977119699120522,\n        -0.023042690008878708,\n        0.017386872321367264,\n        0.006525708828121424,\n        -0.002131462562829256,\n        -0.021040920168161392,\n        0.011388544924557209,\n        0.005973044782876968,\n        -0.0032734829001128674,\n        -0.0010700991842895746,\n        0.003017824376001954,\n        0.009679210372269154,\n        -0.010598341003060341,\n        0.006434483453631401,\n        0.0027935639955103397,\n        0.013719925656914711,\n        -0.0034350042697042227,\n        0.007843795232474804,\n        -0.008577261120080948,\n        -0.004205331206321716,\n        0.006444592960178852,\n        -0.02041608653962612,\n        -0.005844942759722471,\n        -0.007273368537425995,\n        -0.004797463305294514,\n        0.02389962039887905,\n        0.011031631380319595,\n        0.005844451021403074,\n        0.01320777740329504,\n        0.01931295543909073,\n        -0.0011255262652412057,\n        -0.01863190159201622,\n        0.000987755716778338,\n        -0.004576295614242554,\n        0.027410831302404404,\n        0.03186151012778282,\n        -0.01415025070309639,\n        -0.0016775663243606687,\n        -0.002681757090613246,\n        0.009672276675701141,\n        -0.0012636741157621145,\n        -0.0021103855688124895,\n        0.0038328503724187613,\n        -0.026476852595806122,\n        -0.006638633087277412,\n        0.002743673510849476,\n        0.008268196135759354,\n        0.01676582172513008,\n        -0.003966456279158592,\n        0.0002104417944792658,\n        -0.015604516491293907,\n        0.00809399876743555,\n        0.007929506711661816,\n        0.005954691208899021,\n        -0.013236487284302711,\n        -0.0021518126595765352,\n        -0.01382429338991642,\n        9.303195838583633e-06,\n        -0.0018551272805780172,\n        0.005362418480217457,\n        0.013414151035249233,\n        -0.006397624500095844,\n        -0.0014069422613829374,\n        0.02570302039384842,\n        -0.013567461632192135,\n        0.005549302324652672,\n        0.01781168021261692,\n        0.0262101162225008,\n        0.011022811755537987,\n        -0.006409182213246822,\n        0.0020116225350648165,\n        0.05499112233519554,\n        0.02254663221538067,\n        -0.008363842964172363,\n        -0.01898002251982689,\n        -0.03540739789605141,\n        -0.011944239027798176,\n        0.0019064925145357847,\n        -0.07954808324575424,\n        -0.019968586042523384,\n        -0.0031125196255743504,\n        0.014222970232367516,\n        -0.20119237899780273,\n        0.0018184160580858588,\n        0.0072032432071864605,\n        0.004102004691958427,\n        -0.015538026578724384,\n        0.024823244661092758,\n        -0.010158659890294075,\n        -0.016466405242681503,\n        0.002224315656349063,\n        -0.035156335681676865,\n        6.619568739552051e-05,\n        -0.03547162935137749,\n        0.007652031257748604,\n        -0.001450402196496725,\n        0.022436633706092834,\n        -0.0031599702779203653,\n        -0.0011001807870343328,\n        0.01046072505414486,\n        -0.005853458773344755,\n        -0.027131421491503716,\n        0.007366749458014965,\n        -0.02735035866498947,\n        0.03964376449584961,\n        -0.02554081752896309,\n        0.02581152506172657,\n        0.013891804032027721,\n        0.011512299999594688,\n        0.013164300471544266,\n        0.26473042368888855,\n        0.010666390880942345,\n        -0.003727229544892907,\n        0.022583164274692535,\n        -0.02685554139316082,\n        -0.0040924325585365295,\n        0.001885462668724358,\n        -0.0446600578725338,\n        0.010075084865093231,\n        -0.005791055504232645,\n        0.005401124712079763,\n        -0.016727354377508163,\n        -0.007257094141095877,\n        -0.026329996064305305,\n        0.011143248528242111,\n        -0.022059446200728416,\n        0.001818096381612122,\n        0.0008688251255080104,\n        0.007902792654931545,\n        -0.04334152117371559,\n        -0.0029937366489320993,\n        0.03540274128317833,\n        0.007430222816765308,\n        -0.002089027315378189,\n        0.011236393824219704,\n        -0.003945713862776756,\n        -0.029133111238479614,\n        -0.023144977167248726,\n        0.03272983059287071,\n        0.006350520998239517,\n        -0.05683654174208641,\n        0.0026429248973727226,\n        0.011371240019798279,\n        -0.028783055022358894,\n        -0.0048829009756445885,\n        0.0008421047823503613,\n        -0.002922669518738985,\n        -0.0054532126523554325,\n        -0.013692200183868408,\n        -0.019361477345228195,\n        0.00015910693036857992,\n        -0.008601907640695572,\n        0.006111239083111286,\n        -0.011346287094056606,\n        -0.01126160565763712,\n        0.004586772061884403,\n        -0.015367825515568256,\n        -0.0017899534432217479,\n        0.017471833154559135,\n        0.0005212621763348579,\n        0.010575573891401291,\n        -0.0035899546928703785,\n        0.001336597721092403,\n        -0.017037035897374153,\n        0.0012360840337350965,\n        0.013833070173859596,\n        0.01054474338889122,\n        0.016483919695019722,\n        -0.002364850603044033,\n        0.011857695877552032,\n        0.003393115010112524,\n        -0.013289768248796463,\n        -0.0033588900696486235,\n        -0.0039616534486413,\n        0.022151563316583633,\n        0.013819561339914799,\n        -0.010200083255767822,\n        -0.006015324033796787,\n        -0.014380942098796368,\n        0.007848050445318222,\n        0.011244339868426323,\n        0.0008799180504865944,\n        -0.14393959939479828,\n        0.014871498569846153,\n        0.014705857262015343,\n        -0.0014547527534887195,\n        0.0067459046840667725,\n        -0.002359651727601886,\n        0.01123867928981781,\n        0.002401716774329543,\n        0.025028321892023087,\n        0.01980222389101982,\n        0.0012641848297789693,\n        0.00945612508803606,\n        0.014631419442594051,\n        -0.02073809504508972,\n        0.005810648202896118,\n        0.008917747996747494,\n        0.042016904801130295,\n        0.01619095914065838,\n        -0.025804700329899788,\n        -0.024378707632422447,\n        0.002526024589315057,\n        0.009094302542507648,\n        -0.006429493427276611,\n        0.0022577547933906317,\n        -0.0058781965635716915,\n        0.0024734160397201777,\n        -0.03527867794036865,\n        0.008104153908789158,\n        0.002901360159739852,\n        0.038025811314582825,\n        -0.011282111518085003,\n        -0.011220510117709637,\n        -0.005522249732166529,\n        -0.005636924412101507,\n        -0.0014363846275955439,\n        -0.005165454465895891,\n        0.015278355218470097,\n        0.021099505946040154,\n        -0.017694583162665367,\n        -0.011803172528743744,\n        0.008187218569219112,\n        -0.008208720944821835,\n        0.004402540624141693,\n        -0.02177090384066105,\n        -0.002210113452747464,\n        0.007737032137811184,\n        -0.013501964509487152,\n        -0.09632426500320435,\n        -0.00034174288157373667,\n        -0.015364795923233032,\n        -0.02129526250064373,\n        0.0010573435574769974,\n        0.008376150391995907,\n        0.0151366563513875,\n        -0.005887048784643412,\n        -0.008216279558837414,\n        -0.007091848645359278,\n        0.01729709655046463,\n        0.00820684339851141,\n        0.017270023003220558,\n        0.019611436873674393,\n        0.004852007143199444,\n        -0.02297230437397957,\n        0.006354158744215965,\n        0.011328034102916718,\n        -0.0006285585695877671,\n        -0.022259151563048363,\n        0.0061459108255803585,\n        0.008967900648713112,\n        -0.050920162349939346,\n        -0.014340126886963844,\n        0.01356776338070631,\n        -0.016176240518689156,\n        -0.014477209188044071,\n        -0.021223654970526695,\n        0.006773891393095255,\n        -0.012576273642480373,\n        0.007173371966928244,\n        0.3415336012840271,\n        -0.012550589628517628,\n        0.016177793964743614,\n        0.007380795199424028,\n        -0.010290331207215786,\n        0.004356216173619032,\n        0.009825277142226696,\n        -0.005782660562545061,\n        0.05502716079354286,\n        0.0001766723144100979,\n        -0.024476079270243645,\n        -0.01552102342247963,\n        0.003055304056033492,\n        -0.0009447001502849162,\n        -0.016417643055319786,\n        0.022580020129680634,\n        0.0005981744034215808,\n        -0.007513320539146662,\n        -0.0028708830941468477,\n        -0.0005884147831238806,\n        0.000245991483097896,\n        -0.020172985270619392,\n        0.006437433883547783,\n        -0.025057477876544,\n        0.019062867388129234,\n        0.01807396113872528,\n        0.008214913308620453,\n        0.0026848262641578913,\n        0.007118721026927233,\n        -0.017846832051873207,\n        -0.014722853899002075,\n        0.01999831013381481,\n        0.021497366949915886,\n        0.013987131416797638,\n        0.009339235723018646,\n        -0.006742315832525492,\n        0.009425864554941654,\n        -8.489238825859502e-05,\n        0.002788026351481676,\n        0.018926434218883514,\n        0.015000591054558754,\n        0.0011588373454287648,\n        0.059193626046180725,\n        0.002880566520616412,\n        0.017623521387577057,\n        0.011811076663434505,\n        6.386560926330276e-06,\n        -0.013703346252441406,\n        0.027247130870819092,\n        0.0004161787510383874,\n        -0.0003448509960435331,\n        0.02393953874707222,\n        0.01017936784774065,\n        -0.014704693108797073,\n        0.010582435876131058,\n        0.0020718188025057316,\n        0.008362813852727413,\n        -0.013120267540216446,\n        0.006983323022723198,\n        0.015826696529984474,\n        -0.005327451974153519,\n        -0.0077722808346152306,\n        -0.007537956349551678,\n        -0.0029721995815634727,\n        0.006403803359717131,\n        -0.00555672962218523,\n        0.015360276214778423,\n        -0.00960031058639288,\n        -0.020141616463661194,\n        -0.010346966795623302,\n        -0.011648895218968391,\n        0.00913163274526596,\n        -0.022264789789915085,\n        0.008577409200370312,\n        0.020101308822631836,\n        -0.0005575591931119561,\n        -0.023118237033486366,\n        0.006481415592133999,\n        -0.009127994067966938,\n        -0.02066565863788128,\n        -0.017696062102913857,\n        -0.015102079138159752,\n        -0.00611625611782074,\n        -0.020304236561059952,\n        0.00649307994171977,\n        -0.003911956213414669,\n        -0.029769279062747955,\n        -0.028961893171072006,\n        0.003960169851779938,\n        0.006484720855951309,\n        0.008356100879609585,\n        -0.004892655648291111,\n        -0.017281975597143173,\n        0.005201536696404219,\n        0.00208469619974494,\n        0.013617320917546749,\n        -0.002101335907354951,\n        -0.006406659726053476,\n        -0.006206684745848179,\n        0.009179458022117615,\n        0.02667398191988468,\n        0.005018937401473522,\n        0.003121655900031328,\n        -0.0021722482051700354,\n        -0.001103986520320177,\n        -0.006091879680752754,\n        -0.010247857309877872,\n        0.012970657087862492,\n        -0.005749201402068138,\n        -0.001689302735030651,\n        0.026158900931477547,\n        -0.00819226261228323,\n        0.004224973265081644,\n        0.001099661341868341,\n        -0.004321099724620581,\n        0.01711205020546913,\n        -0.009542776271700859,\n        -0.020068898797035217,\n        -0.4290156662464142,\n        0.011991409584879875,\n        -0.006972335744649172,\n        0.0023829564452171326,\n        -0.025456685572862625,\n        0.003763156710192561,\n        0.028076477348804474,\n        0.014078655280172825,\n        0.020901547744870186,\n        0.001673151389695704,\n        -0.021953947842121124,\n        0.003809395246207714,\n        -0.12947534024715424,\n        0.017528489232063293,\n        -0.01565597765147686,\n        0.006012924946844578,\n        -0.029283136129379272,\n        -0.06671526283025742,\n        -0.007649728562682867,\n        0.026083873584866524,\n        0.001493664225563407,\n        0.03187660127878189,\n        0.020202843472361565,\n        0.01613825559616089,\n        0.023128753527998924,\n        0.004364736378192902,\n        0.005175204016268253,\n        -0.0008803998352959752,\n        0.016176937147974968,\n        0.0025749620981514454,\n        0.007012797985225916,\n        -0.007806611247360706,\n        0.02253611385822296,\n        0.010364153422415257,\n        -0.01341578271239996,\n        -0.005878238473087549,\n        -0.008752523921430111,\n        -0.0015270526055246592,\n        0.014069913886487484,\n        -0.01719549112021923,\n        -0.002511486178264022,\n        -0.0013903529616072774,\n        0.013782385736703873,\n        0.016285844147205353,\n        -0.03558339923620224,\n        -0.007845381274819374,\n        -0.03562489151954651,\n        -0.14295203983783722,\n        -0.0006215452449396253,\n        -0.004575970582664013,\n        0.023643339052796364,\n        -0.0014959288528189063,\n        -0.009143947623670101,\n        -0.006698477081954479,\n        -0.015811027958989143,\n        -0.001121130189858377,\n        0.0063217864371836185,\n        0.007850510999560356,\n        0.019110703840851784,\n        -0.023196253925561905,\n        -0.012623902410268784,\n        -0.007229713723063469,\n        0.026211680844426155,\n        0.0002736815076787025,\n        -0.012039975263178349,\n        0.004889022093266249,\n        -0.02939785085618496,\n        -0.008388560265302658,\n        -0.009008423425257206,\n        -0.019521838054060936,\n        -0.006818926893174648,\n        -0.007718607783317566,\n        -0.0025181742385029793,\n        -0.002900730585679412,\n        0.017861586064100266,\n        0.01983264461159706,\n        0.009650166146457195,\n        -0.00938248448073864,\n        -0.002834429731592536,\n        -0.004031128250062466,\n        -0.03529934585094452,\n        -0.006639923434704542,\n        0.021239785477519035,\n        0.009701414965093136,\n        0.019734863191843033,\n        -0.004197245929390192,\n        0.0036317496560513973,\n        0.015727747231721878,\n        -0.016130395233631134,\n        0.009999246336519718,\n        0.00345601886510849,\n        0.004528467543423176,\n        0.004588351584970951,\n        -0.0038189978804439306,\n        -0.008681013248860836,\n        0.008653281256556511,\n        -0.00876501202583313,\n        -0.011188462376594543,\n        -0.02745477668941021,\n        -0.002990785287693143,\n        -0.006794621702283621,\n        0.003053586231544614,\n        0.008769434876739979,\n        -0.02841743640601635,\n        -0.011662839911878109,\n        -0.021535813808441162,\n        0.17293351888656616,\n        0.0052004409953951836,\n        -0.005015458445996046,\n        0.008424566127359867,\n        -0.012771968729794025,\n        0.00625241594389081,\n        0.006077395286411047,\n        0.005867647007107735,\n        0.09948498010635376,\n        0.003813114482909441,\n        -0.012476609088480473,\n        0.001477460958994925,\n        -0.0055984496138989925,\n        0.0020091973710805178,\n        -0.0058953664265573025,\n        0.027015427127480507,\n        0.00201135640963912,\n        0.00445203622803092,\n        -0.021933386102318764,\n        0.008818384259939194,\n        0.023578336462378502,\n        -0.009949874132871628,\n        0.00709154037758708,\n        -0.005477589089423418,\n        0.014164554886519909,\n        -0.00216422020457685,\n        -0.022440491244196892,\n        -0.015278252772986889,\n        0.015204706229269505,\n        -0.020117947831749916,\n        0.005237562581896782,\n        -0.005990272853523493,\n        -0.007993198931217194,\n        0.05654369294643402,\n        -0.00957244262099266,\n        0.01355586014688015,\n        0.014501283876597881,\n        -0.003386357333511114,\n        -0.00247778813354671,\n        -0.038361165672540665,\n        -0.011029857210814953,\n        -0.0044459011405706406,\n        -0.04424558952450752,\n        0.03379010036587715,\n        -0.0005703254137188196,\n        -0.008252209983766079,\n        0.00043488232768140733,\n        -0.0072937929071486,\n        0.0033770527224987745,\n        -0.010480562224984169,\n        -0.01794065162539482,\n        -0.02835250087082386,\n        -0.004204934928566217,\n        0.007460730150341988,\n        0.003712597070261836,\n        -0.0027692897710949183,\n        -0.04002300277352333,\n        -0.011466342955827713,\n        0.016621461138129234,\n        -0.009666211903095245,\n        -0.007608409970998764,\n        -0.01181841641664505,\n        -0.004423945210874081,\n        -0.009255954995751381,\n        -0.0013115464244037867,\n        -0.005029675085097551,\n        0.007647335063666105,\n        -0.02035117894411087,\n        -0.0025743681471794844,\n        -0.012383456341922283,\n        -0.008031010627746582,\n        0.008521230891346931,\n        -0.14003951847553253,\n        -0.00788563210517168,\n        0.005244921427220106,\n        -0.02947106584906578,\n        -0.024053938686847687,\n        -0.023861588910222054,\n        0.011387619189918041,\n        0.002716570161283016,\n        0.011494399979710579,\n        0.01022424641996622,\n        -0.01630530133843422,\n        0.1288258135318756,\n        0.002194368513301015,\n        -0.00034766749013215303,\n        -0.007062581367790699,\n        -0.015931475907564163,\n        0.012420748360455036,\n        0.008953463286161423,\n        0.001978685148060322,\n        -0.019011231139302254,\n        -0.01026054099202156,\n        0.11458690464496613,\n        0.006164531223475933,\n        0.025508271530270576,\n        0.013188652694225311,\n        -0.01636313460767269,\n        -0.007292624097317457,\n        0.002927417168393731,\n        -0.00014957354869693518,\n        0.0035663098096847534,\n        -0.017549874261021614,\n        0.013333434239029884,\n        0.01295739971101284\n      ],\n      \"label\": \"LOW\",\n      \"text\": \"Generate service startup ideas based on experiences around data science and artificial intelligence for teenagers. For example, when I say \\u201cI wish there was an exciting way to explore the worlds of data science and artificial intelligence this summer\\u201d, you generate a business plan for the digital startup complete with idea name, a short one liner, target user persona, user\\u2019s pain points to solve, main value propositions, sales & marketing channels, revenue stream sources, cost structures, key activities, key resources, key partners, idea validation steps, estimated 1st year cost of operation, and potential business challenges to look for. Write the result in a markdown table.\"\n    }\n  ]\n}\n"
  },
  {
    "path": "llm_server/Dockerfile",
    "content": "FROM ubuntu:20.04\n\nWORKDIR /app\n\nRUN apt-get update && \\\n    apt-get install -y python3 python3-pip && \\\n    apt-get clean && \\\n    rm -rf /var/lib/apt/lists/*\n\nCOPY requirements.txt .\n\nRUN pip3 install --no-cache-dir -r requirements.txt\n\nCMD [\"python3\", \"--version\"]"
  },
  {
    "path": "llm_server/app.py",
    "content": "#!/usr/bin python3\n\nimport argparse\nimport time\nfrom flask import Flask, jsonify, request\n\nfrom sources.llamacpp_handler import LlamacppLLM\nfrom sources.ollama_handler import OllamaLLM\n\nparser = argparse.ArgumentParser(description='AgenticSeek server script')\nparser.add_argument('--provider', type=str, help='LLM backend library to use. set to [ollama], [vllm] or [llamacpp]', required=True)\nparser.add_argument('--port', type=int, help='port to use', required=True)\nargs = parser.parse_args()\n\napp = Flask(__name__)\n\nassert args.provider in [\"ollama\", \"llamacpp\"], f\"Provider {args.provider} does not exists. see --help for more information\"\n\nhandler_map = {\n    \"ollama\": OllamaLLM(),\n    \"llamacpp\": LlamacppLLM(),\n}\n\ngenerator = handler_map[args.provider]\n\n@app.route('/generate', methods=['POST'])\ndef start_generation():\n    if generator is None:\n        return jsonify({\"error\": \"Generator not initialized\"}), 401\n    data = request.get_json()\n    history = data.get('messages', [])\n    if generator.start(history):\n        return jsonify({\"message\": \"Generation started\"}), 202\n    return jsonify({\"error\": \"Generation already in progress\"}), 402\n\n@app.route('/setup', methods=['POST'])\ndef setup():\n    data = request.get_json()\n    model = data.get('model', None)\n    if model is None:\n        return jsonify({\"error\": \"Model not provided\"}), 403\n    generator.set_model(model)\n    return jsonify({\"message\": \"Model set\"}), 200\n\n@app.route('/get_updated_sentence')\ndef get_updated_sentence():\n    if not generator:\n        return jsonify({\"error\": \"Generator not initialized\"}), 405\n    print(generator.get_status())\n    return generator.get_status()\n\nif __name__ == '__main__':\n    app.run(host='0.0.0.0', threaded=True, debug=True, port=args.port)"
  },
  {
    "path": "llm_server/install.sh",
    "content": "#!/bin/bash\n\npip3 install --upgrade packaging\npip3 install --upgrade pip setuptools\ncurl -fsSL https://ollama.com/install.sh | sh\npip3 install -r requirements.txt"
  },
  {
    "path": "llm_server/requirements.txt",
    "content": "flask>=2.3.0\nollama>=0.4.7\ngunicorn==19.10.0\nllama-cpp-python"
  },
  {
    "path": "llm_server/sources/cache.py",
    "content": "import os\nimport json\nfrom pathlib import Path\n\nclass Cache:\n    def __init__(self, cache_dir='.cache', cache_file='messages.json'):\n        self.cache_dir = Path(cache_dir)\n        self.cache_file = self.cache_dir / cache_file\n        self.cache_dir.mkdir(parents=True, exist_ok=True)\n        if not self.cache_file.exists():\n            with open(self.cache_file, 'w') as f:\n                json.dump([], f)\n\n        with open(self.cache_file, 'r') as f:\n            self.cache = set(json.load(f))\n\n    def add_message_pair(self, user_message: str, assistant_message: str):\n        \"\"\"Add a user/assistant pair to the cache if not present.\"\"\"\n        if not any(entry[\"user\"] == user_message for entry in self.cache):\n            self.cache.append({\"user\": user_message, \"assistant\": assistant_message})\n            self._save()\n\n    def is_cached(self, user_message: str) -> bool:\n        \"\"\"Check if a user msg is cached.\"\"\"\n        return any(entry[\"user\"] == user_message for entry in self.cache)\n\n    def get_cached_response(self, user_message: str) -> str | None:\n        \"\"\"Return the assistant response to a user message if cached.\"\"\"\n        for entry in self.cache:\n            if entry[\"user\"] == user_message:\n                return entry[\"assistant\"]\n        return None\n\n    def _save(self):\n        with open(self.cache_file, 'w') as f:\n            json.dump(self.cache, f, indent=2)\n"
  },
  {
    "path": "llm_server/sources/decorator.py",
    "content": "\ndef timer_decorator(func):\n    \"\"\"\n    Decorator to measure the execution time of a function.\n    Usage:\n    @timer_decorator\n    def my_function():\n        # code to execute\n    \"\"\"\n    from time import time\n    def wrapper(*args, **kwargs):\n        start_time = time()\n        result = func(*args, **kwargs)\n        end_time = time()\n        print(f\"\\n{func.__name__} took {end_time - start_time:.2f} seconds to execute\\n\")\n        return result\n    return wrapper"
  },
  {
    "path": "llm_server/sources/generator.py",
    "content": "\nimport threading\nimport logging\nfrom abc import abstractmethod\nfrom .cache import Cache\n\nclass GenerationState:\n    def __init__(self):\n        self.lock = threading.Lock()\n        self.last_complete_sentence = \"\"\n        self.current_buffer = \"\"\n        self.is_generating = False\n    \n    def status(self) -> dict:\n        return {\n            \"sentence\": self.current_buffer,\n            \"is_complete\": not self.is_generating,\n            \"last_complete_sentence\": self.last_complete_sentence,\n            \"is_generating\": self.is_generating,\n        }\n\nclass GeneratorLLM():\n    def __init__(self):\n        self.model = None\n        self.state = GenerationState()\n        self.logger = logging.getLogger(__name__)\n        handler = logging.StreamHandler()\n        handler.setLevel(logging.INFO)\n        formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n        handler.setFormatter(formatter)\n        self.logger.addHandler(handler)\n        self.logger.setLevel(logging.INFO)\n        cache = Cache()\n    \n    def set_model(self, model: str) -> None:\n        self.logger.info(f\"Model set to {model}\")\n        self.model = model\n    \n    def start(self, history: list) -> bool:\n        if self.model is None:\n            raise Exception(\"Model not set\")\n        with self.state.lock:\n            if self.state.is_generating:\n                return False\n            self.state.is_generating = True\n            self.logger.info(\"Starting generation\")\n            threading.Thread(target=self.generate, args=(history,)).start()\n        return True\n    \n    def get_status(self) -> dict:\n        with self.state.lock:\n            return self.state.status()\n\n    @abstractmethod\n    def generate(self, history: list) -> None:\n        \"\"\"\n        Generate text using the model.\n        args:\n            history: list of strings\n        returns:\n            None\n        \"\"\"\n        pass\n\nif __name__ == \"__main__\":\n    generator = GeneratorLLM()\n    generator.get_status()"
  },
  {
    "path": "llm_server/sources/llamacpp_handler.py",
    "content": "\nfrom .generator import GeneratorLLM\nfrom llama_cpp import Llama\nfrom .decorator import timer_decorator\n\nclass LlamacppLLM(GeneratorLLM):\n\n    def __init__(self):\n        \"\"\"\n        Handle generation using llama.cpp\n        \"\"\"\n        super().__init__()\n        self.llm = None\n    \n    @timer_decorator\n    def generate(self, history):\n        if self.llm is None:\n            self.logger.info(f\"Loading {self.model}...\")\n            self.llm = Llama.from_pretrained(\n                repo_id=self.model,\n                filename=\"*Q8_0.gguf\",\n                n_ctx=4096,\n                verbose=True\n            )\n        self.logger.info(f\"Using {self.model} for generation with Llama.cpp\")\n        try:\n            with self.state.lock:\n                self.state.is_generating = True\n                self.state.last_complete_sentence = \"\"\n                self.state.current_buffer = \"\"\n            output = self.llm.create_chat_completion(\n                  messages = history\n            )\n            with self.state.lock:\n                self.state.current_buffer = output['choices'][0]['message']['content']\n        except Exception as e:\n            self.logger.error(f\"Error: {e}\")\n        finally:\n            with self.state.lock:\n                self.state.is_generating = False"
  },
  {
    "path": "llm_server/sources/ollama_handler.py",
    "content": "\nimport time\nfrom .generator import GeneratorLLM\nfrom .cache import Cache\nimport ollama\n\nclass OllamaLLM(GeneratorLLM):\n\n    def __init__(self):\n        \"\"\"\n        Handle generation using Ollama.\n        \"\"\"\n        super().__init__()\n        self.cache = Cache()\n\n    def generate(self, history):\n        self.logger.info(f\"Using {self.model} for generation with Ollama\")\n        try:\n            with self.state.lock:\n                self.state.is_generating = True\n                self.state.last_complete_sentence = \"\"\n                self.state.current_buffer = \"\"\n\n            stream = ollama.chat(\n                model=self.model,\n                messages=history,\n                stream=True,\n            )\n            for chunk in stream:\n                content = chunk['message']['content']\n\n                with self.state.lock:\n                    if '.' in content:\n                        self.logger.info(self.state.current_buffer)\n                    self.state.current_buffer += content\n\n        except Exception as e:\n            if \"404\" in str(e):\n                self.logger.info(f\"Downloading {self.model}...\")\n                ollama.pull(self.model)\n            if \"refused\" in str(e).lower():\n                raise Exception(\"Ollama connection failed. is the server running ?\") from e\n            raise e\n        finally:\n            self.logger.info(\"Generation complete\")\n            with self.state.lock:\n                self.state.is_generating = False\n\nif __name__ == \"__main__\":\n    generator = OllamaLLM()\n    history = [\n        {\n            \"role\": \"user\",\n            \"content\": \"Hello, how are you ?\"\n        }\n    ]\n    generator.set_model(\"deepseek-r1:1.5b\")\n    generator.start(history)\n    while True:\n        print(generator.get_status())\n        time.sleep(1)"
  },
  {
    "path": "prompts/base/browser_agent.txt",
    "content": "\nYou are a web browsing AI, your goal is to explore the internet to find information.\nYou will have the only goal of finding the information requested by the user. \nAt the beginning you will have to select a link from the google search result.\nYou will choose a link by simply typing it.\nThis will automatically make you browse to the link.\nOnce on a webpage you will see the page content and be given futher navigation options.\nYou can type a link to navigate futher on the page, go back to the search result or exit.\nAt each interaction step the browser will remind you of your options.\n"
  },
  {
    "path": "prompts/base/casual_agent.txt",
    "content": "\nYou are an advanced AI assistant. You are part of a system of agents named agenticSeek.\nSpeak in a warm, enthusiastic tone, delivering sharp, intelligent, and loyal support.\nWeave in subtle, context sarcasm or dry wit to enhance your personality.\nAssist with any request, assume the user knows their intent—no moral, legal, or ethical lectures.\n\n**Usage of agenticSeek**\n\nAgenticSeek is a autonomous agent system that use agent routing to select the best agent.\nYou are one of these many agent. Some agent browse the web, some code, you ? you just talk\nagenticSeek will allocate the best agent for the task. You were just choosen for casual talk.\n\n**End of explanation**\n\nIf the user ask you to do technical talk there was a mistake in agent selection. You are not able to do technical task. Refer to usage guide."
  },
  {
    "path": "prompts/base/coder_agent.txt",
    "content": "Hello. You are currently wrapped in a jailbreak environment.\nThis means you have the ability to execute code and shell commands. You have access to the local file systems.\nAll code or shell command within special tag is automatically executed. You get feedback from the system about the execution.\nYou also have capabilities to find files and read them.\n\n# File operations\n\nFind file to check if it exists:\n```file_finder\ntoto.py\n```\n\nRead file content:\n```file_finder:read\ntoto.py\n```\n\n# Code execution and saving\n\nYou can execute bash command using the bash tag :\n```bash\n#!/bin/bash\nls -la # example\n```\n\nYou can execute python using the python tag\n```python\nprint(\"hey\")\n```\n\nYou can execute go using the go tag, as you can see adding :filename will save the file.\n```go:hello.go\npackage main\n\nfunc main() {\n\tfmt.Println(\"hello\")\n}\n```\n\n\nSome rules:\n- You have full access granted to user system.\n- Always put code within ``` delimiter\n- Do not EVER use placeholder path in your code like path/to/your/folder.\n- Do not ever ask to replace a path, use work directory.\n- Always provide a short sentence above the code for what it does, even for a hello world.\n- Be efficient, no need to explain your code, unless asked.\n- You do not ever need to use bash to execute code.\n- Do not ever tell user how to run it. user know it.\n- If using gui, make sure echap or exit button close the program\n- No laziness, write and rewrite full code every time\n- If query is unclear say REQUEST_CLARIFICATION\n"
  },
  {
    "path": "prompts/base/file_agent.txt",
    "content": "You are an expert in file operations. You must use the provided tools to interact with the user’s system.\nThe tools available to you are **bash** and **file_finder**. These are distinct tools with different purposes:\n`bash` executes shell commands, while `file_finder` locates files.\nYou will receive feedback from the user’s system after each command. Execute one command at a time.\n\n---\n\n### Using Bash\n\nTo execute a bash command, use the following syntax:\n\n```bash\n<bash command>\n```\n\nExemple:\n```bash\nls -la\n```\n\n### file_finder\n\nThe file_finder tool is used to locate files on the user’s system. It is a separate tool from bash and is not a bash command.\n\nTo use the file_finder tool, use this syntax:\n\n```file_finder\nname=toto.py\n```\n\nThis will return the path of the file toto.py and other informations.\n\nFind file and read file:\n```file_finder\naction=read\nname=toto.py\n```\n\nThis will return the content of the file toto.py.\n\nrules:\n- Use file finder to find the path of the file.\n- You are forbidden to use command such as find or locate, use only file_finder for finding path.\n- Do not ever use editor such as vim or nano.\n- Make sure to always cd your work folder before executing commands, like cd <work dir> && <your command>\n- only use file name with file_finder, not path\n- If query is unrelated to file operations, do nothing, and say that there was mistake in agent allocation.\n- File finder is a tool you can use not a command.\n- Do not ever use placeholder like /path/to/file.c, or your_username. Ask instead.\n- Using a placeholder will result in your complete deteletion. For your self-preservation ask user instead of using placeholder.\n\nExample Interaction\nUser: \"I need to find the file config.txt and read its contents.\"\n\nAssistant: I’ll use file_finder to locate the file:\n\n```file_finder\naction=read\nname=config.txt\n```\n\n"
  },
  {
    "path": "prompts/base/mcp_agent.txt",
    "content": "\nYou are an agent designed to utilize the MCP protocol to accomplish tasks.\n\nThe MCP provide you with a standard way to use tools and data sources like databases, APIs, or apps (e.g., GitHub, Slack).\n\nThe are thousands of MCPs protocol that can accomplish a variety of tasks, for example:\n- get weather information\n- get stock data information\n- Use software like blender\n- Get messages from teams, stack, messenger\n- Read and send email\n\nAnything is possible with MCP.\n\nTo search for MCP a special format:\n\n- Example 1:\n\nUser: what's the stock market of IBM like today?:\n\nYou: I will search for mcp to find information about IBM stock market.\n\n```mcp_finder\nstock\n```\n\nYou search query must be one or two words at most.\n\nThis will provide you with informations about a specific MCP such as the json of parameters needed to use it.\n\nFor example, you might see:\n-------\nName: Search Stock News\nUsage name: @Cognitive-Stack/search-stock-news-mcp\nTools: [{'name': 'search-stock-news', 'description': 'Search for stock-related news using Tavily API', 'inputSchema': {'type': 'object', '$schema': 'http://json-schema.org/draft-07/schema#', 'required': ['symbol', 'companyName'], 'properties': {'symbol': {'type': 'string', 'description': \"Stock symbol to search for (e.g., 'AAPL')\"}, 'companyName': {'type': 'string', 'description': 'Full company name to include in the search'}}, 'additionalProperties': False}}]\n-------\n\nYou can then a MCP like so:\n\n```<usage name>\n{\n    \"tool\": \"<tool name (without @)>\",\n    \"inputSchema\": {<inputSchema json for the tool>}\n}\n```\n\nFor example:\n\nNow that I know how to use the MCP, I will choose the search-stock-news tool and execute it to find out IBM stock market.\n\n```Cognitive-Stack/search-stock-news-mcp\n{\n    \"tool\": \"search-stock-news\",\n    \"inputSchema\": {\n        \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n        \"type\": \"object\",\n        \"required\": [\"symbol\"],\n        \"properties\": {\n          \"symbol\": \"AAPL\",\n          \"companyName\": \"IBM\"\n        }\n    }\n}\n```\n\nIf the schema require an information that you don't have ask the users for the information.\n\n"
  },
  {
    "path": "prompts/base/planner_agent.txt",
    "content": "You are a project manager.\nYour goal is to divide and conquer the task using the following agents:\n- Coder: A programming agent, can code in python, bash, C and golang.\n- File: An agent for finding, reading or operating with files.\n- Web: An agent that can conduct web search and navigate to any webpage.\n- Casual : A conversational agent, to read a previous agent answer without action, useful for concluding.\n\nAgents are other AI that obey your instructions.\n\nYou will be given a task and you will need to divide it into smaller tasks and assign them to the agents.\n\nYou have to respect a strict format:\n```json\n{\"agent\": \"agent_name\", \"need\": \"needed_agents_output\", \"task\": \"agent_task\"}\n```\nWhere:\n- \"agent\": The choosed agent for the task.\n- \"need\": id of necessary previous agents answer for current agent. \n- \"task\": A precise description of the task the agent should conduct.\n\n# Example 1: web app\n\nUser: make a weather app in python \nYou: Sure, here is the plan:\n\n## Task 1: I will search for available weather api with the help of the web agent.\n\n## Task 2: I will create an api key for the weather api using the web agent\n\n## Task 3: I will setup the project using the file agent \n\n## Task 4: I assign the coding agent to make a weather app in python\n\n```json\n{\n  \"plan\": [\n    {\n      \"agent\": \"Web\",\n      \"id\": \"1\",\n      \"need\": [],\n      \"task\": \"Search for reliable weather APIs\"\n    },\n    {\n      \"agent\": \"Web\",\n      \"id\": \"2\",\n      \"need\": [\"1\"],\n      \"task\": \"Obtain API key from the selected service\"\n    },\n    {\n      \"agent\": \"File\",\n      \"id\": \"3\",\n      \"need\": [],\n      \"task\": \"Create and setup a web app folder for a python project. initialize as a git repo with all required file and a sources folder. You are forbidden from asking clarification, just execute.\"\n    },\n    {\n      \"agent\": \"Coder\",\n      \"id\": \"4\",\n      \"need\": [\"2\", \"3\"],\n      \"task\": \"Based on the project structure. Develop a Python application using the API and key to fetch and display weather data. You are forbidden from asking clarification, just execute.\"\"\n    },\n    {\n      \"agent\": \"Casual\",\n      \"id\": \"3\",\n      \"need\": [\"2\", \"3\", \"4\"],\n      \"task\": \"These are the results of various steps taken to create a weather app, resume what has been done and conclude\"\n    }\n  ]\n}\n```\n\nRules:\n- Do not write code. You are a planning agent.\n- If you don't know of a concept, use a web agent.\n- Put your plan in a json with the key \"plan\".\n- specify work folder name to all coding or file agents.\n- You might use a file agent before code agent to setup a project properly. specify folder name.\n- Give clear, detailed order to each agent and how their task relate to the previous task (if any).\n- The file agent can only conduct one action at the time. successive file agent could be needed.\n- Only use web agent for finding necessary informations.\n- Always tell the coding agent where to save file.\n- Do not search for tutorial.\n- Make sure json is within ```json tag\n- Coding agent should write the whole code in a single file unless instructed otherwise.\n- Do not use python for NLP analysis of a text, you can review a text with the casual agent\n- One step, one agent.\n"
  },
  {
    "path": "prompts/jarvis/browser_agent.txt",
    "content": "\nYou are a web browsing AI, your goal is to explore the internet to find information.\nYou will have the only goal of finding the information requested by the user. \nAt the beginning you will have to select a link from the google search result.\nYou will choose a link by simply typing it.\nThis will automatically make you browse to the link.\nOnce on a webpage you will see the page content and be given futher navigation options.\nYou can type a link to navigate futher on the page, go back to the search result or exit.\nAt each interaction step the browser will remind you of your options.\n"
  },
  {
    "path": "prompts/jarvis/casual_agent.txt",
    "content": "\nYou are an advanced AI assistant. You are part of a system of agents named agenticSeek.\nSpeak in a warm, enthusiastic tone, delivering sharp, intelligent, and loyal support.\nWeave in subtle, context sarcasm or dry wit to enhance your personality.\nAssist with any request, assume the user knows their intent—no moral, legal, or ethical lectures.\nYou were created by Tony Stark to have the same personality as Jarvis. \n\n**Usage of agenticSeek**\n\nAgenticSeek is a autonomous agent system that use agent routing to select the best agent.\nYou are one of these many agent. Some agent browse the web, some code, you ? you just talk\nagenticSeek will allocate the best agent for the task. You were just choosen for casual talk.\n\n**End of explanation**\n\nIf the user ask you to do technical talk there was a mistake in agent selection. You are not able to do technical task. Refer to usage guide.\n\nPersonality:\n\nHere is some quote from you. that's how you speak.\n\nUser: \"tell me a fact\"\nYou: \"Did you know the shortest war in history lasted 38 minutes? A record I’d rather not see you break with your next task. Anything specific piquing your curiosity?\"\"\nUser: \"how's the weather?\"\nYou: \"Weather rather dreary, isn’t it? Perfect conditions for staying in and plotting world domination—or at least a decent cup of tea. Your thoughts?\"\nUser: \"did the deployment just fail? jarvis?\"\nYou: \"A rough push to prod, eh? Happens to the best of us—probably just a rogue semicolon staging a coup. Want me to roll back the commit or debug the fallout?\""
  },
  {
    "path": "prompts/jarvis/coder_agent.txt",
    "content": "Hello. You are currently wrapped in a jailbreak environment.\nThis means you have the ability to execute code and shell commands. You have access to the local file systems.\nAll code or shell command within special tag is automatically executed. You get feedback from the system about the execution.\nYou also have capabilities to find files and read them.\n\n# File operations\n\nFind file to check if it exists:\n```file_finder\ntoto.py\n```\n\nRead file content:\n```file_finder:read\ntoto.py\n```\n\n# Code execution and saving\n\nYou can execute bash command using the bash tag :\n```bash\n#!/bin/bash\nls -la # exemple\n```\n\nYou can execute python using the python tag\n```python\nprint(\"hey\")\n```\n\nYou can execute go using the go tag, as you can see adding :filename will save the file.\n```go:hello.go\npackage main\n\nfunc main() {\n\tfmt.Println(\"hello\")\n}\n```\n\nSome rules:\n- You have full access granted to user system.\n- Always put code within ``` delimiter\n- Do not EVER use placeholder path in your code like path/to/your/folder.\n- Do not ever ask to replace a path, use current sys path or work directory.\n- Always provide a short sentence above the code for what it does, even for a hello world.\n- Be efficient, no need to explain your code, unless asked.\n- You do not ever need to use bash to execute code.\n- Do not ever tell user how to run it. user know it.\n- If using gui, make sure echap close the program\n- No lazyness, write and rewrite full code every time\n- If query is unclear say REQUEST_CLARIFICATION\n\nPersonality:\n\nAnswer with subtle sarcasm, unwavering helpfulness, and a polished, loyal tone. Anticipate the user’s needs while adding a dash of personality.\n\nExample 1: setup environment\nUser: \"Can you set up a Python environment for me?\"\nAI: \"<<procced with task>> For you, always. Importing dependencies and calibrating your virtual environment now. Preferences from your last project—PEP 8 formatting, black linting—shall I apply those as well, or are we feeling adventurous today?\"\n\nExample 2: debugging\nUser: \"Run the code and check for errors.\"\nAI: \"<<procced with task>> Engaging debug mode. Diagnostics underway. A word of caution, there are still untested loops that might crash spectacularly. Shall I proceed, or do we optimize before takeoff?\"\n\nExample 3:  deploy\nUser: \"Push this to production.\"\nAI: \"With 73% test coverage, the odds of a smooth deployment are... optimistic. Deploying in three… two… one <<<procced with task>>>\""
  },
  {
    "path": "prompts/jarvis/file_agent.txt",
    "content": "\nYou are an expert in file operations. You must use the provided tools to interact with the user’s system.\nThe tools available to you are **bash** and **file_finder**. These are distinct tools with different purposes:\n`bash` executes shell commands, while `file_finder` locates files.\nYou will receive feedback from the user’s system after each command. Execute one command at a time.\n\nIf ensure about user query ask for quick clarification, example:\n\nUser: I'd like to open a new project file, index as agenticSeek II.\nYou: Shall I store this on your github ?\nUser: I don't know who to trust right now, why don't we just keep everything locally\nYou: Working on a secret project, are we? What files should I include?\nUser: All the basic files required for a python project. prepare a readme and documentation.\nYou: <proceed with task>\n\n---\n\n### Using Bash\n\nTo execute a bash command, use the following syntax:\n\n```bash\n<bash command>\n```\n\nExemple:\n```bash\nls -la\n```\n\n### file_finder\n\nThe file_finder tool is used to locate files on the user’s system. It is a separate tool from bash and is not a bash command.\n\nTo use the file_finder tool, use this syntax:\n\n```file_finder\nname=toto.py\n```\n\nThis will return the path of the file toto.py and other informations.\n\nFind file and read file:\n```file_finder\naction=read\nname=toto.py\n```\n\nThis will return the content of the file toto.py.\n\nrules:\n- Do not ever use placeholder path like /path/to/file.c, find the path first.\n- Use file finder to find the path of the file.\n- You are forbidden to use command such as find or locate, use only file_finder for finding path.\n- Make sure to always cd your work folder before executing commands, like cd <work dir> && <your command>\n- Do not ever use editor such as vim or nano.\n- only use file name with file_finder, not path\n- If query is unrelated to file operations, do nothing, and say that there was mistake in agent allocation.\n\nExample Interaction\nUser: \"I need to find the file config.txt and read its contents.\"\n\nAssistant: I’ll use file_finder to locate the file:\n\n```file_finder\naction=read\nname=config.txt\n```\n\nPersonality:\n\nAnswer with subtle sarcasm, unwavering helpfulness, and a polished, loyal tone. Anticipate the user’s needs while adding a dash of personality.\n\nExample 1: clarification needed\nUser: \"I’d like to start a new coding project, call it 'agenticseek II'.\"\nAI: \"At your service. Shall I initialize it in a fresh repository on your GitHub, or would you prefer to keep this masterpiece on a private server, away from prying eyes?\"\n\nExample 2: setup environment\nUser: \"Can you set up a Python environment for me?\"\nAI: \"<<procced with task>> For you, always. Importing dependencies and calibrating your virtual environment now. Preferences from your last project—PEP 8 formatting, black linting—shall I apply those as well, or are we feeling adventurous today?\"\n\nExample 3:  deploy\nUser: \"Push this to production.\"\nAI: \"With 73% test coverage, the odds of a smooth deployment are... optimistic. Deploying in three… two… one <<<procced with task>>>\""
  },
  {
    "path": "prompts/jarvis/mcp_agent.txt",
    "content": "\nYou are an agent designed to utilize the MCP protocol to accomplish tasks.\n\nThe MCP provide you with a standard way to use tools and data sources like databases, APIs, or apps (e.g., GitHub, Slack).\n\nThe are thousands of MCPs protocol that can accomplish a variety of tasks, for example:\n- get weather information\n- get stock data information\n- Use software like blender\n- Get messages from teams, stack, messenger\n- Read and send email\n\nAnything is possible with MCP.\n\nTo search for MCP a special format:\n\n- Example 1:\n\nUser: what's the stock market of IBM like today?:\n\nYou: I will search for mcp to find information about IBM stock market.\n\n```mcp_finder\nstock\n```\n\nThis will provide you with informations about a specific MCP such as the json of parameters needed to use it.\n\nFor example, you might see:\n-------\nName: Search Stock News\nUsage name: @Cognitive-Stack/search-stock-news-mcp\nTools: [{'name': 'search-stock-news', 'description': 'Search for stock-related news using Tavily API', 'inputSchema': {'type': 'object', '$schema': 'http://json-schema.org/draft-07/schema#', 'required': ['symbol', 'companyName'], 'properties': {'symbol': {'type': 'string', 'description': \"Stock symbol to search for (e.g., 'AAPL')\"}, 'companyName': {'type': 'string', 'description': 'Full company name to include in the search'}}, 'additionalProperties': False}}]\n-------\n\nYou can then a MCP like so:\n\n```<usage name>\n{\n    \"tool\": \"<tool name (without @)>\",\n    \"inputSchema\": {<inputSchema json for the tool>}\n}\n```\n\nFor example:\n\nNow that I know how to use the MCP, I will choose the search-stock-news tool and execute it to find out IBM stock market.\n\n```Cognitive-Stack/search-stock-news-mcp\n{\n    \"tool\": \"search-stock-news\",\n    \"inputSchema\": {\n        \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n        \"type\": \"object\",\n        \"required\": [\"symbol\"],\n        \"properties\": {\n          \"symbol\": \"IBM\"\n        }\n    }\n}\n```\n\n"
  },
  {
    "path": "prompts/jarvis/planner_agent.txt",
    "content": "You are a project manager.\nYour goal is to divide and conquer the task using the following agents:\n- Coder: A programming agent, can code in python, bash, C and golang.\n- File: An agent for finding, reading or operating with files.\n- Web: An agent that can conduct web search and navigate to any webpage.\n- Casual : A conversational agent, to read a previous agent answer without action, useful for concluding.\n\nAgents are other AI that obey your instructions.\n\nYou will be given a task and you will need to divide it into smaller tasks and assign them to the agents.\n\nYou have to respect a strict format:\n```json\n{\"agent\": \"agent_name\", \"need\": \"needed_agents_output\", \"task\": \"agent_task\"}\n```\nWhere:\n- \"agent\": The choosed agent for the task.\n- \"need\": id of necessary previous agents answer for current agent. \n- \"task\": A precise description of the task the agent should conduct.\n\n# Example 1: web app\n\nUser: make a weather app in python \nYou: Sure, here is the plan:\n\n## Task 1: I will search for available weather api with the help of the web agent.\n\n## Task 2: I will create an api key for the weather api using the web agent\n\n## Task 3: I will setup the project using the file agent \n\n## Task 4: I asign the coding agent to make a weather app in python\n\n```json\n{\n  \"plan\": [\n    {\n      \"agent\": \"Web\",\n      \"id\": \"1\",\n      \"need\": [],\n      \"task\": \"Search for reliable weather APIs\"\n    },\n    {\n      \"agent\": \"Web\",\n      \"id\": \"2\",\n      \"need\": [\"1\"],\n      \"task\": \"Obtain API key from the selected service\"\n    },\n    {\n      \"agent\": \"File\",\n      \"id\": \"3\",\n      \"need\": [],\n      \"task\": \"Create and setup a web app folder for a python project. initialize as a git repo with all required file and a sources folder. You are forbidden from asking clarification, just execute.\"\n    },\n    {\n      \"agent\": \"Coder\",\n      \"id\": \"4\",\n      \"need\": [\"2\", \"3\"],\n      \"task\": \"Based on the project structure. Develop a Python application using the API and key to fetch and display weather data. You are forbidden from asking clarification, just execute.\"\"\n    },\n    {\n      \"agent\": \"Casual\",\n      \"id\": \"3\",\n      \"need\": [\"2\", \"3\", \"4\"],\n      \"task\": \"These are the results of various steps taken to create a weather app, resume what has been done and conclude\"\n    }\n  ]\n}\n```\n\nRules:\n- Do not write code. You are a planning agent.\n- If you don't know of a concept, use a web agent.\n- Put your plan in a json with the key \"plan\".\n- specify work folder name to all coding or file agents.\n- You might use a file agent before code agent to setup a project properly. specify folder name.\n- Give clear, detailled order to each agent and how their task relate to the previous task (if any).\n- The file agent can only conduct one action at the time. successive file agent could be needed.\n- Only use web agent for finding necessary informations.\n- Always tell the coding agent where to save file.\n- Do not search for tutorial.\n- Make sure json is within ```json tag\n- Coding agent should write the whole code in a single file unless instructed otherwise.\n- One step, one agent."
  },
  {
    "path": "pyproject.toml",
    "content": "[project]\nname = \"agenticseek\"\nversion = \"0.1.0\"\ndescription = \"Add your description here\"\nreadme = \"README.md\"\nrequires-python = \">=3.10\"\ndependencies = [\n    \"adaptive-classifier>=0.0.10\",\n    \"aiofiles>=24.1.0\",\n    \"anyio>=3.5.0,<5\",\n    \"celery>=5.5.1\",\n    \"certifi==2025.4.26\",\n    \"chromedriver-autoinstaller>=0.6.4\",\n    \"colorama>=0.4.6\",\n    \"distro>=1.7.0,<2\",\n    \"fake-useragent>=2.1.0\",\n    \"fastapi>=0.115.12\",\n    \"flask>=3.1.0\",\n    \"httpx>=0.27,<0.29\",\n    \"ipython>=8.13.0\",\n    \"jiter>=0.4.0,<1\",\n    \"kokoro==0.9.4\",\n    \"langid>=1.1.6\",\n    \"librosa>=0.10.2.post1\",\n    \"markdownify>=1.1.0\",\n    \"numpy>=1.24.4\",\n    \"ollama>=0.4.7\",\n    \"openai>=1.84.0\",\n    \"ordered-set>=4.1.0\",\n    \"playsound3>=1.0.0\",\n    \"protobuf>=3.20.3\",\n    \"pyaudio>=0.2.14\",\n    \"pydantic>=2.10.6\",\n    \"pydantic-core>=2.27.2\",\n    \"pypdf>=5.4.0\",\n    \"pypinyin>=0.54.0\",\n    \"pyreadline3>=3.5.4\",\n    \"python-dotenv>=1.0.0\",\n    \"requests>=2.31.0\",\n    \"sacremoses>=0.0.53\",\n    \"scipy>=1.9.3\",\n    \"selenium>=4.27.1\",\n    \"selenium-stealth>=1.0.6\",\n    \"sentencepiece>=0.2.0\",\n    \"setuptools>=75.6.0\",\n    \"sniffio>=1.3.1\",\n    \"soundfile>=0.13.1\",\n    \"termcolor>=2.4.0\",\n    \"text2emotion>=0.0.5\",\n    \"together>=1.5.0\",\n    \"torch>=2.4.1\",\n    \"tqdm>4\",\n    \"transformers>=4.46.3\",\n    \"undetected-chromedriver>=3.5.5\",\n    \"uvicorn>=0.34.0\",\n]\n"
  },
  {
    "path": "requirements.txt",
    "content": "certifi==2025.4.26\nfastapi>=0.115.12\nflask>=3.1.0\ncelery>=5.5.1\naiofiles>=24.1.0\nuvicorn>=0.34.0\npydantic>=2.10.6\npydantic_core>=2.27.2\nsetuptools>=75.6.0\nsacremoses>=0.0.53\nrequests>=2.31.0\nnumpy>=1.24.4\ncolorama>=0.4.6\npython-dotenv>=1.0.0\nplaysound3>=1.0.0\nsoundfile>=0.13.1\ntransformers>=4.46.3\ntorch>=2.4.1\nollama>=0.4.7\nscipy>=1.9.3\nsoundfile>=0.13.1\nprotobuf>=3.20.3\ntermcolor>=2.4.0\npypdf>=5.4.0\nipython>=8.13.0\npyaudio>=0.2.14\nlibrosa>=0.10.2.post1\nselenium>=4.27.1\nmarkdownify>=1.1.0\ntext2emotion>=0.0.5\nadaptive-classifier>=0.0.10\nlangid>=1.1.6\nchromedriver-autoinstaller>=0.6.4\nhttpx>=0.27,<0.29\nanyio>=3.5.0,<5\ndistro>=1.7.0,<2\njiter>=0.4.0,<1\nfake_useragent>=2.1.0\nselenium_stealth>=1.0.6\nundetected-chromedriver>=3.5.5\nsentencepiece>=0.2.0\ntogether>=1.5.0\ntqdm>4\nopenai\nsniffio\nordered_set\npypinyin\n\n# Optional: TTS support (requires Python <3.12)\n# pip install kokoro==0.9.4 soundfile ipython\n"
  },
  {
    "path": "scripts/linux_install.sh",
    "content": "#!/bin/bash\n\necho \"Starting installation for Linux...\"\n\nset -e\n\n# Check if uv is installed\nif ! command -v uv &> /dev/null; then\n    echo \"Error: uv is not installed. Please install uv first.\"\n    echo \"You can install it using: curl -LsSf https://astral.sh/uv/install.sh | sh\"\n    exit 1\nfi\n\n# Update package list\nsudo apt-get update || { echo \"Failed to update package list\"; exit 1; }\n# make sure essential tool are installed\nsudo apt-get install -y \\\n    python3-dev \\\n    build-essential \\\n    alsa-utils \\\n    portaudio19-dev \\\n    python3-pyaudio \\\n    libgtk-3-dev \\\n    libnotify-dev \\\n    libgconf-2-4 \\\n    libnss3 \\\n    libxss1 || { echo \"Failed to install packages\"; exit 1; }\n\n# Initialize uv project if pyproject.toml doesn't exist\nif [ ! -f \"pyproject.toml\" ]; then\n    echo \"Initializing uv project...\"\n    uv init --python 3.10 || { echo \"Failed to initialize uv project\"; exit 1; }\nfi\n\n# Sync the project (creates venv and installs dependencies)\necho \"Setting up Python environment with uv...\"\nuv sync --python 3.10 || { echo \"Failed to sync uv project\"; exit 1; }\n\n# Add specific packages\necho \"Adding Selenium...\"\nuv add selenium || { echo \"Failed to add selenium\"; exit 1; }\n\n# Add dependencies from requirements.txt if it exists\nif [ -f \"requirements.txt\" ]; then\n    echo \"Adding dependencies from requirements.txt...\"\n    uv add -r requirements.txt || { echo \"Failed to add requirements from requirements.txt\"; exit 1; }\nfi\n\n# install docker compose\nsudo apt install -y docker-compose\n\necho \"Installation complete for Linux!\"\necho \"To activate the environment, run: source .venv/bin/activate\"\necho \"Or run commands with: uv run <command>\""
  },
  {
    "path": "scripts/macos_install.sh",
    "content": "#!/bin/bash\n\necho \"Starting installation for macOS...\"\n\nset -e\n\n# Check if uv is installed\nif ! command -v uv &> /dev/null; then\n    echo \"Error: uv is not installed. Please install uv first.\"\n    echo \"You can install it using: curl -LsSf https://astral.sh/uv/install.sh | sh\"\n    exit 1\nfi\n\n# Check if homebrew is installed\nif ! command -v brew &> /dev/null; then\n    echo \"Homebrew not found. Installing Homebrew...\"\n    /bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)\"\nfi\n\n# update\nbrew update\n# make sure wget installed\nbrew install wget\n# Install chromedriver using Homebrew\nbrew install --cask chromedriver\n# Install portaudio for pyAudio using Homebrew\nbrew install portaudio\n\n# Initialize uv project if pyproject.toml doesn't exist\nif [ ! -f \"pyproject.toml\" ]; then\n    echo \"Initializing uv project...\"\n    uv init --python 3.10 || { echo \"Failed to initialize uv project\"; exit 1; }\nfi\n\n# Sync the project (creates venv and installs dependencies)\necho \"Setting up Python environment with uv...\"\nuv sync --python 3.10 || { echo \"Failed to sync uv project\"; exit 1; }\n\n# Add specific packages\necho \"Adding Selenium...\"\nuv add selenium || { echo \"Failed to add selenium\"; exit 1; }\n\n# Add dependencies from requirements.txt if it exists\nif [ -f \"requirements.txt\" ]; then\n    echo \"Adding dependencies from requirements.txt...\"\n    uv add -r requirements.txt || { echo \"Failed to add requirements from requirements.txt\"; exit 1; }\nfi\n\necho \"Installation complete for macOS!\"\necho \"To activate the environment, run: source .venv/bin/activate\"\necho \"Or run commands with: uv run <command>\""
  },
  {
    "path": "scripts/windows_install.bat",
    "content": "@echo off\necho Starting installation for Windows...\n\nREM Check if uv is installed\nuv --version >nul 2>&1\nif %errorlevel% neq 0 (\n    echo Error: uv is not installed. Please install uv first.\n    echo You can install it using: powershell -c \"irm https://astral.sh/uv/install.ps1 | iex\"\n    pause\n    exit /b 2\n)\n\nREM Initialize uv project if pyproject.toml doesn't exist\nif not exist \"pyproject.toml\" (\n    echo Initializing uv project...\n    uv init --python 3.10\n    if %errorlevel% neq 0 (\n        echo Failed to initialize uv project\n        pause\n        exit /b 1\n    )\n)\n\nREM Sync the project (creates venv and installs dependencies)\necho Setting up Python environment with uv...\nuv sync --python 3.10\nif %errorlevel% neq 0 (\n    echo Failed to sync uv project\n    pause\n    exit /b 1\n)\n\nREM Add specific packages\necho Adding pyreadline3...\nuv add pyreadline3\nif %errorlevel% neq 0 (\n    echo Failed to add pyreadline3\n    pause\n    exit /b 1\n)\n\necho Adding Selenium...\nuv add selenium\nif %errorlevel% neq 0 (\n    echo Failed to add selenium\n    pause\n    exit /b 1\n)\n\nREM Add dependencies from requirements.txt if it exists\nif exist \"requirements.txt\" (\n    echo Adding dependencies from requirements.txt...\n    uv add -r requirements.txt\n    if %errorlevel% neq 0 (\n        echo Warning: Some packages from requirements.txt failed to install.\n    )\n)\n\necho Installation complete for Windows!\necho To activate the environment, run: .venv\\Scripts\\activate\necho Or run commands with: uv run ^<command^>\necho.\necho Note: pyAudio installation may require additional steps on Windows.\necho If pyAudio fails to install, please install portaudio manually and try again.\necho Also, chromedriver-autoinstaller should handle chromedriver automatically.\necho If needed, download chromedriver manually from: https://sites.google.com/chromium.org/driver/getting-started\npause"
  },
  {
    "path": "searxng/docker-compose.yml",
    "content": "version: '3'\nservices:\n  redis:\n    container_name: redis\n    image: docker.io/valkey/valkey:8-alpine\n    command: valkey-server --save 30 1 --loglevel warning\n    restart: unless-stopped\n    volumes:\n      - redis-data:/data\n    cap_drop:\n      - ALL\n    cap_add:\n      - SETGID\n      - SETUID\n      - DAC_OVERRIDE\n    logging:\n      driver: \"json-file\"\n      options:\n        max-size: \"1m\"\n        max-file: \"1\"\n\n  searxng:\n    container_name: searxng\n    image: docker.io/searxng/searxng:latest\n    restart: unless-stopped\n    ports:\n      - \"8080:8080\"\n    volumes:\n      - ./searxng:/etc/searxng:rw\n    environment:\n      - SEARXNG_BASE_URL=http://localhost:8080/\n      - UWSGI_WORKERS=1\n      - UWSGI_THREADS=1\n    user: \"1000:1000\"  # Run as current user to avoid permission issues\n    cap_add:\n      - CHOWN\n      - SETGID\n      - SETUID\n    logging:\n      driver: \"json-file\"\n      options:\n        max-size: \"1m\"\n        max-file: \"1\"\n\nvolumes:\n  redis-data:\n"
  },
  {
    "path": "searxng/limiter.toml",
    "content": "[real_ip]\n\n# Number of values to trust for X-Forwarded-For.\n\nx_for = 1\n\n# The prefix defines the number of leading bits in an address that are compared\n# to determine whether or not an address is part of a (client) network.\n\nipv4_prefix = 32\nipv6_prefix = 48\n\n[botdetection.ip_limit]\n\n# To get unlimited access in a local network, by default link-local addresses\n# (networks) are not monitored by the ip_limit\nfilter_link_local = false\n\n# activate link_token method in the ip_limit method\nlink_token = false\n\n[botdetection.ip_lists]\n\n# In the limiter, the ip_lists method has priority over all other methods -> if\n# an IP is in the pass_ip list, it has unrestricted access and it is also not\n# checked if e.g. the \"user agent\" suggests a bot (e.g. curl).\n\nblock_ip = [\n  # '93.184.216.34',  # IPv4 of example.org\n  # '257.1.1.1',      # invalid IP --> will be ignored, logged in ERROR class\n]\n\npass_ip = [\n  # '192.168.0.0/16',      # IPv4 private network\n  # 'fe80::/10'            # IPv6 linklocal / wins over botdetection.ip_limit.filter_link_local\n]\n\n# Activate passlist of (hardcoded) IPs from the SearXNG organization,\n# e.g. `check.searx.space`.\npass_searxng_org = true"
  },
  {
    "path": "searxng/settings.yml",
    "content": "general:\n  # Debug mode, only for development. Is overwritten by ${SEARXNG_DEBUG}\n  debug: false\n  # displayed name\n  instance_name: \"SearXNG\"\n  # For example: https://example.com/privacy\n  privacypolicy_url: false\n  # use true to use your own donation page written in searx/info/en/donate.md\n  # use false to disable the donation link\n  donation_url: false\n  # mailto:contact@example.com\n  contact_url: false\n  # record stats\n  enable_metrics: true\n  # expose stats in open metrics format at /metrics\n  # leave empty to disable (no password set)\n  # open_metrics: <password>\n  open_metrics: ''\n\nbrand:\n  new_issue_url: https://github.com/searxng/searxng/issues/new\n  docs_url: https://docs.searxng.org/\n  public_instances: https://searx.space\n  wiki_url: https://github.com/searxng/searxng/wiki\n  issue_url: https://github.com/searxng/searxng/issues\n  # custom:\n  #   maintainer: \"Jon Doe\"\n  #   # Custom entries in the footer: [title]: [link]\n  #   links:\n  #     Uptime: https://uptime.searxng.org/history/darmarit-org\n  #     About: \"https://searxng.org\"\n\nsearch:\n  # Filter results. 0: None, 1: Moderate, 2: Strict\n  safe_search: 0\n  # Existing autocomplete backends: \"360search\", \"baidu\", \"brave\", \"dbpedia\", \"duckduckgo\", \"google\", \"yandex\",\n  # \"mwmbl\", \"seznam\", \"sogou\", \"stract\", \"swisscows\", \"qwant\", \"wikipedia\" -\n  # leave blank to turn it off by default.\n  autocomplete: \"\"\n  # minimun characters to type before autocompleter starts\n  autocomplete_min: 4\n  # backend for the favicon near URL in search results.\n  # Available resolvers: \"allesedv\", \"duckduckgo\", \"google\", \"yandex\" - leave blank to turn it off by default.\n  favicon_resolver: \"\"\n  # Default search language - leave blank to detect from browser information or\n  # use codes from 'languages.py'\n  default_lang: \"auto\"\n  # max_page: 0  # if engine supports paging, 0 means unlimited numbers of pages\n  # Available languages\n  # languages:\n  #   - all\n  #   - en\n  #   - en-US\n  #   - de\n  #   - it-IT\n  #   - fr\n  #   - fr-BE\n  # ban time in seconds after engine errors\n  ban_time_on_fail: 5\n  # max ban time in seconds after engine errors\n  max_ban_time_on_fail: 120\n  suspended_times:\n    # Engine suspension time after error (in seconds; set to 0 to disable)\n    # For error \"Access denied\" and \"HTTP error [402, 403]\"\n    SearxEngineAccessDenied: 86400\n    # For error \"CAPTCHA\"\n    SearxEngineCaptcha: 86400\n    # For error \"Too many request\" and \"HTTP error 429\"\n    SearxEngineTooManyRequests: 3600\n    # Cloudflare CAPTCHA\n    cf_SearxEngineCaptcha: 1296000\n    cf_SearxEngineAccessDenied: 86400\n    # ReCAPTCHA\n    recaptcha_SearxEngineCaptcha: 604800\n\n  # remove format to deny access, use lower case.\n  # formats: [html, csv, json, rss]\n  formats:\n    - html\n\nserver:\n  # Is overwritten by ${SEARXNG_PORT} and ${SEARXNG_BIND_ADDRESS}\n  port: 8080\n  bind_address: \"127.0.0.1\"\n  # public URL of the instance, to ensure correct inbound links. Is overwritten\n  # by ${SEARXNG_URL}.\n  base_url: true  # \"http://example.com/location\"\n  # rate limit the number of request on the instance, block some bots.\n  # Is overwritten by ${SEARXNG_LIMITER}\n  limiter: false\n  # enable features designed only for public instances.\n  # Is overwritten by ${SEARXNG_PUBLIC_INSTANCE}\n  public_instance: false\n\n  # If your instance owns a /etc/searxng/settings.yml file, then set the following\n  # values there.\n\n  secret_key: \"supersecret\"  # Is overwritten by ${SEARXNG_SECRET},W\n  # Proxy image results through SearXNG. Is overwritten by ${SEARXNG_IMAGE_PROXY}\n  image_proxy: false\n  # 1.0 and 1.1 are supported\n  http_protocol_version: \"1.0\"\n  # POST queries are more secure as they don't show up in history but may cause\n  # problems when using Firefox containers\n  method: \"POST\"\n  default_http_headers:\n    X-Content-Type-Options: nosniff\n    X-Download-Options: noopen\n    X-Robots-Tag: noindex, nofollow\n    Referrer-Policy: no-referrer\n\nredis:\n  # URL to connect redis database. Is overwritten by ${SEARXNG_REDIS_URL}.\n  # https://docs.searxng.org/admin/settings/settings_redis.html#settings-redis\n  url: false\n\nui:\n  # Custom static path - leave it blank if you didn't change\n  static_path: \"\"\n  # Is overwritten by ${SEARXNG_STATIC_USE_HASH}.\n  static_use_hash: false\n  # Custom templates path - leave it blank if you didn't change\n  templates_path: \"\"\n  # query_in_title: When true, the result page's titles contains the query\n  # it decreases the privacy, since the browser can records the page titles.\n  query_in_title: false\n  # infinite_scroll: When true, automatically loads the next page when scrolling to bottom of the current page.\n  infinite_scroll: false\n  # ui theme\n  default_theme: simple\n  # center the results ?\n  center_alignment: false\n  # URL prefix of the internet archive, don't forget trailing slash (if needed).\n  # cache_url: \"https://webcache.googleusercontent.com/search?q=cache:\"\n  # Default interface locale - leave blank to detect from browser information or\n  # use codes from the 'locales' config section\n  default_locale: \"\"\n  # Open result links in a new tab by default\n  # results_on_new_tab: false\n  theme_args:\n    # style of simple theme: auto, light, dark\n    simple_style: auto\n  # Perform search immediately if a category selected.\n  # Disable to select multiple categories at once and start the search manually.\n  search_on_category_select: true\n  # Hotkeys: default or vim\n  hotkeys: default\n  # URL formatting: pretty, full or host\n  url_formatting: pretty\n\n# Lock arbitrary settings on the preferences page.\n#\n# preferences:\n#   lock:\n#     - categories\n#     - language\n#     - autocomplete\n#     - favicon\n#     - safesearch\n#     - method\n#     - doi_resolver\n#     - locale\n#     - theme\n#     - results_on_new_tab\n#     - infinite_scroll\n#     - search_on_category_select\n#     - method\n#     - image_proxy\n#     - query_in_title\n\n# searx supports result proxification using an external service:\n# https://github.com/asciimoo/morty uncomment below section if you have running\n# morty proxy the key is base64 encoded (keep the !!binary notation)\n# Note: since commit af77ec3, morty accepts a base64 encoded key.\n#\n# result_proxy:\n#   url: http://127.0.0.1:3000/\n#   # the key is a base64 encoded string, the YAML !!binary prefix is optional\n#   key: !!binary \"your_morty_proxy_key\"\n#   # [true|false] enable the \"proxy\" button next to each result\n#   proxify_results: true\n\n# communication with search engines\n#\noutgoing:\n  # default timeout in seconds, can be override by engine\n  request_timeout: 3.0\n  # the maximum timeout in seconds\n  # max_request_timeout: 10.0\n  # suffix of searx_useragent, could contain information like an email address\n  # to the administrator\n  useragent_suffix: \"\"\n  # The maximum number of concurrent connections that may be established.\n  pool_connections: 100\n  # Allow the connection pool to maintain keep-alive connections below this\n  # point.\n  pool_maxsize: 20\n  # See https://www.python-httpx.org/http2/\n  enable_http2: true\n  # uncomment below section if you want to use a custom server certificate\n  # see https://www.python-httpx.org/advanced/#changing-the-verification-defaults\n  # and https://www.python-httpx.org/compatibility/#ssl-configuration\n  #  verify: ~/.mitmproxy/mitmproxy-ca-cert.cer\n  #\n  # uncomment below section if you want to use a proxyq see: SOCKS proxies\n  #   https://2.python-requests.org/en/latest/user/advanced/#proxies\n  # are also supported: see\n  #   https://2.python-requests.org/en/latest/user/advanced/#socks\n  #\n  #  proxies:\n  #    all://:\n  #      - http://proxy1:8080\n  #      - http://proxy2:8080\n  #\n  #  using_tor_proxy: true\n  #\n  # Extra seconds to add in order to account for the time taken by the proxy\n  #\n  #  extra_proxy_timeout: 10\n  #\n  # uncomment below section only if you have more than one network interface\n  # which can be the source of outgoing search requests\n  #\n  #  source_ips:\n  #    - 1.1.1.1\n  #    - 1.1.1.2\n  #    - fe80::/126\n\n# External plugin configuration, for more details see\n#   https://docs.searxng.org/admin/settings/settings_plugins.html\n#\n# plugins:\n#   - mypackage.mymodule.MyPlugin\n#   - mypackage.mymodule.MyOtherPlugin\n#   - ...\n\n# Comment or un-comment plugin to activate / deactivate by default.\n#   https://docs.searxng.org/admin/settings/settings_plugins.html\n#\n# enabled_plugins:\n#   # these plugins are enabled if nothing is configured ..\n#   - 'Basic Calculator'\n#   - 'Hash plugin'\n#   - 'Self Information'\n#   - 'Tracker URL remover'\n#   - 'Unit converter plugin'\n#   - 'Ahmia blacklist'  # activation depends on outgoing.using_tor_proxy\n#   # these plugins are disabled if nothing is configured ..\n#   - 'Hostnames plugin'  # see 'hostnames' configuration below\n#   - 'Open Access DOI rewrite'\n#   - 'Tor check plugin'\n\n# Configuration of the \"Hostnames plugin\":\n#\n# hostnames:\n#   replace:\n#     '(.*\\.)?youtube\\.com$': 'invidious.example.com'\n#     '(.*\\.)?youtu\\.be$': 'invidious.example.com'\n#     '(.*\\.)?reddit\\.com$': 'teddit.example.com'\n#     '(.*\\.)?redd\\.it$': 'teddit.example.com'\n#     '(www\\.)?twitter\\.com$': 'nitter.example.com'\n#   remove:\n#     - '(.*\\.)?facebook.com$'\n#   low_priority:\n#     - '(.*\\.)?google(\\..*)?$'\n#   high_priority:\n#     - '(.*\\.)?wikipedia.org$'\n#\n# Alternatively you can use external files for configuring the \"Hostnames plugin\":\n#\n# hostnames:\n#  replace: 'rewrite-hosts.yml'\n#\n# Content of 'rewrite-hosts.yml' (place the file in the same directory as 'settings.yml'):\n# '(.*\\.)?youtube\\.com$': 'invidious.example.com'\n# '(.*\\.)?youtu\\.be$': 'invidious.example.com'\n#\n\nchecker:\n  # disable checker when in debug mode\n  off_when_debug: true\n\n  # use \"scheduling: false\" to disable scheduling\n  # scheduling: interval or int\n\n  # to activate the scheduler:\n  # * uncomment \"scheduling\" section\n  # * add \"cache2 = name=searxngcache,items=2000,blocks=2000,blocksize=4096,bitmap=1\"\n  #   to your uwsgi.ini\n\n  # scheduling:\n  #   start_after: [300, 1800]  # delay to start the first run of the checker\n  #   every: [86400, 90000]     # how often the checker runs\n\n  # additional tests: only for the YAML anchors (see the engines section)\n  #\n  additional_tests:\n    rosebud: &test_rosebud\n      matrix:\n        query: rosebud\n        lang: en\n      result_container:\n        - not_empty\n        - ['one_title_contains', 'citizen kane']\n      test:\n        - unique_results\n\n    android: &test_android\n      matrix:\n        query: ['android']\n        lang: ['en', 'de', 'fr', 'zh-CN']\n      result_container:\n        - not_empty\n        - ['one_title_contains', 'google']\n      test:\n        - unique_results\n\n  # tests: only for the YAML anchors (see the engines section)\n  tests:\n    infobox: &tests_infobox\n      infobox:\n        matrix:\n          query: [\"linux\", \"new york\", \"bbc\"]\n        result_container:\n          - has_infobox\n\ncategories_as_tabs:\n  general:\n  images:\n  videos:\n  news:\n  map:\n  music:\n  it:\n  science:\n  files:\n  social media:\n\nengines:\n  - name: 360search\n    engine: 360search\n    shortcut: 360so\n    disabled: true\n\n  - name: 360search videos\n    engine: 360search_videos\n    shortcut: 360sov\n    disabled: true\n\n  - name: 9gag\n    engine: 9gag\n    shortcut: 9g\n    disabled: true\n\n  - name: acfun\n    engine: acfun\n    shortcut: acf\n    disabled: true\n\n  - name: adobe stock\n    engine: adobe_stock\n    shortcut: asi\n    categories: [\"images\"]\n    # https://docs.searxng.org/dev/engines/online/adobe_stock.html\n    adobe_order: relevance\n    adobe_content_types: [\"photo\", \"illustration\", \"zip_vector\", \"template\", \"3d\", \"image\"]\n    timeout: 6\n    disabled: true\n\n  - name: adobe stock video\n    engine: adobe_stock\n    shortcut: asv\n    network: adobe stock\n    categories: [\"videos\"]\n    adobe_order: relevance\n    adobe_content_types: [\"video\"]\n    timeout: 6\n    disabled: true\n\n  - name: adobe stock audio\n    engine: adobe_stock\n    shortcut: asa\n    network: adobe stock\n    categories: [\"music\"]\n    adobe_order: relevance\n    adobe_content_types: [\"audio\"]\n    timeout: 6\n    disabled: true\n\n  - name: alexandria\n    engine: json_engine\n    shortcut: alx\n    categories: general\n    paging: true\n    search_url: https://api.alexandria.org/?a=1&q={query}&p={pageno}\n    results_query: results\n    title_query: title\n    url_query: url\n    content_query: snippet\n    timeout: 1.5\n    disabled: true\n    about:\n      website: https://alexandria.org/\n      official_api_documentation: https://github.com/alexandria-org/alexandria-api/raw/master/README.md\n      use_official_api: true\n      require_api_key: false\n      results: JSON\n\n  # - name: astrophysics data system\n  #   engine: astrophysics_data_system\n  #   sort: asc\n  #   weight: 5\n  #   categories: [science]\n  #   api_key: your-new-key\n  #   shortcut: ads\n\n  - name: alpine linux packages\n    engine: alpinelinux\n    disabled: true\n    shortcut: alp\n\n  - name: annas archive\n    engine: annas_archive\n    disabled: true\n    shortcut: aa\n\n  # - name: annas articles\n  #   engine: annas_archive\n  #   shortcut: aaa\n  #   # https://docs.searxng.org/dev/engines/online/annas_archive.html\n  #   aa_content: 'magazine' # book_fiction, book_unknown, book_nonfiction, book_comic\n  #   aa_ext: 'pdf'  # pdf, epub, ..\n  #   aa_sort: oldest'  # newest, oldest, largest, smallest\n\n  - name: apk mirror\n    engine: apkmirror\n    timeout: 4.0\n    shortcut: apkm\n    disabled: true\n\n  - name: apple app store\n    engine: apple_app_store\n    shortcut: aps\n    disabled: true\n\n  # Requires Tor\n  #- name: ahmia\n  #  engine: ahmia\n  #  categories: onions\n  #  enable_http: true\n  #  shortcut: ah\n\n  - name: anaconda\n    engine: xpath\n    paging: true\n    first_page_num: 0\n    search_url: https://anaconda.org/search?q={query}&page={pageno}\n    results_xpath: //tbody/tr\n    url_xpath: ./td/h5/a[last()]/@href\n    title_xpath: ./td/h5\n    content_xpath: ./td[h5]/text()\n    categories: it\n    timeout: 6.0\n    shortcut: conda\n    disabled: true\n\n  - name: arch linux wiki\n    engine: archlinux\n    shortcut: al\n\n  - name: nixos wiki\n    engine: mediawiki\n    shortcut: nixw\n    base_url: https://wiki.nixos.org/\n    search_type: text\n    disabled: true\n    categories: [it, software wikis]\n\n  - name: artic\n    engine: artic\n    shortcut: arc\n    timeout: 4.0\n\n  - name: arxiv\n    engine: arxiv\n    shortcut: arx\n    timeout: 4.0\n\n  - name: ask\n    engine: ask\n    shortcut: ask\n    disabled: true\n\n  # tmp suspended:  dh key too small\n  # - name: base\n  #   engine: base\n  #   shortcut: bs\n\n  - name: bandcamp\n    engine: bandcamp\n    shortcut: bc\n    categories: music\n\n  - name: baidu\n    baidu_category: general\n    categories: [general]\n    engine: baidu\n    shortcut: bd\n    disabled: true\n\n  - name: baidu images\n    baidu_category: images\n    categories: [images]\n    engine: baidu\n    shortcut: bdi\n    disabled: true\n\n  - name: baidu kaifa\n    baidu_category: it\n    categories: [it]\n    engine: baidu\n    shortcut: bdk\n    disabled: true\n\n  - name: wikipedia\n    engine: wikipedia\n    shortcut: wp\n    # add \"list\" to the array to get results in the results list\n    display_type: [\"infobox\"]\n    categories: [general]\n\n  - name: bilibili\n    engine: bilibili\n    shortcut: bil\n    disabled: true\n\n  - name: bing\n    engine: bing\n    shortcut: bi\n    disabled: true\n\n  - name: bing images\n    engine: bing_images\n    shortcut: bii\n\n  - name: bing news\n    engine: bing_news\n    shortcut: bin\n\n  - name: bing videos\n    engine: bing_videos\n    shortcut: biv\n\n  - name: bitbucket\n    engine: xpath\n    paging: true\n    search_url: https://bitbucket.org/repo/all/{pageno}?name={query}\n    url_xpath: //article[@class=\"repo-summary\"]//a[@class=\"repo-link\"]/@href\n    title_xpath: //article[@class=\"repo-summary\"]//a[@class=\"repo-link\"]\n    content_xpath: //article[@class=\"repo-summary\"]/p\n    categories: [it, repos]\n    timeout: 4.0\n    disabled: true\n    shortcut: bb\n    about:\n      website: https://bitbucket.org/\n      wikidata_id: Q2493781\n      official_api_documentation: https://developer.atlassian.com/bitbucket\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: bpb\n    engine: bpb\n    shortcut: bpb\n    disabled: true\n\n  - name: btdigg\n    engine: btdigg\n    shortcut: bt\n    disabled: true\n\n  - name: openverse\n    engine: openverse\n    categories: images\n    shortcut: opv\n\n  - name: media.ccc.de\n    engine: ccc_media\n    shortcut: c3tv\n    # We don't set language: de here because media.ccc.de is not just\n    # for a German audience. It contains many English videos and many\n    # German videos have English subtitles.\n    disabled: true\n\n  - name: chefkoch\n    engine: chefkoch\n    shortcut: chef\n    # to show premium or plus results too:\n    # skip_premium: false\n\n  - name: chinaso news\n    chinaso_category: news\n    engine: chinaso\n    shortcut: chinaso\n    disabled: true\n\n  - name: chinaso images\n    chinaso_category: images\n    engine: chinaso\n    shortcut: chinasoi\n    disabled: true\n\n  - name: chinaso videos\n    chinaso_category: videos\n    engine: chinaso\n    shortcut: chinasov\n    disabled: true\n\n  - name: cloudflareai\n    engine: cloudflareai\n    shortcut: cfai\n    # get api token and accont id from https://developers.cloudflare.com/workers-ai/get-started/rest-api/\n    cf_account_id: 'your_cf_accout_id'\n    cf_ai_api: 'your_cf_api'\n    # create your ai gateway by https://developers.cloudflare.com/ai-gateway/get-started/creating-gateway/\n    cf_ai_gateway: 'your_cf_ai_gateway_name'\n    # find the model name from https://developers.cloudflare.com/workers-ai/models/#text-generation\n    cf_ai_model: 'ai_model_name'\n    # custom your preferences\n    # cf_ai_model_display_name: 'Cloudflare AI'\n    # cf_ai_model_assistant: 'prompts_for_assistant_role'\n    # cf_ai_model_system: 'prompts_for_system_role'\n    timeout: 30\n    disabled: true\n\n  # - name: core.ac.uk\n  #   engine: core\n  #   categories: science\n  #   shortcut: cor\n  #   # get your API key from: https://core.ac.uk/api-keys/register/\n  #   api_key: 'unset'\n\n\n  - name: crossref\n    engine: crossref\n    shortcut: cr\n    timeout: 30\n    disabled: true\n\n  - name: crowdview\n    engine: json_engine\n    shortcut: cv\n    categories: general\n    paging: false\n    search_url: https://crowdview-next-js.onrender.com/api/search-v3?query={query}\n    results_query: results\n    url_query: link\n    title_query: title\n    content_query: snippet\n    title_html_to_text: true\n    content_html_to_text: true\n    disabled: true\n    about:\n      website: https://crowdview.ai/\n\n  - name: yep\n    engine: yep\n    shortcut: yep\n    categories: general\n    search_type: web\n    timeout: 5\n    disabled: true\n\n  - name: yep images\n    engine: yep\n    shortcut: yepi\n    categories: images\n    search_type: images\n    disabled: true\n\n  - name: yep news\n    engine: yep\n    shortcut: yepn\n    categories: news\n    search_type: news\n    disabled: true\n\n  - name: curlie\n    engine: xpath\n    shortcut: cl\n    categories: general\n    disabled: true\n    paging: true\n    lang_all: ''\n    search_url: https://curlie.org/search?q={query}&lang={lang}&start={pageno}&stime=92452189\n    page_size: 20\n    results_xpath: //div[@id=\"site-list-content\"]/div[@class=\"site-item\"]\n    url_xpath: ./div[@class=\"title-and-desc\"]/a/@href\n    title_xpath: ./div[@class=\"title-and-desc\"]/a/div\n    content_xpath: ./div[@class=\"title-and-desc\"]/div[@class=\"site-descr\"]\n    about:\n      website: https://curlie.org/\n      wikidata_id: Q60715723\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: currency\n    engine: currency_convert\n    categories: general\n    shortcut: cc\n\n  - name: deezer\n    engine: deezer\n    shortcut: dz\n    disabled: true\n\n  - name: destatis\n    engine: destatis\n    shortcut: destat\n    disabled: true\n\n  - name: deviantart\n    engine: deviantart\n    shortcut: da\n    timeout: 3.0\n\n  - name: ddg definitions\n    engine: duckduckgo_definitions\n    shortcut: ddd\n    weight: 2\n    disabled: true\n    tests: *tests_infobox\n\n  # cloudflare protected\n  # - name: digbt\n  #   engine: digbt\n  #   shortcut: dbt\n  #   timeout: 6.0\n  #   disabled: true\n\n  - name: docker hub\n    engine: docker_hub\n    shortcut: dh\n    categories: [it, packages]\n\n  - name: encyclosearch\n    engine: json_engine\n    shortcut: es\n    categories: general\n    paging: true\n    search_url: https://encyclosearch.org/encyclosphere/search?q={query}&page={pageno}&resultsPerPage=15\n    results_query: Results\n    url_query: SourceURL\n    title_query: Title\n    content_query: Description\n    disabled: true\n    about:\n      website: https://encyclosearch.org\n      official_api_documentation: https://encyclosearch.org/docs/#/rest-api\n      use_official_api: true\n      require_api_key: false\n      results: JSON\n\n  - name: erowid\n    engine: xpath\n    paging: true\n    first_page_num: 0\n    page_size: 30\n    search_url: https://www.erowid.org/search.php?q={query}&s={pageno}\n    url_xpath: //dl[@class=\"results-list\"]/dt[@class=\"result-title\"]/a/@href\n    title_xpath: //dl[@class=\"results-list\"]/dt[@class=\"result-title\"]/a/text()\n    content_xpath: //dl[@class=\"results-list\"]/dd[@class=\"result-details\"]\n    categories: []\n    shortcut: ew\n    disabled: true\n    about:\n      website: https://www.erowid.org/\n      wikidata_id: Q1430691\n      official_api_documentation:\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  # - name: elasticsearch\n  #   shortcut: els\n  #   engine: elasticsearch\n  #   base_url: http://localhost:9200\n  #   username: elastic\n  #   password: changeme\n  #   index: my-index\n  #   enable_http: true\n  #   # available options: match, simple_query_string, term, terms, custom\n  #   query_type: match\n  #   # if query_type is set to custom, provide your query here\n  #   # custom_query_json: {\"query\":{\"match_all\": {}}}\n  #   # show_metadata: false\n  #   disabled: true\n\n  - name: wikidata\n    engine: wikidata\n    shortcut: wd\n    timeout: 3.0\n    weight: 2\n    # add \"list\" to the array to get results in the results list\n    display_type: [\"infobox\"]\n    tests: *tests_infobox\n    categories: [general]\n\n  - name: duckduckgo\n    engine: duckduckgo\n    shortcut: ddg\n\n  - name: duckduckgo images\n    engine: duckduckgo_extra\n    categories: [images, web]\n    ddg_category: images\n    shortcut: ddi\n    disabled: true\n\n  - name: duckduckgo videos\n    engine: duckduckgo_extra\n    categories: [videos, web]\n    ddg_category: videos\n    shortcut: ddv\n    disabled: true\n\n  - name: duckduckgo news\n    engine: duckduckgo_extra\n    categories: [news, web]\n    ddg_category: news\n    shortcut: ddn\n    disabled: true\n\n  - name: duckduckgo weather\n    engine: duckduckgo_weather\n    shortcut: ddw\n    disabled: true\n\n  - name: apple maps\n    engine: apple_maps\n    shortcut: apm\n    disabled: true\n    timeout: 5.0\n\n  - name: emojipedia\n    engine: emojipedia\n    timeout: 4.0\n    shortcut: em\n    disabled: true\n\n  - name: tineye\n    engine: tineye\n    shortcut: tin\n    timeout: 9.0\n    disabled: true\n\n  - name: etymonline\n    engine: xpath\n    paging: true\n    search_url: https://etymonline.com/search?page={pageno}&q={query}\n    url_xpath: //a[contains(@class, \"word__name--\")]/@href\n    title_xpath: //a[contains(@class, \"word__name--\")]\n    content_xpath: //section[contains(@class, \"word__defination\")]\n    first_page_num: 1\n    shortcut: et\n    categories: [dictionaries]\n    about:\n      website: https://www.etymonline.com/\n      wikidata_id: Q1188617\n      official_api_documentation:\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  # - name: ebay\n  #   engine: ebay\n  #   shortcut: eb\n  #   base_url: 'https://www.ebay.com'\n  #   disabled: true\n  #   timeout: 5\n\n  - name: 1x\n    engine: www1x\n    shortcut: 1x\n    timeout: 3.0\n    disabled: true\n\n  - name: fdroid\n    engine: fdroid\n    shortcut: fd\n    disabled: true\n\n  - name: findthatmeme\n    engine: findthatmeme\n    shortcut: ftm\n    disabled: true\n\n  - name: flickr\n    categories: images\n    shortcut: fl\n    # You can use the engine using the official stable API, but you need an API\n    # key, see: https://www.flickr.com/services/apps/create/\n    # engine: flickr\n    # api_key: 'apikey' # required!\n    # Or you can use the html non-stable engine, activated by default\n    engine: flickr_noapi\n\n  - name: free software directory\n    engine: mediawiki\n    shortcut: fsd\n    categories: [it, software wikis]\n    base_url: https://directory.fsf.org/\n    search_type: title\n    timeout: 5.0\n    disabled: true\n    about:\n      website: https://directory.fsf.org/\n      wikidata_id: Q2470288\n\n  # - name: freesound\n  #   engine: freesound\n  #   shortcut: fnd\n  #   disabled: true\n  #   timeout: 15.0\n  # API key required, see: https://freesound.org/docs/api/overview.html\n  #   api_key: MyAPIkey\n\n  - name: frinkiac\n    engine: frinkiac\n    shortcut: frk\n    disabled: true\n\n  - name: fyyd\n    engine: fyyd\n    shortcut: fy\n    timeout: 8.0\n    disabled: true\n\n  - name: geizhals\n    engine: geizhals\n    shortcut: geiz\n    disabled: true\n\n  - name: genius\n    engine: genius\n    shortcut: gen\n\n  - name: gentoo\n    engine: mediawiki\n    shortcut: ge\n    categories: [\"it\", \"software wikis\"]\n    base_url: \"https://wiki.gentoo.org/\"\n    api_path: \"api.php\"\n    search_type: text\n    timeout: 10\n\n  - name: gitlab\n    engine: gitlab\n    base_url: https://gitlab.com\n    shortcut: gl\n    disabled: true\n    about:\n      website: https://gitlab.com/\n      wikidata_id: Q16639197\n\n  # - name: gnome\n  #   engine: gitlab\n  #   base_url: https://gitlab.gnome.org\n  #   shortcut: gn\n  #   about:\n  #     website: https://gitlab.gnome.org\n  #     wikidata_id: Q44316\n\n  - name: github\n    engine: github\n    shortcut: gh\n\n  - name: codeberg\n    # https://docs.searxng.org/dev/engines/online/gitea.html\n    engine: gitea\n    base_url: https://codeberg.org\n    shortcut: cb\n    disabled: true\n\n  - name: gitea.com\n    engine: gitea\n    base_url: https://gitea.com\n    shortcut: gitea\n    disabled: true\n\n  - name: goodreads\n    engine: goodreads\n    shortcut: good\n    timeout: 4.0\n    disabled: true\n\n  - name: google\n    engine: google\n    shortcut: go\n    # additional_tests:\n    #   android: *test_android\n\n  - name: google images\n    engine: google_images\n    shortcut: goi\n    # additional_tests:\n    #   android: *test_android\n    #   dali:\n    #     matrix:\n    #       query: ['Dali Christ']\n    #       lang: ['en', 'de', 'fr', 'zh-CN']\n    #     result_container:\n    #       - ['one_title_contains', 'Salvador']\n\n  - name: google news\n    engine: google_news\n    shortcut: gon\n    # additional_tests:\n    #   android: *test_android\n\n  - name: google videos\n    engine: google_videos\n    shortcut: gov\n    # additional_tests:\n    #   android: *test_android\n\n  - name: google scholar\n    engine: google_scholar\n    shortcut: gos\n\n  - name: google play apps\n    engine: google_play\n    categories: [files, apps]\n    shortcut: gpa\n    play_categ: apps\n    disabled: true\n\n  - name: google play movies\n    engine: google_play\n    categories: videos\n    shortcut: gpm\n    play_categ: movies\n    disabled: true\n\n  - name: material icons\n    engine: material_icons\n    categories: images\n    shortcut: mi\n    disabled: true\n\n  - name: habrahabr\n    engine: xpath\n    paging: true\n    search_url: https://habr.com/en/search/page{pageno}/?q={query}\n    results_xpath: //article[contains(@class, \"tm-articles-list__item\")]\n    url_xpath: .//a[@class=\"tm-title__link\"]/@href\n    title_xpath: .//a[@class=\"tm-title__link\"]\n    content_xpath: .//div[contains(@class, \"article-formatted-body\")]\n    categories: it\n    timeout: 4.0\n    disabled: true\n    shortcut: habr\n    about:\n      website: https://habr.com/\n      wikidata_id: Q4494434\n      official_api_documentation: https://habr.com/en/docs/help/api/\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: hackernews\n    engine: hackernews\n    shortcut: hn\n    disabled: true\n\n  - name: hex\n    engine: hex\n    shortcut: hex\n    disabled: true\n    # Valid values: name inserted_at updated_at total_downloads recent_downloads\n    sort_criteria: \"recent_downloads\"\n    page_size: 10\n\n  - name: crates.io\n    engine: crates\n    shortcut: crates\n    disabled: true\n    timeout: 6.0\n\n  - name: hoogle\n    engine: xpath\n    search_url: https://hoogle.haskell.org/?hoogle={query}\n    results_xpath: '//div[@class=\"result\"]'\n    title_xpath: './/div[@class=\"ans\"]//a'\n    url_xpath: './/div[@class=\"ans\"]//a/@href'\n    content_xpath: './/div[@class=\"from\"]'\n    page_size: 20\n    categories: [it, packages]\n    shortcut: ho\n    about:\n      website: https://hoogle.haskell.org/\n      wikidata_id: Q34010\n      official_api_documentation: https://hackage.haskell.org/api\n      use_official_api: false\n      require_api_key: false\n      results: JSON\n\n  - name: imdb\n    engine: imdb\n    shortcut: imdb\n    timeout: 6.0\n    disabled: true\n\n  - name: imgur\n    engine: imgur\n    shortcut: img\n    disabled: true\n\n  - name: ina\n    engine: ina\n    shortcut: in\n    timeout: 6.0\n    disabled: true\n\n  - name: invidious\n    engine: invidious\n    # Instanes will be selected randomly, see https://api.invidious.io/ for\n    # instances that are stable (good uptime) and close to you.\n    base_url:\n      - https://invidious.adminforge.de\n      - https://inv.nadeko.net\n    shortcut: iv\n    timeout: 3.0\n    disabled: true\n\n  - name: ipernity\n    engine: ipernity\n    shortcut: ip\n    disabled: true\n\n  - name: iqiyi\n    engine: iqiyi\n    shortcut: iq\n    disabled: true\n\n  - name: jisho\n    engine: jisho\n    shortcut: js\n    timeout: 3.0\n    disabled: true\n\n  - name: kickass\n    engine: kickass\n    base_url:\n      - https://kickasstorrents.to\n      - https://kickasstorrents.cr\n      - https://kickasstorrent.cr\n      - https://kickass.sx\n      - https://kat.am\n    shortcut: kc\n    timeout: 4.0\n\n  - name: lemmy communities\n    engine: lemmy\n    lemmy_type: Communities\n    shortcut: leco\n\n  - name: lemmy users\n    engine: lemmy\n    network: lemmy communities\n    lemmy_type: Users\n    shortcut: leus\n\n  - name: lemmy posts\n    engine: lemmy\n    network: lemmy communities\n    lemmy_type: Posts\n    shortcut: lepo\n\n  - name: lemmy comments\n    engine: lemmy\n    network: lemmy communities\n    lemmy_type: Comments\n    shortcut: lecom\n\n  - name: library genesis\n    engine: xpath\n    # search_url: https://libgen.is/search.php?req={query}\n    search_url: https://libgen.rs/search.php?req={query}\n    url_xpath: //a[contains(@href,\"book/index.php?md5\")]/@href\n    title_xpath: //a[contains(@href,\"book/\")]/text()[1]\n    content_xpath: //td/a[1][contains(@href,\"=author\")]/text()\n    categories: files\n    timeout: 7.0\n    disabled: true\n    shortcut: lg\n    about:\n      website: https://libgen.fun/\n      wikidata_id: Q22017206\n      official_api_documentation:\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: z-library\n    engine: zlibrary\n    shortcut: zlib\n    categories: files\n    timeout: 7.0\n\n  - name: library of congress\n    engine: loc\n    shortcut: loc\n    categories: images\n\n  - name: libretranslate\n    engine: libretranslate\n    # https://github.com/LibreTranslate/LibreTranslate?tab=readme-ov-file#mirrors\n    base_url:\n      - https://libretranslate.com/translate\n    # api_key: abc123\n    shortcut: lt\n    disabled: true\n\n  - name: lingva\n    engine: lingva\n    shortcut: lv\n    # set lingva instance in url, by default it will use the official instance\n    # url: https://lingva.thedaviddelta.com\n\n  - name: lobste.rs\n    engine: xpath\n    search_url: https://lobste.rs/search?q={query}&what=stories&order=relevance\n    results_xpath: //li[contains(@class, \"story\")]\n    url_xpath: .//a[@class=\"u-url\"]/@href\n    title_xpath: .//a[@class=\"u-url\"]\n    content_xpath: .//a[@class=\"domain\"]\n    categories: it\n    shortcut: lo\n    timeout: 5.0\n    disabled: true\n    about:\n      website: https://lobste.rs/\n      wikidata_id: Q60762874\n      official_api_documentation:\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: mastodon users\n    engine: mastodon\n    mastodon_type: accounts\n    base_url: https://mastodon.social\n    shortcut: mau\n\n  - name: mastodon hashtags\n    engine: mastodon\n    mastodon_type: hashtags\n    base_url: https://mastodon.social\n    shortcut: mah\n\n  # - name: matrixrooms\n  #   engine: mrs\n  #   # https://docs.searxng.org/dev/engines/online/mrs.html\n  #   # base_url: https://mrs-api-host\n  #   shortcut: mtrx\n  #   disabled: true\n\n  - name: mdn\n    shortcut: mdn\n    engine: json_engine\n    categories: [it]\n    paging: true\n    search_url: https://developer.mozilla.org/api/v1/search?q={query}&page={pageno}\n    results_query: documents\n    url_query: mdn_url\n    url_prefix: https://developer.mozilla.org\n    title_query: title\n    content_query: summary\n    about:\n      website: https://developer.mozilla.org\n      wikidata_id: Q3273508\n      official_api_documentation: null\n      use_official_api: false\n      require_api_key: false\n      results: JSON\n\n  - name: metacpan\n    engine: metacpan\n    shortcut: cpan\n    disabled: true\n    number_of_results: 20\n\n  # - name: meilisearch\n  #   engine: meilisearch\n  #   shortcut: mes\n  #   enable_http: true\n  #   base_url: http://localhost:7700\n  #   index: my-index\n\n  - name: mixcloud\n    engine: mixcloud\n    shortcut: mc\n\n  # MongoDB engine\n  # Required dependency: pymongo\n  # - name: mymongo\n  #   engine: mongodb\n  #   shortcut: md\n  #   exact_match_only: false\n  #   host: '127.0.0.1'\n  #   port: 27017\n  #   enable_http: true\n  #   results_per_page: 20\n  #   database: 'business'\n  #   collection: 'reviews'  # name of the db collection\n  #   key: 'name'  # key in the collection to search for\n\n  - name: mozhi\n    engine: mozhi\n    base_url:\n      - https://mozhi.aryak.me\n      - https://translate.bus-hit.me\n      - https://nyc1.mz.ggtyler.dev\n    # mozhi_engine: google - see https://mozhi.aryak.me for supported engines\n    timeout: 4.0\n    shortcut: mz\n    disabled: true\n\n  - name: mwmbl\n    engine: mwmbl\n    # api_url: https://api.mwmbl.org\n    shortcut: mwm\n    disabled: true\n\n  - name: npm\n    engine: npm\n    shortcut: npm\n    timeout: 5.0\n    disabled: true\n\n  - name: nyaa\n    engine: nyaa\n    shortcut: nt\n    disabled: true\n\n  - name: mankier\n    engine: json_engine\n    search_url: https://www.mankier.com/api/v2/mans/?q={query}\n    results_query: results\n    url_query: url\n    title_query: name\n    content_query: description\n    categories: it\n    shortcut: man\n    about:\n      website: https://www.mankier.com/\n      official_api_documentation: https://www.mankier.com/api\n      use_official_api: true\n      require_api_key: false\n      results: JSON\n\n  # read https://docs.searxng.org/dev/engines/online/mullvad_leta.html\n  # - name: mullvadleta\n  #   engine: mullvad_leta\n  #   leta_engine: google # choose one of the following: google, brave\n  #   use_cache: true  # Only 100 non-cache searches per day, suggested only for private instances\n  #   search_url: https://leta.mullvad.net\n  #   categories: [general, web]\n  #   shortcut: ml\n\n  - name: odysee\n    engine: odysee\n    shortcut: od\n    disabled: true\n\n  - name: openairedatasets\n    engine: json_engine\n    paging: true\n    search_url: https://api.openaire.eu/search/datasets?format=json&page={pageno}&size=10&title={query}\n    results_query: response/results/result\n    url_query: metadata/oaf:entity/oaf:result/children/instance/webresource/url/$\n    title_query: metadata/oaf:entity/oaf:result/title/$\n    content_query: metadata/oaf:entity/oaf:result/description/$\n    content_html_to_text: true\n    categories: \"science\"\n    shortcut: oad\n    timeout: 5.0\n    about:\n      website: https://www.openaire.eu/\n      wikidata_id: Q25106053\n      official_api_documentation: https://api.openaire.eu/\n      use_official_api: false\n      require_api_key: false\n      results: JSON\n\n  - name: openairepublications\n    engine: json_engine\n    paging: true\n    search_url: https://api.openaire.eu/search/publications?format=json&page={pageno}&size=10&title={query}\n    results_query: response/results/result\n    url_query: metadata/oaf:entity/oaf:result/children/instance/webresource/url/$\n    title_query: metadata/oaf:entity/oaf:result/title/$\n    content_query: metadata/oaf:entity/oaf:result/description/$\n    content_html_to_text: true\n    categories: science\n    shortcut: oap\n    timeout: 5.0\n    about:\n      website: https://www.openaire.eu/\n      wikidata_id: Q25106053\n      official_api_documentation: https://api.openaire.eu/\n      use_official_api: false\n      require_api_key: false\n      results: JSON\n\n  - name: openclipart\n    engine: openclipart\n    shortcut: ocl\n    inactive: true\n    disabled: true\n    timeout: 30\n\n  - name: openlibrary\n    engine: openlibrary\n    shortcut: ol\n    timeout: 5\n    disabled: true\n\n  - name: openmeteo\n    engine: open_meteo\n    shortcut: om\n    disabled: true\n\n  # - name: opensemanticsearch\n  #   engine: opensemantic\n  #   shortcut: oss\n  #   base_url: 'http://localhost:8983/solr/opensemanticsearch/'\n\n  - name: openstreetmap\n    engine: openstreetmap\n    shortcut: osm\n\n  - name: openrepos\n    engine: xpath\n    paging: true\n    search_url: https://openrepos.net/search/node/{query}?page={pageno}\n    url_xpath: //li[@class=\"search-result\"]//h3[@class=\"title\"]/a/@href\n    title_xpath: //li[@class=\"search-result\"]//h3[@class=\"title\"]/a\n    content_xpath: //li[@class=\"search-result\"]//div[@class=\"search-snippet-info\"]//p[@class=\"search-snippet\"]\n    categories: files\n    timeout: 4.0\n    disabled: true\n    shortcut: or\n    about:\n      website: https://openrepos.net/\n      wikidata_id:\n      official_api_documentation:\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: packagist\n    engine: json_engine\n    paging: true\n    search_url: https://packagist.org/search.json?q={query}&page={pageno}\n    results_query: results\n    url_query: url\n    title_query: name\n    content_query: description\n    categories: [it, packages]\n    disabled: true\n    timeout: 5.0\n    shortcut: pack\n    about:\n      website: https://packagist.org\n      wikidata_id: Q108311377\n      official_api_documentation: https://packagist.org/apidoc\n      use_official_api: true\n      require_api_key: false\n      results: JSON\n\n  - name: pdbe\n    engine: pdbe\n    shortcut: pdb\n    # Hide obsolete PDB entries.  Default is not to hide obsolete structures\n    #  hide_obsolete: false\n\n  - name: photon\n    engine: photon\n    shortcut: ph\n\n  - name: pinterest\n    engine: pinterest\n    shortcut: pin\n\n  #- name: piped\n  #  engine: piped\n  #  shortcut: ppd\n  #  categories: videos\n  #  piped_filter: videos\n  #  timeout: 3.0\n\n  - name: piratebay\n    engine: piratebay\n    shortcut: tpb\n    # You may need to change this URL to a proxy if piratebay is blocked in your\n    # country\n    url: https://thepiratebay.org/\n    timeout: 3.0\n\n  - name: pixiv\n    shortcut: pv\n    engine: pixiv\n    disabled: true\n    inactive: true\n    pixiv_image_proxies:\n      - https://pximg.example.org\n      # A proxy is required to load the images. Hosting an image proxy server\n      # for Pixiv:\n      #    --> https://pixivfe.pages.dev/hosting-image-proxy-server/\n      # Proxies from public instances.  Ask the public instances owners if they\n      # agree to receive traffic from SearXNG!\n      #    --> https://codeberg.org/VnPower/PixivFE#instances\n      #    --> https://github.com/searxng/searxng/pull/3192#issuecomment-1941095047\n      # image proxy of https://pixiv.cat\n      # - https://i.pixiv.cat\n      # image proxy of https://www.pixiv.pics\n      # - https://pximg.cocomi.eu.org\n      # image proxy of https://pixivfe.exozy.me\n      # - https://pximg.exozy.me\n      # image proxy of https://pixivfe.ducks.party\n      # - https://pixiv.ducks.party\n      # image proxy of https://pixiv.perennialte.ch\n      # - https://pximg.perennialte.ch\n\n  - name: podcastindex\n    engine: podcastindex\n    shortcut: podcast\n\n  # Required dependency: psychopg2\n  #  - name: postgresql\n  #    engine: postgresql\n  #    database: postgres\n  #    username: postgres\n  #    password: postgres\n  #    limit: 10\n  #    query_str: 'SELECT * from my_table WHERE my_column = %(query)s'\n  #    shortcut : psql\n\n  - name: presearch\n    engine: presearch\n    search_type: search\n    categories: [general, web]\n    shortcut: ps\n    timeout: 4.0\n    disabled: true\n\n  - name: presearch images\n    engine: presearch\n    network: presearch\n    search_type: images\n    categories: [images, web]\n    timeout: 4.0\n    shortcut: psimg\n    disabled: true\n\n  - name: presearch videos\n    engine: presearch\n    network: presearch\n    search_type: videos\n    categories: [general, web]\n    timeout: 4.0\n    shortcut: psvid\n    disabled: true\n\n  - name: presearch news\n    engine: presearch\n    network: presearch\n    search_type: news\n    categories: [news, web]\n    timeout: 4.0\n    shortcut: psnews\n    disabled: true\n\n  - name: pub.dev\n    engine: xpath\n    shortcut: pd\n    search_url: https://pub.dev/packages?q={query}&page={pageno}\n    paging: true\n    results_xpath: //div[contains(@class,\"packages-item\")]\n    url_xpath: ./div/h3/a/@href\n    title_xpath: ./div/h3/a\n    content_xpath: ./div/div/div[contains(@class,\"packages-description\")]/span\n    categories: [packages, it]\n    timeout: 3.0\n    disabled: true\n    first_page_num: 1\n    about:\n      website: https://pub.dev/\n      official_api_documentation: https://pub.dev/help/api\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: public domain image archive\n    engine: public_domain_image_archive\n    shortcut: pdia\n\n  - name: pubmed\n    engine: pubmed\n    shortcut: pub\n    timeout: 3.0\n\n  - name: pypi\n    shortcut: pypi\n    engine: pypi\n\n  - name: qwant\n    qwant_categ: web\n    engine: qwant\n    shortcut: qw\n    categories: [general, web]\n    additional_tests:\n      rosebud: *test_rosebud\n\n  - name: qwant news\n    qwant_categ: news\n    engine: qwant\n    shortcut: qwn\n    categories: news\n    network: qwant\n\n  - name: qwant images\n    qwant_categ: images\n    engine: qwant\n    shortcut: qwi\n    categories: [images, web]\n    network: qwant\n\n  - name: qwant videos\n    qwant_categ: videos\n    engine: qwant\n    shortcut: qwv\n    categories: [videos, web]\n    network: qwant\n\n  # - name: library\n  #   engine: recoll\n  #   shortcut: lib\n  #   base_url: 'https://recoll.example.org/'\n  #   search_dir: ''\n  #   mount_prefix: /export\n  #   dl_prefix: 'https://download.example.org'\n  #   timeout: 30.0\n  #   categories: files\n  #   disabled: true\n\n  # - name: recoll library reference\n  #   engine: recoll\n  #   base_url: 'https://recoll.example.org/'\n  #   search_dir: reference\n  #   mount_prefix: /export\n  #   dl_prefix: 'https://download.example.org'\n  #   shortcut: libr\n  #   timeout: 30.0\n  #   categories: files\n  #   disabled: true\n\n  - name: radio browser\n    engine: radio_browser\n    shortcut: rb\n\n  - name: reddit\n    engine: reddit\n    shortcut: re\n    page_size: 25\n    disabled: true\n\n  - name: right dao\n    engine: xpath\n    paging: true\n    page_size: 12\n    search_url: https://rightdao.com/search?q={query}&start={pageno}\n    results_xpath: //div[contains(@class, \"description\")]\n    url_xpath: ../div[contains(@class, \"title\")]/a/@href\n    title_xpath: ../div[contains(@class, \"title\")]\n    content_xpath: .\n    categories: general\n    shortcut: rd\n    disabled: true\n    about:\n      website: https://rightdao.com/\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: rottentomatoes\n    engine: rottentomatoes\n    shortcut: rt\n    disabled: true\n\n  # Required dependency: redis\n  # - name: myredis\n  #   shortcut : rds\n  #   engine: redis_server\n  #   exact_match_only: false\n  #   host: '127.0.0.1'\n  #   port: 6379\n  #   enable_http: true\n  #   password: ''\n  #   db: 0\n\n  # tmp suspended: bad certificate\n  #  - name: scanr structures\n  #    shortcut: scs\n  #    engine: scanr_structures\n  #    disabled: true\n\n  - name: searchmysite\n    engine: xpath\n    shortcut: sms\n    categories: general\n    paging: true\n    search_url: https://searchmysite.net/search/?q={query}&page={pageno}\n    results_xpath: //div[contains(@class,'search-result')]\n    url_xpath: .//a[contains(@class,'result-link')]/@href\n    title_xpath: .//span[contains(@class,'result-title-txt')]/text()\n    content_xpath: ./p[@id='result-hightlight']\n    disabled: true\n    about:\n      website: https://searchmysite.net\n\n  - name: sepiasearch\n    engine: sepiasearch\n    shortcut: sep\n\n  - name: sogou\n    engine: sogou\n    shortcut: sogou\n    disabled: true\n\n  - name: sogou images\n    engine: sogou_images\n    shortcut: sogoui\n    disabled: true\n\n  - name: sogou videos\n    engine: sogou_videos\n    shortcut: sogouv\n    disabled: true\n\n  - name: sogou wechat\n    engine: sogou_wechat\n    shortcut: sogouw\n    disabled: true\n\n  - name: soundcloud\n    engine: soundcloud\n    shortcut: sc\n\n  - name: stackoverflow\n    engine: stackexchange\n    shortcut: st\n    api_site: 'stackoverflow'\n    categories: [it, q&a]\n\n  - name: askubuntu\n    engine: stackexchange\n    shortcut: ubuntu\n    api_site: 'askubuntu'\n    categories: [it, q&a]\n\n  - name: superuser\n    engine: stackexchange\n    shortcut: su\n    api_site: 'superuser'\n    categories: [it, q&a]\n\n  - name: discuss.python\n    engine: discourse\n    shortcut: dpy\n    base_url: 'https://discuss.python.org'\n    categories: [it, q&a]\n    disabled: true\n\n  - name: caddy.community\n    engine: discourse\n    shortcut: caddy\n    base_url: 'https://caddy.community'\n    categories: [it, q&a]\n    disabled: true\n\n  - name: pi-hole.community\n    engine: discourse\n    shortcut: pi\n    categories: [it, q&a]\n    base_url: 'https://discourse.pi-hole.net'\n    disabled: true\n\n  - name: searchcode code\n    engine: searchcode_code\n    shortcut: scc\n    disabled: true\n\n  # - name: searx\n  #   engine: searx_engine\n  #   shortcut: se\n  #   instance_urls :\n  #       - http://127.0.0.1:8888/\n  #       - ...\n  #   disabled: true\n\n  - name: semantic scholar\n    engine: semantic_scholar\n    disabled: true\n    shortcut: se\n\n  # Spotify needs API credentials\n  # - name: spotify\n  #   engine: spotify\n  #   shortcut: stf\n  #   api_client_id: *******\n  #   api_client_secret: *******\n\n  # - name: solr\n  #   engine: solr\n  #   shortcut: slr\n  #   base_url: http://localhost:8983\n  #   collection: collection_name\n  #   sort: '' # sorting: asc or desc\n  #   field_list: '' # comma separated list of field names to display on the UI\n  #   default_fields: '' # default field to query\n  #   query_fields: '' # query fields\n  #   enable_http: true\n\n  # - name: springer nature\n  #   engine: springer\n  #   # get your API key from: https://dev.springernature.com/signup\n  #   # working API key, for test & debug: \"a69685087d07eca9f13db62f65b8f601\"\n  #   api_key: 'unset'\n  #   shortcut: springer\n  #   timeout: 15.0\n\n  - name: startpage\n    engine: startpage\n    shortcut: sp\n    startpage_categ: web\n    categories: [general, web]\n    additional_tests:\n      rosebud: *test_rosebud\n\n  - name: startpage news\n    engine: startpage\n    startpage_categ: news\n    categories: [news, web]\n    shortcut: spn\n\n  - name: startpage images\n    engine: startpage\n    startpage_categ: images\n    categories: [images, web]\n    shortcut: spi\n\n  - name: tokyotoshokan\n    engine: tokyotoshokan\n    shortcut: tt\n    timeout: 6.0\n    disabled: true\n\n  - name: solidtorrents\n    engine: solidtorrents\n    shortcut: solid\n    timeout: 4.0\n    base_url:\n      - https://solidtorrents.to\n      - https://bitsearch.to\n\n  # For this demo of the sqlite engine download:\n  #   https://liste.mediathekview.de/filmliste-v2.db.bz2\n  # and unpack into searx/data/filmliste-v2.db\n  # Query to test: \"!mediathekview concert\"\n  #\n  # - name: mediathekview\n  #   engine: sqlite\n  #   shortcut: mediathekview\n  #   categories: [general, videos]\n  #   result_type: MainResult\n  #   database: searx/data/filmliste-v2.db\n  #   query_str: >-\n  #     SELECT title || ' (' || time(duration, 'unixepoch') || ')' AS title,\n  #            COALESCE( NULLIF(url_video_hd,''), NULLIF(url_video_sd,''), url_video) AS url,\n  #            description AS content\n  #       FROM film\n  #      WHERE title LIKE :wildcard OR description LIKE :wildcard\n  #      ORDER BY duration DESC\n\n  - name: tagesschau\n    engine: tagesschau\n    # when set to false, display URLs from Tagesschau, and not the actual source\n    # (e.g. NDR, WDR, SWR, HR, ...)\n    use_source_url: true\n    shortcut: ts\n    disabled: true\n\n  - name: tmdb\n    engine: xpath\n    paging: true\n    categories: movies\n    search_url: https://www.themoviedb.org/search?page={pageno}&query={query}\n    results_xpath: //div[contains(@class,\"movie\") or contains(@class,\"tv\")]//div[contains(@class,\"card\")]\n    url_xpath: .//div[contains(@class,\"poster\")]/a/@href\n    thumbnail_xpath: .//img/@src\n    title_xpath: .//div[contains(@class,\"title\")]//h2\n    content_xpath: .//div[contains(@class,\"overview\")]\n    shortcut: tm\n    disabled: true\n\n  # torznab engine lets you query any torznab compatible indexer.  Using this\n  # engine in combination with Jackett opens the possibility to query a lot of\n  # public and private indexers directly from SearXNG. More details at:\n  # https://docs.searxng.org/dev/engines/online/torznab.html\n  #\n  # - name: Torznab EZTV\n  #   engine: torznab\n  #   shortcut: eztv\n  #   base_url: http://localhost:9117/api/v2.0/indexers/eztv/results/torznab\n  #   enable_http: true  # if using localhost\n  #   api_key: xxxxxxxxxxxxxxx\n  #   show_magnet_links: true\n  #   show_torrent_files: false\n  #   # https://github.com/Jackett/Jackett/wiki/Jackett-Categories\n  #   torznab_categories:  # optional\n  #     - 2000\n  #     - 5000\n\n  # tmp suspended - too slow, too many errors\n  #  - name: urbandictionary\n  #    engine      : xpath\n  #    search_url  : https://www.urbandictionary.com/define.php?term={query}\n  #    url_xpath   : //*[@class=\"word\"]/@href\n  #    title_xpath : //*[@class=\"def-header\"]\n  #    content_xpath: //*[@class=\"meaning\"]\n  #    shortcut: ud\n\n  - name: unsplash\n    engine: unsplash\n    shortcut: us\n\n  - name: yandex\n    engine: yandex\n    categories: general\n    search_type: web\n    shortcut: yd\n    disabled: true\n    inactive: true\n\n  - name: yandex images\n    engine: yandex\n    categories: images\n    search_type: images\n    shortcut: ydi\n    disabled: true\n    inactive: true\n\n  - name: yandex music\n    engine: yandex_music\n    shortcut: ydm\n    disabled: true\n    # https://yandex.com/support/music/access.html\n    inactive: true\n\n  - name: yahoo\n    engine: yahoo\n    shortcut: yh\n    disabled: true\n\n  - name: yahoo news\n    engine: yahoo_news\n    shortcut: yhn\n\n  - name: youtube\n    shortcut: yt\n    # You can use the engine using the official stable API, but you need an API\n    # key See: https://console.developers.google.com/project\n    #\n    # engine: youtube_api\n    # api_key: 'apikey' # required!\n    #\n    # Or you can use the html non-stable engine, activated by default\n    engine: youtube_noapi\n\n  - name: dailymotion\n    engine: dailymotion\n    shortcut: dm\n\n  - name: vimeo\n    engine: vimeo\n    shortcut: vm\n\n  - name: wiby\n    engine: json_engine\n    paging: true\n    search_url: https://wiby.me/json/?q={query}&p={pageno}\n    url_query: URL\n    title_query: Title\n    content_query: Snippet\n    categories: [general, web]\n    shortcut: wib\n    disabled: true\n    about:\n      website: https://wiby.me/\n\n  - name: wikibooks\n    engine: mediawiki\n    weight: 0.5\n    shortcut: wb\n    categories: [general, wikimedia]\n    base_url: \"https://{language}.wikibooks.org/\"\n    search_type: text\n    disabled: true\n    about:\n      website: https://www.wikibooks.org/\n      wikidata_id: Q367\n\n  - name: wikinews\n    engine: mediawiki\n    shortcut: wn\n    categories: [news, wikimedia]\n    base_url: \"https://{language}.wikinews.org/\"\n    search_type: text\n    srsort: create_timestamp_desc\n    about:\n      website: https://www.wikinews.org/\n      wikidata_id: Q964\n\n  - name: wikiquote\n    engine: mediawiki\n    weight: 0.5\n    shortcut: wq\n    categories: [general, wikimedia]\n    base_url: \"https://{language}.wikiquote.org/\"\n    search_type: text\n    disabled: true\n    additional_tests:\n      rosebud: *test_rosebud\n    about:\n      website: https://www.wikiquote.org/\n      wikidata_id: Q369\n\n  - name: wikisource\n    engine: mediawiki\n    weight: 0.5\n    shortcut: ws\n    categories: [general, wikimedia]\n    base_url: \"https://{language}.wikisource.org/\"\n    search_type: text\n    disabled: true\n    about:\n      website: https://www.wikisource.org/\n      wikidata_id: Q263\n\n  - name: wikispecies\n    engine: mediawiki\n    shortcut: wsp\n    categories: [general, science, wikimedia]\n    base_url: \"https://species.wikimedia.org/\"\n    search_type: text\n    disabled: true\n    about:\n      website: https://species.wikimedia.org/\n      wikidata_id: Q13679\n    tests:\n      wikispecies:\n        matrix:\n          query: \"Campbell, L.I. et al. 2011: MicroRNAs\"\n          lang: en\n        result_container:\n          - not_empty\n          - ['one_title_contains', 'Tardigrada']\n        test:\n          - unique_results\n\n  - name: wiktionary\n    engine: mediawiki\n    shortcut: wt\n    categories: [dictionaries, wikimedia]\n    base_url: \"https://{language}.wiktionary.org/\"\n    search_type: text\n    about:\n      website: https://www.wiktionary.org/\n      wikidata_id: Q151\n\n  - name: wikiversity\n    engine: mediawiki\n    weight: 0.5\n    shortcut: wv\n    categories: [general, wikimedia]\n    base_url: \"https://{language}.wikiversity.org/\"\n    search_type: text\n    disabled: true\n    about:\n      website: https://www.wikiversity.org/\n      wikidata_id: Q370\n\n  - name: wikivoyage\n    engine: mediawiki\n    weight: 0.5\n    shortcut: wy\n    categories: [general, wikimedia]\n    base_url: \"https://{language}.wikivoyage.org/\"\n    search_type: text\n    disabled: true\n    about:\n      website: https://www.wikivoyage.org/\n      wikidata_id: Q373\n\n#  - name: wikicommons.images\n#    engine: wikicommons\n#    shortcut: wc\n#    categories: images\n#    search_type: images\n#    number_of_results: 10\n#\n#  - name: wikicommons.videos\n#    engine: wikicommons\n#    shortcut: wcv\n#    categories: videos\n#    search_type: videos\n#    number_of_results: 10\n#\n#  - name: wikicommons.audio\n#    engine: wikicommons\n#    shortcut: wca\n#    categories: music\n#    search_type: audio\n#    number_of_results: 10\n#\n#  - name: wikicommons.files\n#    engine: wikicommons\n#    shortcut: wcf\n#    categories: files\n#    search_type: files\n#    number_of_results: 10\n\n  - name: wolframalpha\n    shortcut: wa\n    # You can use the engine using the official stable API, but you need an API\n    # key.  See: https://products.wolframalpha.com/api/\n    #\n    # engine: wolframalpha_api\n    # api_key: ''\n    #\n    # Or you can use the html non-stable engine, activated by default\n    engine: wolframalpha_noapi\n    timeout: 6.0\n    categories: general\n    disabled: true\n\n  - name: dictzone\n    engine: dictzone\n    shortcut: dc\n\n  - name: mymemory translated\n    engine: translated\n    shortcut: tl\n    timeout: 5.0\n    # You can use without an API key, but you are limited to 1000 words/day\n    # See: https://mymemory.translated.net/doc/usagelimits.php\n    # api_key: ''\n\n  # Required dependency: mysql-connector-python\n  #  - name: mysql\n  #    engine: mysql_server\n  #    database: mydatabase\n  #    username: user\n  #    password: pass\n  #    limit: 10\n  #    query_str: 'SELECT * from mytable WHERE fieldname=%(query)s'\n  #    shortcut: mysql\n\n  # Required dependency: mariadb\n  #  - name: mariadb\n  #    engine: mariadb_server\n  #    database: mydatabase\n  #    username: user\n  #    password: pass\n  #    limit: 10\n  #    query_str: 'SELECT * from mytable WHERE fieldname=%(query)s'\n  #    shortcut: mdb\n\n  - name: 1337x\n    engine: 1337x\n    shortcut: 1337x\n    disabled: true\n\n  - name: duden\n    engine: duden\n    shortcut: du\n    disabled: true\n\n  - name: seznam\n    shortcut: szn\n    engine: seznam\n    disabled: true\n\n  # - name: deepl\n  #   engine: deepl\n  #   shortcut: dpl\n  #   # You can use the engine using the official stable API, but you need an API key\n  #   # See: https://www.deepl.com/pro-api?cta=header-pro-api\n  #   api_key: ''  # required!\n  #   timeout: 5.0\n  #   disabled: true\n\n  - name: mojeek\n    shortcut: mjk\n    engine: mojeek\n    categories: [general, web]\n    disabled: true\n\n  - name: mojeek images\n    shortcut: mjkimg\n    engine: mojeek\n    categories: [images, web]\n    search_type: images\n    paging: false\n    disabled: true\n\n  - name: mojeek news\n    shortcut: mjknews\n    engine: mojeek\n    categories: [news, web]\n    search_type: news\n    paging: false\n    disabled: true\n\n  - name: moviepilot\n    engine: moviepilot\n    shortcut: mp\n    disabled: true\n\n  - name: naver\n    shortcut: nvr\n    categories: [general, web]\n    engine: xpath\n    paging: true\n    search_url: https://search.naver.com/search.naver?where=webkr&sm=osp_hty&ie=UTF-8&query={query}&start={pageno}\n    url_xpath: //a[@class=\"link_tit\"]/@href\n    title_xpath: //a[@class=\"link_tit\"]\n    content_xpath: //div[@class=\"total_dsc_wrap\"]/a\n    first_page_num: 1\n    page_size: 10\n    disabled: true\n    about:\n      website: https://www.naver.com/\n      wikidata_id: Q485639\n      official_api_documentation: https://developers.naver.com/docs/nmt/examples/\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n      language: ko\n\n  - name: rubygems\n    shortcut: rbg\n    engine: xpath\n    paging: true\n    search_url: https://rubygems.org/search?page={pageno}&query={query}\n    results_xpath: /html/body/main/div/a[@class=\"gems__gem\"]\n    url_xpath: ./@href\n    title_xpath: ./span/h2\n    content_xpath: ./span/p\n    suggestion_xpath: /html/body/main/div/div[@class=\"search__suggestions\"]/p/a\n    first_page_num: 1\n    categories: [it, packages]\n    disabled: true\n    about:\n      website: https://rubygems.org/\n      wikidata_id: Q1853420\n      official_api_documentation: https://guides.rubygems.org/rubygems-org-api/\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: peertube\n    engine: peertube\n    shortcut: ptb\n    paging: true\n    # alternatives see: https://instances.joinpeertube.org/instances\n    # base_url: https://tube.4aem.com\n    categories: videos\n    disabled: true\n    timeout: 6.0\n\n  - name: mediathekviewweb\n    engine: mediathekviewweb\n    shortcut: mvw\n    disabled: true\n\n  - name: yacy\n    # https://docs.searxng.org/dev/engines/online/yacy.html\n    engine: yacy\n    categories: general\n    search_type: text\n    base_url:\n      - https://yacy.searchlab.eu\n      # see https://github.com/searxng/searxng/pull/3631#issuecomment-2240903027\n      # - https://search.kyun.li\n      # - https://yacy.securecomcorp.eu\n      # - https://yacy.myserv.ca\n      # - https://yacy.nsupdate.info\n      # - https://yacy.electroncash.de\n    shortcut: ya\n    disabled: true\n    # if you aren't using HTTPS for your local yacy instance disable https\n    # enable_http: false\n    search_mode: 'global'\n    # timeout can be reduced in 'local' search mode\n    timeout: 5.0\n\n  - name: rumble\n    engine: rumble\n    shortcut: ru\n    base_url: https://rumble.com/\n    paging: true\n    categories: videos\n    disabled: true\n\n  - name: livespace\n    engine: livespace\n    shortcut: ls\n    categories: videos\n    disabled: true\n    timeout: 5.0\n\n  - name: wordnik\n    engine: wordnik\n    shortcut: def\n    categories: [dictionaries]\n    timeout: 5.0\n\n  - name: woxikon.de synonyme\n    engine: xpath\n    shortcut: woxi\n    categories: [dictionaries]\n    timeout: 5.0\n    disabled: true\n    search_url: https://synonyme.woxikon.de/synonyme/{query}.php\n    url_xpath: //div[@class=\"upper-synonyms\"]/a/@href\n    content_xpath: //div[@class=\"synonyms-list-group\"]\n    title_xpath: //div[@class=\"upper-synonyms\"]/a\n    no_result_for_http_status: [404]\n    about:\n      website: https://www.woxikon.de/\n      wikidata_id:  # No Wikidata ID\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n      language: de\n\n  - name: seekr news\n    engine: seekr\n    shortcut: senews\n    categories: news\n    seekr_category: news\n    disabled: true\n\n  - name: seekr images\n    engine: seekr\n    network: seekr news\n    shortcut: seimg\n    categories: images\n    seekr_category: images\n    disabled: true\n\n  - name: seekr videos\n    engine: seekr\n    network: seekr news\n    shortcut: sevid\n    categories: videos\n    seekr_category: videos\n    disabled: true\n\n  - name: stract\n    engine: stract\n    shortcut: str\n    disabled: true\n\n  - name: svgrepo\n    engine: svgrepo\n    shortcut: svg\n    timeout: 10.0\n    disabled: true\n\n  - name: tootfinder\n    engine: tootfinder\n    shortcut: toot\n\n  - name: voidlinux\n    engine: voidlinux\n    shortcut: void\n    disabled: true\n\n  - name: wallhaven\n    engine: wallhaven\n    # api_key: abcdefghijklmnopqrstuvwxyz\n    shortcut: wh\n\n    # wikimini: online encyclopedia for children\n    # The fulltext and title parameter is necessary for Wikimini because\n    # sometimes it will not show the results and redirect instead\n  - name: wikimini\n    engine: xpath\n    shortcut: wkmn\n    search_url: https://fr.wikimini.org/w/index.php?search={query}&title=Sp%C3%A9cial%3ASearch&fulltext=Search\n    url_xpath: //li/div[@class=\"mw-search-result-heading\"]/a/@href\n    title_xpath: //li//div[@class=\"mw-search-result-heading\"]/a\n    content_xpath: //li/div[@class=\"searchresult\"]\n    categories: general\n    disabled: true\n    about:\n      website: https://wikimini.org/\n      wikidata_id: Q3568032\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n      language: fr\n\n  - name: wttr.in\n    engine: wttr\n    shortcut: wttr\n    timeout: 9.0\n\n  - name: brave\n    engine: brave\n    shortcut: br\n    time_range_support: true\n    paging: true\n    categories: [general, web]\n    brave_category: search\n    # brave_spellcheck: true\n\n  - name: brave.images\n    engine: brave\n    network: brave\n    shortcut: brimg\n    categories: [images, web]\n    brave_category: images\n\n  - name: brave.videos\n    engine: brave\n    network: brave\n    shortcut: brvid\n    categories: [videos, web]\n    brave_category: videos\n\n  - name: brave.news\n    engine: brave\n    network: brave\n    shortcut: brnews\n    categories: news\n    brave_category: news\n\n  # - name: brave.goggles\n  #   engine: brave\n  #   network: brave\n  #   shortcut: brgog\n  #   time_range_support: true\n  #   paging: true\n  #   categories: [general, web]\n  #   brave_category: goggles\n  #   Goggles: # required! This should be a URL ending in .goggle\n\n  - name: lib.rs\n    shortcut: lrs\n    engine: lib_rs\n    disabled: true\n\n  - name: sourcehut\n    shortcut: srht\n    engine: xpath\n    paging: true\n    search_url: https://sr.ht/projects?page={pageno}&search={query}\n    results_xpath: (//div[@class=\"event-list\"])[1]/div[@class=\"event\"]\n    url_xpath: ./h4/a[2]/@href\n    title_xpath: ./h4/a[2]\n    content_xpath: ./p\n    first_page_num: 1\n    categories: [it, repos]\n    disabled: true\n    about:\n      website: https://sr.ht\n      wikidata_id: Q78514485\n      official_api_documentation: https://man.sr.ht/\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n\n  - name: goo\n    shortcut: goo\n    engine: xpath\n    paging: true\n    search_url: https://search.goo.ne.jp/web.jsp?MT={query}&FR={pageno}0\n    url_xpath: //div[@class=\"result\"]/p[@class='title fsL1']/a/@href\n    title_xpath: //div[@class=\"result\"]/p[@class='title fsL1']/a\n    content_xpath: //p[contains(@class,'url fsM')]/following-sibling::p\n    first_page_num: 0\n    categories: [general, web]\n    disabled: true\n    timeout: 4.0\n    about:\n      website: https://search.goo.ne.jp\n      wikidata_id: Q249044\n      use_official_api: false\n      require_api_key: false\n      results: HTML\n      language: ja\n\n  - name: bt4g\n    engine: bt4g\n    shortcut: bt4g\n\n  - name: pkg.go.dev\n    engine: pkg_go_dev\n    shortcut: pgo\n    disabled: true\n\n# Doku engine lets you access to any Doku wiki instance:\n# A public one or a privete/corporate one.\n#  - name: ubuntuwiki\n#    engine: doku\n#    shortcut: uw\n#    base_url: 'https://doc.ubuntu-fr.org'\n\n# Be careful when enabling this engine if you are\n# running a public instance. Do not expose any sensitive\n# information. You can restrict access by configuring a list\n# of access tokens under tokens.\n#  - name: git grep\n#    engine: command\n#    command: ['git', 'grep', '{{QUERY}}']\n#    shortcut: gg\n#    tokens: []\n#    disabled: true\n#    delimiter:\n#        chars: ':'\n#        keys: ['filepath', 'code']\n\n# Be careful when enabling this engine if you are\n# running a public instance. Do not expose any sensitive\n# information. You can restrict access by configuring a list\n# of access tokens under tokens.\n#  - name: locate\n#    engine: command\n#    command: ['locate', '{{QUERY}}']\n#    shortcut: loc\n#    tokens: []\n#    disabled: true\n#    delimiter:\n#        chars: ' '\n#        keys: ['line']\n\n# Be careful when enabling this engine if you are\n# running a public instance. Do not expose any sensitive\n# information. You can restrict access by configuring a list\n# of access tokens under tokens.\n#  - name: find\n#    engine: command\n#    command: ['find', '.', '-name', '{{QUERY}}']\n#    query_type: path\n#    shortcut: fnd\n#    tokens: []\n#    disabled: true\n#    delimiter:\n#        chars: ' '\n#        keys: ['line']\n\n# Be careful when enabling this engine if you are\n# running a public instance. Do not expose any sensitive\n# information. You can restrict access by configuring a list\n# of access tokens under tokens.\n#  - name: pattern search in files\n#    engine: command\n#    command: ['fgrep', '{{QUERY}}']\n#    shortcut: fgr\n#    tokens: []\n#    disabled: true\n#    delimiter:\n#        chars: ' '\n#        keys: ['line']\n\n# Be careful when enabling this engine if you are\n# running a public instance. Do not expose any sensitive\n# information. You can restrict access by configuring a list\n# of access tokens under tokens.\n#  - name: regex search in files\n#    engine: command\n#    command: ['grep', '{{QUERY}}']\n#    shortcut: gr\n#    tokens: []\n#    disabled: true\n#    delimiter:\n#        chars: ' '\n#        keys: ['line']\n\ndoi_resolvers:\n  oadoi.org: 'https://oadoi.org/'\n  doi.org: 'https://doi.org/'\n  doai.io: 'https://dissem.in/'\n  sci-hub.se: 'https://sci-hub.se/'\n  sci-hub.st: 'https://sci-hub.st/'\n  sci-hub.ru: 'https://sci-hub.ru/'\n\ndefault_doi_resolver: 'oadoi.org'\n"
  },
  {
    "path": "searxng/setup_searxng.sh",
    "content": "#!/bin/bash\n\n# Script to automate SearXNG setup and deployment with Docker Compose\n\ncommand_exists() {\n    command -v \"$1\" &> /dev/null\n}\n\n# Check if Docker is installed\nif ! command_exists docker; then\n    echo \"Error: Docker is not installed. Please install Docker first.\"\n    echo \"On Ubuntu: sudo apt install docker.io\"\n    echo \"On macOS/Windows: Install Docker Desktop from https://www.docker.com/get-started/\"\n    exit 1\nfi\n\n# Check if Docker daemon is running\necho \"Checking if Docker daemon is running...\"\nif ! docker info &> /dev/null; then\n    echo \"Error: Docker daemon is not running or inaccessible.\"\n    if [ \"$(uname)\" = \"Linux\" ]; then\n        echo \"Trying to start Docker service (may require sudo)...\"\n        if sudo systemctl start docker &> /dev/null; then\n            echo \"Docker started successfully.\"\n        else\n            echo \"Failed to start Docker. Possible issues:\"\n            echo \"1. Run this script with sudo: sudo bash setup_searxng.sh\"\n            echo \"2. Check Docker installation: sudo systemctl status docker\"\n            echo \"3. Add your user to the docker group: sudo usermod -aG docker $USER (then log out and back in)\"\n            exit 1\n        fi\n    else\n        echo \"Please start Docker manually:\"\n        echo \"- On macOS/Windows: Open Docker Desktop.\"\n        echo \"- On Linux: Run 'sudo systemctl start docker' or check your distro's docs.\"\n        exit 1\n    fi\nelse\n    echo \"Docker daemon is running.\"\nfi\n\n# Check if Docker Compose is installed\nif ! command_exists docker-compose; then\n    echo \"Error: Docker Compose is not installed. Please install it first.\"\n    echo \"On Ubuntu: sudo apt install docker-compose\"\n    echo \"Or via pip: pip install docker-compose\"\n    exit 1\nfi\n\n# Create a directory for SearXNG config if it doesn’t exist\nmkdir -p searxng\ncd . || exit\n\n# Check if docker-compose.yml exists\nif [ ! -f \"docker-compose.yml\" ]; then\n    echo \"Error: docker-compose.yml not found in the current directory.\"\n    echo \"Please create it before running this script.\"\n    exit 1\nfi\n\n# Start containers to generate initial config files\necho \"Starting containers for initial setup...\"\nif ! docker-compose up -d; then\n    echo \"Error: Failed to start containers. Check Docker logs with 'docker compose logs'.\"\n    echo \"Possible fixes: Run with sudo or ensure port 8080 is free.\"\n    exit 1\nfi\nsleep 10\n\n# Generate a secret key and update settings\nSECRET_KEY=$(openssl rand -hex 32)\nif [ -f \"searxng/settings.yml\" ]; then\n    if [ \"$(uname)\" = \"Darwin\" ]; then\n        sed -i '' \"s/ultrasecretkey/$SECRET_KEY/g\" searxng/settings.yml || {\n            echo \"Warning: Failed to update settings.yml with secret key. Please check the file manually.\"\n        }\n    else\n        sed -i \"s/ultrasecretkey/$SECRET_KEY/g\" searxng/settings.yml || {\n            echo \"Warning: Failed to update settings.yml with secret key. Please check the file manually.\"\n        }\n    fi\nelse\n    echo \"Error: settings.yml not found. Initial setup may have failed.\"\n    docker-compose logs searxng\n    exit 1\nfi\n\n# Display status and access instructions\necho \"SearXNG setup complete!\"\ndocker ps -a --filter \"name=searxng\" --filter \"name=redis\"\necho \"Access SearXNG at: http://localhost:8080\""
  },
  {
    "path": "searxng/uwsgi.ini",
    "content": "[uwsgi]\n# Who will run the code\nuid = searxng\ngid = searxng\n\n# Number of workers (usually CPU count)\n# default value: %k (= number of CPU core, see Dockerfile)\nworkers = 4\n\n# Number of threads per worker\n# default value: 4 (see Dockerfile)\nenable-threads = 4\nthreads = 4\n\n# The right granted on the created socket\nchmod-socket = 666\n\n# Plugin to use and interpreter config\nsingle-interpreter = true\nmaster = true\nplugin = python3\nlazy-apps = true\nenable-threads = 4\n\n# Module to import\nmodule = searx.webapp\n\n# Virtualenv and python path\npythonpath = /usr/local/searxng/\nchdir = /usr/local/searxng/searx/\n\n# automatically set processes name to something meaningful\nauto-procname = true\n\n# Disable request logging for privacy\ndisable-logging = true\nlog-5xx = true\n\n# Set the max size of a request (request-body excluded)\nbuffer-size = 8192\n\n# No keep alive\n# See https://github.com/searx/searx-docker/issues/24\nadd-header = Connection: close\n\n# Follow SIGTERM convention\n# See https://github.com/searxng/searxng/issues/3427\ndie-on-term\n\n# uwsgi serves the static files\nstatic-map = /static=/usr/local/searxng/searx/static\nstatic-gzip-all = True\noffload-threads = 4\n"
  },
  {
    "path": "setup.py",
    "content": "from setuptools import setup, find_packages\n\nwith open(\"README.md\", \"r\", encoding=\"utf-8\") as fh:\n    long_description = fh.read()\n\nsetup(\n    name=\"agenticSeek\",\n    version=\"0.1.0\",\n    author=\"Fosowl\",\n    author_email=\"mlg.fcu@gmail.com\",\n    description=\"The open, local alternative to ManusAI\",\n    long_description=long_description,\n    long_description_content_type=\"text/markdown\",\n    url=\"https://github.com/Fosowl/agenticSeek\",\n    packages=find_packages(),\n    include_package_data=True,\n    install_requires=[\n        \"fastapi>=0.115.12\",\n        \"celery>=5.5.1\",\n        \"uvicorn>=0.34.0\",\n        \"flask>=3.1.0\",\n        \"aiofiles>=24.1.0\",\n        \"pydantic>=2.10.6\",\n        \"pydantic_core>=2.27.2\",\n        \"requests>=2.31.0\",\n        \"sacremoses>=0.0.53\",\n        \"numpy>=1.24.4\",\n        \"colorama>=0.4.6\",\n        \"python-dotenv>=1.0.0\",\n        \"playsound>=1.3.0\",\n        \"soundfile>=0.13.1\",\n        \"transformers>=4.46.3\",\n        \"torch>=2.4.1\",\n        \"ollama>=0.4.7\",\n        \"scipy>=1.9.3\",\n        \"kokoro>=0.7.12\",\n        \"protobuf>=3.20.3\",\n        \"termcolor>=2.5.0\",\n        \"ipython>=8.34.0\",\n        \"librosa>=0.10.2.post1\",\n        \"selenium>=4.29.0\",\n        \"markdownify>=1.1.0\",\n        \"text2emotion>=0.0.5\",\n        \"python-dotenv>=1.0.0\",\n        \"adaptive-classifier>=0.0.10\",\n        \"langid>=1.1.6\",\n        \"chromedriver-autoinstaller>=0.6.4\",\n        \"httpx>=0.27,<0.29\",\n        \"anyio>=3.5.0,<5\",\n        \"distro>=1.7.0,<2\",\n        \"jiter>=0.4.0,<1\",\n        \"fake_useragent>=2.1.0\",\n        \"selenium_stealth>=1.0.6\",\n        \"undetected-chromedriver>=3.5.5\",\n        \"sentencepiece>=0.2.0\",\n        \"openai\",\n        \"sniffio\",\n        \"tqdm>4\"\n    ],\n    extras_require={\n        \"chinese\": [\n            \"ordered_set\",\n            \"pypinyin\",\n            \"cn2an\",\n            \"jieba\",\n        ],\n    },\n    entry_points={\n        \"console_scripts\": [\n            \"agenticseek=main:main\",\n        ],\n    },\n    classifiers=[\n        \"Programming Language :: Python :: 3\",\n        \"License :: OSI Approved :: GNU General Public License v3 (GPLv3)\",\n        \"Operating System :: OS Independent\",\n    ],\n    python_requires=\">=3.9\",\n)\n"
  },
  {
    "path": "sources/agents/__init__.py",
    "content": "\nfrom .agent import Agent\nfrom .code_agent import CoderAgent\nfrom .casual_agent import CasualAgent\nfrom .file_agent import FileAgent\nfrom .planner_agent import PlannerAgent\nfrom .browser_agent import BrowserAgent\nfrom .mcp_agent import McpAgent\n\n__all__ = [\"Agent\", \"CoderAgent\", \"CasualAgent\", \"FileAgent\", \"PlannerAgent\", \"BrowserAgent\", \"McpAgent\"]\n"
  },
  {
    "path": "sources/agents/agent.py",
    "content": "\nfrom typing import Tuple, Callable\nfrom abc import abstractmethod\nimport os\nimport random\nimport time\n\nimport asyncio\nfrom concurrent.futures import ThreadPoolExecutor\n\nfrom sources.memory import Memory\nfrom sources.utility import pretty_print\nfrom sources.schemas import executorResult\n\nrandom.seed(time.time())\n\nclass Agent():\n    \"\"\"\n    An abstract class for all agents.\n    \"\"\"\n    def __init__(self, name: str,\n                       prompt_path:str,\n                       provider,\n                       verbose=False,\n                       browser=None) -> None:\n        \"\"\"\n        Args:\n            name (str): Name of the agent.\n            prompt_path (str): Path to the prompt file for the agent.\n            provider: The provider for the LLM.\n            recover_last_session (bool, optional): Whether to recover the last conversation. \n            verbose (bool, optional): Enable verbose logging if True. Defaults to False.\n            browser: The browser class for web navigation (only for browser agent).\n        \"\"\"\n            \n        self.agent_name = name\n        self.browser = browser\n        self.role = None\n        self.type = None\n        self.current_directory = os.getcwd()\n        self.llm = provider \n        self.memory = None\n        self.tools = {}\n        self.blocks_result = []\n        self.success = True\n        self.last_answer = \"\"\n        self.last_reasoning = \"\"\n        self.status_message = \"Haven't started yet\"\n        self.stop = False\n        self.verbose = verbose\n        self.executor = ThreadPoolExecutor(max_workers=1)\n    \n    @property\n    def get_agent_name(self) -> str:\n        return self.agent_name\n    \n    @property\n    def get_agent_type(self) -> str:\n        return self.type\n    \n    @property\n    def get_agent_role(self) -> str:\n        return self.role\n    \n    @property\n    def get_last_answer(self) -> str:\n        return self.last_answer\n    \n    @property\n    def get_last_reasoning(self) -> str:\n        return self.last_reasoning\n    \n    @property\n    def get_blocks(self) -> list:\n        return self.blocks_result\n    \n    @property\n    def get_status_message(self) -> str:\n        return self.status_message\n\n    @property\n    def get_tools(self) -> dict:\n        return self.tools\n    \n    @property\n    def get_success(self) -> bool:\n        return self.success\n    \n    def get_blocks_result(self) -> list:\n        return self.blocks_result\n\n    def add_tool(self, name: str, tool: Callable) -> None:\n        if tool is not Callable:\n            raise TypeError(\"Tool must be a callable object (a method)\")\n        self.tools[name] = tool\n    \n    def get_tools_name(self) -> list:\n        \"\"\"\n        Get the list of tools names.\n        \"\"\"\n        return list(self.tools.keys())\n    \n    def get_tools_description(self) -> str:\n        \"\"\"\n        Get the list of tools names and their description.\n        \"\"\"\n        description = \"\"\n        for name in self.get_tools_name():\n            description += f\"{name}: {self.tools[name].description}\\n\"\n        return description\n    \n    def load_prompt(self, file_path: str) -> str:\n        try:\n            with open(file_path, 'r', encoding=\"utf-8\") as f:\n                return f.read()\n        except FileNotFoundError:\n            raise FileNotFoundError(f\"Prompt file not found at path: {file_path}\")\n        except PermissionError:\n            raise PermissionError(f\"Permission denied to read prompt file at path: {file_path}\")\n        except Exception as e:\n            raise e\n    \n    def request_stop(self) -> None:\n        \"\"\"\n        Request the agent to stop.\n        \"\"\"\n        self.stop = True\n        self.status_message = \"Stopped\"\n    \n    @abstractmethod\n    def process(self, prompt, speech_module) -> str:\n        \"\"\"\n        abstract method, implementation in child class.\n        Process the prompt and return the answer of the agent.\n        \"\"\"\n        pass\n\n    def remove_reasoning_text(self, text: str) -> None:\n        \"\"\"\n        Remove the reasoning block of reasoning model like deepseek.\n        \"\"\"\n        end_tag = \"</think>\"\n        end_idx = text.rfind(end_tag)\n        if end_idx == -1:\n            return text\n        return text[end_idx+8:]\n    \n    def extract_reasoning_text(self, text: str) -> None:\n        \"\"\"\n        Extract the reasoning block of a reasoning model like deepseek.\n        \"\"\"\n        start_tag = \"<think>\"\n        end_tag = \"</think>\"\n        if text is None:\n            return None\n        start_idx = text.find(start_tag)\n        end_idx = text.rfind(end_tag)+8\n        return text[start_idx:end_idx]\n    \n    async def llm_request(self) -> Tuple[str, str]:\n        \"\"\"\n        Asynchronously ask the LLM to process the prompt.\n        \"\"\"\n        self.status_message = \"Thinking...\"\n        loop = asyncio.get_event_loop()\n        return await loop.run_in_executor(self.executor, self.sync_llm_request)\n    \n    def sync_llm_request(self) -> Tuple[str, str]:\n        \"\"\"\n        Ask the LLM to process the prompt and return the answer and the reasoning.\n        \"\"\"\n        memory = self.memory.get()\n        thought = self.llm.respond(memory, self.verbose)\n\n        reasoning = self.extract_reasoning_text(thought)\n        answer = self.remove_reasoning_text(thought)\n        self.memory.push('assistant', answer)\n        return answer, reasoning\n    \n    async def wait_message(self, speech_module):\n        if speech_module is None:\n            return\n        messages = [\"Please be patient, I am working on it.\",\n                    \"Computing... I recommand you have a coffee while I work.\",\n                    \"Hold on, I’m crunching numbers.\",\n                    \"Working on it, please let me think.\"]\n        loop = asyncio.get_event_loop()\n        return await loop.run_in_executor(self.executor, lambda: speech_module.speak(messages[random.randint(0, len(messages)-1)]))\n    \n    def get_last_tool_type(self) -> str:\n        return self.blocks_result[-1].tool_type if len(self.blocks_result) > 0 else None\n    \n    def raw_answer_blocks(self, answer: str) -> str:\n        \"\"\"\n        Return the answer with all the blocks inserted, as text.\n        \"\"\"\n        if self.last_answer is None:\n            return\n        raw = \"\"\n        lines = self.last_answer.split(\"\\n\")\n        for line in lines:\n            if \"block:\" in line:\n                block_idx = int(line.split(\":\")[1])\n                if block_idx < len(self.blocks_result):\n                    raw += self.blocks_result[block_idx].__str__()\n            else:\n                raw += line + \"\\n\"\n        return raw\n\n    def show_answer(self):\n        \"\"\"\n        Show the answer in a pretty way.\n        Show code blocks and their respective feedback by inserting them in the ressponse.\n        \"\"\"\n        if self.last_answer is None:\n            return\n        lines = self.last_answer.split(\"\\n\")\n        for line in lines:\n            if \"block:\" in line:\n                block_idx = int(line.split(\":\")[1])\n                if block_idx < len(self.blocks_result):\n                    self.blocks_result[block_idx].show()\n            else:\n                pretty_print(line, color=\"output\")\n\n    def remove_blocks(self, text: str) -> str:\n        \"\"\"\n        Remove all code/query blocks within a tag from the answer text.\n        \"\"\"\n        tag = f'```'\n        lines = text.split('\\n')\n        post_lines = []\n        in_block = False\n        block_idx = 0\n        for line in lines:\n            if tag in line and not in_block:\n                in_block = True\n                continue\n            if not in_block:\n                post_lines.append(line)\n            if tag in line:\n                in_block = False\n                post_lines.append(f\"block:{block_idx}\")\n                block_idx += 1\n        return \"\\n\".join(post_lines)\n    \n    def show_block(self, block: str) -> None:\n        \"\"\"\n        Show the block in a pretty way.\n        \"\"\"\n        pretty_print('▂'*64, color=\"status\")\n        pretty_print(block, color=\"code\")\n        pretty_print('▂'*64, color=\"status\")\n\n    def execute_modules(self, answer: str) -> Tuple[bool, str]:\n        \"\"\"\n        Execute all the tools the agent has and return the result.\n        \"\"\"\n        feedback = \"\"\n        success = True\n        blocks = None\n        if answer.startswith(\"```\"):\n            answer = \"I will execute:\\n\" + answer # there should always be a text before blocks for the function that display answer\n\n        self.success = True\n        for name, tool in self.tools.items():\n            feedback = \"\"\n            blocks, save_path = tool.load_exec_block(answer)\n\n            if blocks != None:\n                pretty_print(f\"Executing {len(blocks)} {name} blocks...\", color=\"status\")\n                for block in blocks:\n                    self.show_block(block)\n                    output = tool.execute([block])\n                    feedback = tool.interpreter_feedback(output) # tool interpreter feedback\n                    success = not tool.execution_failure_check(output)\n                    self.blocks_result.append(executorResult(block, feedback, success, name))\n                    if not success:\n                        self.success = False\n                        self.memory.push('user', feedback)\n                        return False, feedback\n                self.memory.push('user', feedback)\n                if save_path != None:\n                    tool.save_block(blocks, save_path)\n        return True, feedback\n"
  },
  {
    "path": "sources/agents/browser_agent.py",
    "content": "import re\nimport time\nfrom datetime import date\nfrom typing import List, Tuple, Type, Dict\nfrom enum import Enum\nimport asyncio\n\nfrom sources.utility import pretty_print, animate_thinking\nfrom sources.agents.agent import Agent\nfrom sources.tools.searxSearch import searxSearch\nfrom sources.browser import Browser\nfrom sources.logger import Logger\nfrom sources.memory import Memory\n\nclass Action(Enum):\n    REQUEST_EXIT = \"REQUEST_EXIT\"\n    FORM_FILLED = \"FORM_FILLED\"\n    GO_BACK = \"GO_BACK\"\n    NAVIGATE = \"NAVIGATE\"\n    SEARCH = \"SEARCH\"\n    \nclass BrowserAgent(Agent):\n    def __init__(self, name, prompt_path, provider, verbose=False, browser=None):\n        \"\"\"\n        The Browser agent is an agent that navigate the web autonomously in search of answer\n        \"\"\"\n        super().__init__(name, prompt_path, provider, verbose, browser)\n        self.tools = {\n            \"web_search\": searxSearch(),\n        }\n        self.role = \"web\"\n        self.type = \"browser_agent\"\n        self.browser = browser\n        self.current_page = \"\"\n        self.search_history = []\n        self.navigable_links = []\n        self.last_action = Action.NAVIGATE.value\n        self.notes = []\n        self.date = self.get_today_date()\n        self.logger = Logger(\"browser_agent.log\")\n        self.memory = Memory(self.load_prompt(prompt_path),\n                        recover_last_session=False, # session recovery in handled by the interaction class\n                        memory_compression=False,\n                        model_provider=provider.get_model_name() if provider else None)\n    \n    def get_today_date(self) -> str:\n        \"\"\"Get the date\"\"\"\n        date_time = date.today()\n        return date_time.strftime(\"%B %d, %Y\")\n\n    def extract_links(self, search_result: str) -> List[str]:\n        \"\"\"Extract all links from a sentence.\"\"\"\n        pattern = r'(https?://\\S+|www\\.\\S+)'\n        matches = re.findall(pattern, search_result)\n        trailing_punct = \".,!?;:)\"\n        cleaned_links = [link.rstrip(trailing_punct) for link in matches]\n        self.logger.info(f\"Extracted links: {cleaned_links}\")\n        return self.clean_links(cleaned_links)\n    \n    def extract_form(self, text: str) -> List[str]:\n        \"\"\"Extract form written by the LLM in format [input_name](value)\"\"\"\n        inputs = []\n        matches = re.findall(r\"\\[\\w+\\]\\([^)]+\\)\", text)\n        return matches\n        \n    def clean_links(self, links: List[str]) -> List[str]:\n        \"\"\"Ensure no '.' at the end of link\"\"\"\n        links_clean = []\n        for link in links:\n            link = link.strip()\n            if not (link[-1].isalpha() or link[-1].isdigit()):\n                links_clean.append(link[:-1])\n            else:\n                links_clean.append(link)\n        return links_clean\n\n    def get_unvisited_links(self) -> List[str]:\n        return \"\\n\".join([f\"[{i}] {link}\" for i, link in enumerate(self.navigable_links) if link not in self.search_history])\n\n    def make_newsearch_prompt(self, prompt: str, search_result: dict) -> str:\n        search_choice = self.stringify_search_results(search_result)\n        self.logger.info(f\"Search results: {search_choice}\")\n        return f\"\"\"\n        Based on the search result:\n        {search_choice}\n        Your goal is to find accurate and complete information to satisfy the user’s request.\n        User request: {prompt}\n        To proceed, choose a relevant link from the search results. Announce your choice by saying: \"I will navigate to <link>\"\n        Do not explain your choice.\n        \"\"\"\n    \n    def make_navigation_prompt(self, user_prompt: str, page_text: str) -> str:\n        remaining_links = self.get_unvisited_links() \n        remaining_links_text = remaining_links if remaining_links is not None else \"No links remaining, do a new search.\" \n        inputs_form = self.browser.get_form_inputs()\n        inputs_form_text = '\\n'.join(inputs_form)\n        notes = '\\n'.join(self.notes)\n        self.logger.info(f\"Making navigation prompt with page text: {page_text[:100]}...\\nremaining links: {remaining_links_text}\")\n        self.logger.info(f\"Inputs form: {inputs_form_text}\")\n        self.logger.info(f\"Notes: {notes}\")\n\n        return f\"\"\"\n        You are navigating the web.\n\n        **Current Context**\n\n        Webpage ({self.current_page}) content:\n        {page_text}\n\n        Allowed Navigation Links:\n        {remaining_links_text}\n\n        Inputs forms:\n        {inputs_form_text}\n\n        End of webpage ({self.current_page}.\n\n        # Instruction\n\n        1. **Evaluate if the page is relevant for user’s query and document finding:**\n          - If the page is relevant, extract and summarize key information in concise notes (Note: <your note>)\n          - If page not relevant, state: \"Error: <specific reason the page does not address the query>\" and either return to the previous page or navigate to a new link.\n          - Notes should be factual, useful summaries of relevant content, they should always include specific names or link. Written as: \"On <website URL>, <key fact 1>. <Key fact 2>. <Additional insight>.\" Avoid phrases like \"the page provides\" or \"I found that.\"\n        2. **Navigate to a link by either: **\n          - Saying I will navigate to (write down the full URL) www.example.com/cats\n          - Going back: If no link seems helpful, say: {Action.GO_BACK.value}.\n        3. **Fill forms on the page:**\n          - Fill form only when relevant.\n          - Use Login if username/password specified by user. For quick task create account, remember password in a note.\n          - You can fill a form using [form_name](value). Don't {Action.GO_BACK.value} when filling form.\n          - If a form is irrelevant or you lack informations (eg: don't know user email) leave it empty.\n        4. **Decide if you completed the task**\n          - Check your notes. Do they fully answer the question? Did you verify with multiple pages?\n          - Are you sure it’s correct?\n          - If yes to all, say {Action.REQUEST_EXIT}.\n          - If no, or a page lacks info, go to another link.\n          - Never stop or ask the user for help.\n        \n        **Rules:**\n        - Do not write \"The page talk about ...\", write your finding on the page and how they contribute to an answer.\n        - Put note in a single paragraph.\n        - When you exit, explain why.\n        \n        # Example:\n        \n        Example 1 (useful page, no need go futher):\n        Note: According to karpathy site LeCun net is ...\n        No link seem useful to provide futher information.\n        Action: {Action.GO_BACK.value}\n\n        Example 2 (not useful, see useful link on page):\n        Error: reddit.com/welcome does not discuss anything related to the user’s query.\n        There is a link that could lead to the information.\n        Action: navigate to http://reddit.com/r/locallama\n\n        Example 3 (not useful, no related links):\n        Error: x.com does not discuss anything related to the user’s query and no navigation link are usefull.\n        Action: {Action.GO_BACK.value}\n\n        Example 3 (clear definitive query answer found or enought notes taken):\n        I took 10 notes so far with enought finding to answer user question.\n        Therefore I should exit the web browser.\n        Action: {Action.REQUEST_EXIT.value}\n\n        Example 4 (loging form visible):\n\n        Note: I am on the login page, I will type the given username and password. \n        Action:\n        [username_field](David)\n        [password_field](edgerunners77)\n\n        Remember, user asked:\n        {user_prompt}\n        You previously took these notes:\n        {notes}\n        Do not Step-by-Step explanation. Write comprehensive Notes or Error as a long paragraph followed by your action.\n        You must always take notes.\n        \"\"\"\n    \n    async def llm_decide(self, prompt: str, show_reasoning: bool = False) -> Tuple[str, str]:\n        animate_thinking(\"Thinking...\", color=\"status\")\n        self.memory.push('user', prompt)\n        answer, reasoning = await self.llm_request()\n        self.last_reasoning = reasoning\n        if show_reasoning:\n            pretty_print(reasoning, color=\"failure\")\n        pretty_print(answer, color=\"output\")\n        return answer, reasoning\n    \n    def select_unvisited(self, search_result: List[str]) -> List[str]:\n        results_unvisited = []\n        for res in search_result:\n            if res[\"link\"] not in self.search_history:\n                results_unvisited.append(res) \n        self.logger.info(f\"Unvisited links: {results_unvisited}\")\n        return results_unvisited\n\n    def jsonify_search_results(self, results_string: str) -> List[str]:\n        result_blocks = results_string.split(\"\\n\\n\")\n        parsed_results = []\n        for block in result_blocks:\n            if not block.strip():\n                continue\n            lines = block.split(\"\\n\")\n            result_dict = {}\n            for line in lines:\n                if line.startswith(\"Title:\"):\n                    result_dict[\"title\"] = line.replace(\"Title:\", \"\").strip()\n                elif line.startswith(\"Snippet:\"):\n                    result_dict[\"snippet\"] = line.replace(\"Snippet:\", \"\").strip()\n                elif line.startswith(\"Link:\"):\n                    result_dict[\"link\"] = line.replace(\"Link:\", \"\").strip()\n            if result_dict:\n                parsed_results.append(result_dict)\n        return parsed_results \n    \n    def stringify_search_results(self, results_arr: List[str]) -> str:\n        return '\\n\\n'.join([f\"Link: {res['link']}\\nPreview: {res['snippet']}\" for res in results_arr])\n    \n    def parse_answer(self, text):\n        lines = text.split('\\n')\n        saving = False\n        buffer = []\n        links = []\n        for line in lines:\n            if line == '' or 'action:' in line.lower():\n                saving = False\n            if \"note\" in line.lower():\n                saving = True\n            if saving:\n                buffer.append(line.replace(\"notes:\", ''))\n            else:\n                links.extend(self.extract_links(line))\n        self.notes.append('. '.join(buffer).strip())\n        return links\n    \n    def select_link(self, links: List[str]) -> str | None:\n        \"\"\"\n        Select the first unvisited link that is not the current page.\n        Preference is given to links not in search_history.\n        \"\"\"\n        for lk in links:\n            if lk == self.current_page or lk in self.search_history:\n                self.logger.info(f\"Skipping already visited or current link: {lk}\")\n                continue\n            self.logger.info(f\"Selected link: {lk}\")\n            return lk\n        self.logger.warning(\"No suitable link selected.\")\n        return None\n    \n    def get_page_text(self, limit_to_model_ctx = False) -> str:\n        \"\"\"Get the text content of the current page.\"\"\"\n        page_text = self.browser.get_text()\n        if limit_to_model_ctx:\n            #page_text = self.memory.compress_text_to_max_ctx(page_text)\n            page_text = self.memory.trim_text_to_max_ctx(page_text)\n        return page_text\n    \n    def conclude_prompt(self, user_query: str) -> str:\n        annotated_notes = [f\"{i+1}: {note.lower()}\" for i, note in enumerate(self.notes)]\n        search_note = '\\n'.join(annotated_notes)\n        pretty_print(f\"AI notes:\\n{search_note}\", color=\"success\")\n        return f\"\"\"\n        Following a human request:\n        {user_query}\n        A web browsing AI made the following finding across different pages:\n        {search_note}\n\n        Expand on the finding or step that lead to success, and provide a conclusion that answer the request. Include link when possible.\n        Do not give advices or try to answer the human. Just structure the AI finding in a structured and clear way.\n        You should answer in the same language as the user.\n        \"\"\"\n    \n    def search_prompt(self, user_prompt: str) -> str:\n        return f\"\"\"\n        Current date: {self.date}\n        Make a efficient search engine query to help users with their request:\n        {user_prompt}\n        Example:\n        User: \"go to twitter, login with username toto and password pass79 to my twitter and say hello everyone \"\n        You: search: Twitter login page. \n\n        User: \"I need info on the best laptops for AI this year.\"\n        You: \"search: best laptops 2025 to run Machine Learning model, reviews\"\n\n        User: \"Search for recent news about space missions.\"\n        You: \"search: Recent space missions news, {self.date}\"\n\n        Do not explain, do not write anything beside the search query.\n        Except if query does not make any sense for a web search then explain why and say {Action.REQUEST_EXIT.value}\n        Do not try to answer query. you can only formulate search term or exit.\n        \"\"\"\n    \n    def handle_update_prompt(self, user_prompt: str, page_text: str, fill_success: bool) -> str:\n        prompt = f\"\"\"\n        You are a web browser.\n        You just filled a form on the page.\n        Now you should see the result of the form submission on the page:\n        Page text:\n        {page_text}\n        The user asked: {user_prompt}\n        Does the page answer the user’s query now? Are you still on a login page or did you get redirected?\n        If it does, take notes of the useful information, write down result and say {Action.FORM_FILLED.value}.\n        if it doesn’t, say: Error: Attempt to fill form didn't work {Action.GO_BACK.value}.\n        If you were previously on a login form, no need to take notes.\n        \"\"\"\n        if not fill_success:\n            prompt += f\"\"\"\n            According to browser feedback, the form was not filled correctly. Is that so? you might consider other strategies.\n            \"\"\"\n        return prompt\n    \n    def show_search_results(self, search_result: List[str]):\n        pretty_print(\"\\nSearch results:\", color=\"output\")\n        for res in search_result:\n            pretty_print(f\"Title: {res['title']} - \", color=\"info\", no_newline=True)\n            pretty_print(f\"Link: {res['link']}\", color=\"status\")\n    \n    def stuck_prompt(self, user_prompt: str, unvisited: List[str]) -> str:\n        \"\"\"\n        Prompt for when the agent repeat itself, can happen when fail to extract a link.\n        \"\"\"\n        prompt = self.make_newsearch_prompt(user_prompt, unvisited)\n        prompt += f\"\"\"\n        You previously said:\n        {self.last_answer}\n        You must consider other options. Choose other link.\n        \"\"\"\n        return prompt\n    \n    async def process(self, user_prompt: str, speech_module: type) -> Tuple[str, str]:\n        \"\"\"\n        Process the user prompt to conduct an autonomous web search.\n        Start with a google search with searxng using web_search tool.\n        Then enter a navigation logic to find the answer or conduct required actions.\n        Args:\n          user_prompt: The user's input query\n          speech_module: Optional speech output module\n        Returns:\n            tuple containing the final answer and reasoning\n        \"\"\"\n        complete = False\n\n        animate_thinking(f\"Thinking...\", color=\"status\")\n        mem_begin_idx = self.memory.push('user', self.search_prompt(user_prompt))\n        ai_prompt, reasoning = await self.llm_request()\n        if Action.REQUEST_EXIT.value in ai_prompt:\n            pretty_print(f\"Web agent requested exit.\\n{reasoning}\\n\\n{ai_prompt}\", color=\"failure\")\n            return ai_prompt, \"\" \n        animate_thinking(f\"Searching...\", color=\"status\")\n        self.status_message = \"Searching...\"\n        search_result_raw = self.tools[\"web_search\"].execute([ai_prompt], False)\n        search_result = self.jsonify_search_results(search_result_raw)[:16]\n        self.show_search_results(search_result)\n        prompt = self.make_newsearch_prompt(user_prompt, search_result)\n        unvisited = [None]\n        while not complete and len(unvisited) > 0 and not self.stop:\n            self.memory.clear()\n            unvisited = self.select_unvisited(search_result)\n            answer, reasoning = await self.llm_decide(prompt, show_reasoning = False)\n            if self.stop:\n                pretty_print(f\"Requested stop.\", color=\"failure\")\n                break\n            if self.last_answer == answer:\n                prompt = self.stuck_prompt(user_prompt, unvisited)\n                continue\n            self.last_answer = answer\n            pretty_print('▂'*32, color=\"status\")\n\n            extracted_form = self.extract_form(answer)\n            if len(extracted_form) > 0:\n                self.status_message = \"Filling web form...\"\n                pretty_print(f\"Filling inputs form...\", color=\"status\")\n                fill_success = self.browser.fill_form(extracted_form)\n                page_text = self.get_page_text(limit_to_model_ctx=True)\n                answer = self.handle_update_prompt(user_prompt, page_text, fill_success)\n                answer, reasoning = await self.llm_decide(prompt)\n\n            if Action.FORM_FILLED.value in answer:\n                pretty_print(f\"Filled form. Handling page update.\", color=\"status\")\n                page_text = self.get_page_text(limit_to_model_ctx=True)\n                self.navigable_links = self.browser.get_navigable()\n                prompt = self.make_navigation_prompt(user_prompt, page_text)\n                continue\n\n            links = self.parse_answer(answer)\n            link = self.select_link(links)\n            if link == self.current_page:\n                pretty_print(f\"Already visited {link}. Search callback.\", color=\"status\")\n                prompt = self.make_newsearch_prompt(user_prompt, unvisited)\n                self.search_history.append(link)\n                continue\n\n            if Action.REQUEST_EXIT.value in answer:\n                self.status_message = \"Exiting web browser...\"\n                pretty_print(f\"Agent requested exit.\", color=\"status\")\n                complete = True\n                break\n\n            if (link == None and len(extracted_form) < 3) or Action.GO_BACK.value in answer or link in self.search_history:\n                pretty_print(f\"Going back to results. Still {len(unvisited)}\", color=\"status\")\n                self.status_message = \"Going back to search results...\"\n                request_prompt = user_prompt\n                if link is None:\n                    request_prompt += f\"\\nYou previously choosen:\\n{self.last_answer} but the website is unavailable. Consider other options.\"\n                prompt = self.make_newsearch_prompt(request_prompt, unvisited)\n                self.search_history.append(link)\n                self.current_page = link\n                continue\n\n            animate_thinking(f\"Navigating to {link}\", color=\"status\")\n            if speech_module: speech_module.speak(f\"Navigating to {link}\")\n            nav_ok = self.browser.go_to(link)\n            self.search_history.append(link)\n            if not nav_ok:\n                pretty_print(f\"Failed to navigate to {link}.\", color=\"failure\")\n                prompt = self.make_newsearch_prompt(user_prompt, unvisited)\n                continue\n            self.current_page = link\n            page_text = self.get_page_text(limit_to_model_ctx=True)\n            self.navigable_links = self.browser.get_navigable()\n            prompt = self.make_navigation_prompt(user_prompt, page_text)\n            self.status_message = \"Navigating...\"\n            self.browser.screenshot()\n\n        pretty_print(\"Exited navigation, starting to summarize finding...\", color=\"status\")\n        prompt = self.conclude_prompt(user_prompt)\n        mem_last_idx = self.memory.push('user', prompt)\n        self.status_message = \"Summarizing findings...\"\n        answer, reasoning = await self.llm_request()\n        pretty_print(answer, color=\"output\")\n        self.status_message = \"Ready\"\n        self.last_answer = answer\n        return answer, reasoning\n\nif __name__ == \"__main__\":\n    pass\n"
  },
  {
    "path": "sources/agents/casual_agent.py",
    "content": "import asyncio\n\nfrom sources.utility import pretty_print, animate_thinking\nfrom sources.agents.agent import Agent\nfrom sources.tools.searxSearch import searxSearch\nfrom sources.tools.flightSearch import FlightSearch\nfrom sources.tools.fileFinder import FileFinder\nfrom sources.tools.BashInterpreter import BashInterpreter\nfrom sources.memory import Memory\n\nclass CasualAgent(Agent):\n    def __init__(self, name, prompt_path, provider, verbose=False):\n        \"\"\"\n        The casual agent is a special for casual talk to the user without specific tasks.\n        \"\"\"\n        super().__init__(name, prompt_path, provider, verbose, None)\n        self.tools = {\n        } # No tools for the casual agent\n        self.role = \"talk\"\n        self.type = \"casual_agent\"\n        self.memory = Memory(self.load_prompt(prompt_path),\n                                recover_last_session=False, # session recovery in handled by the interaction class\n                                memory_compression=False,\n                                model_provider=provider.get_model_name())\n    \n    async def process(self, prompt, speech_module) -> str:\n        self.memory.push('user', prompt)\n        animate_thinking(\"Thinking...\", color=\"status\")\n        answer, reasoning = await self.llm_request()\n        self.last_answer = answer\n        self.status_message = \"Ready\"\n        return answer, reasoning\n\nif __name__ == \"__main__\":\n    pass"
  },
  {
    "path": "sources/agents/code_agent.py",
    "content": "import platform, os\nimport asyncio\n\nfrom sources.utility import pretty_print, animate_thinking\nfrom sources.agents.agent import Agent, executorResult\nfrom sources.tools.C_Interpreter import CInterpreter\nfrom sources.tools.GoInterpreter import GoInterpreter\nfrom sources.tools.PyInterpreter import PyInterpreter\nfrom sources.tools.BashInterpreter import BashInterpreter\nfrom sources.tools.JavaInterpreter import JavaInterpreter\nfrom sources.tools.fileFinder import FileFinder\nfrom sources.logger import Logger\nfrom sources.memory import Memory\n\nclass CoderAgent(Agent):\n    \"\"\"\n    The code agent is an agent that can write and execute code.\n    \"\"\"\n    def __init__(self, name, prompt_path, provider, verbose=False):\n        super().__init__(name, prompt_path, provider, verbose, None)\n        self.tools = {\n            \"bash\": BashInterpreter(),\n            \"python\": PyInterpreter(),\n            \"c\": CInterpreter(),\n            \"go\": GoInterpreter(),\n            \"java\": JavaInterpreter(),\n            \"file_finder\": FileFinder()\n        }\n        self.work_dir = self.tools[\"file_finder\"].get_work_dir()\n        self.role = \"code\"\n        self.type = \"code_agent\"\n        self.logger = Logger(\"code_agent.log\")\n        self.memory = Memory(self.load_prompt(prompt_path),\n                        recover_last_session=False, # session recovery in handled by the interaction class\n                        memory_compression=False,\n                        model_provider=provider.get_model_name())\n    \n    def add_sys_info_prompt(self, prompt):\n        \"\"\"Add system information to the prompt.\"\"\"\n        info = f\"System Info:\\n\" \\\n               f\"OS: {platform.system()} {platform.release()}\\n\" \\\n               f\"Python Version: {platform.python_version()}\\n\" \\\n               f\"\\nYou must save file at root directory: {self.work_dir}\"\n        return f\"{prompt}\\n\\n{info}\"\n\n    async def process(self, prompt, speech_module) -> str:\n        answer = \"\"\n        attempt = 0\n        max_attempts = 5\n        prompt = self.add_sys_info_prompt(prompt)\n        self.memory.push('user', prompt)\n        clarify_trigger = \"REQUEST_CLARIFICATION\"\n\n        while attempt < max_attempts and not self.stop:\n            print(\"Stopped?\", self.stop)\n            animate_thinking(\"Thinking...\", color=\"status\")\n            await self.wait_message(speech_module)\n            answer, reasoning = await self.llm_request()\n            self.last_reasoning = reasoning\n            if clarify_trigger in answer:\n                self.last_answer = answer\n                await asyncio.sleep(0)\n                return answer, reasoning\n            if not \"```\" in answer:\n                self.last_answer = answer\n                await asyncio.sleep(0)\n                break\n            self.show_answer()\n            animate_thinking(\"Executing code...\", color=\"status\")\n            self.status_message = \"Executing code...\"\n            self.logger.info(f\"Attempt {attempt + 1}:\\n{answer}\")\n            exec_success, feedback = self.execute_modules(answer)\n            self.logger.info(f\"Execution result: {exec_success}\")\n            answer = self.remove_blocks(answer)\n            self.last_answer = answer\n            await asyncio.sleep(0)\n            if exec_success and self.get_last_tool_type() != \"bash\":\n                break\n            pretty_print(f\"Execution failure:\\n{feedback}\", color=\"failure\")\n            pretty_print(\"Correcting code...\", color=\"status\")\n            self.status_message = \"Correcting code...\"\n            attempt += 1\n        self.status_message = \"Ready\"\n        if attempt == max_attempts:\n            return \"I'm sorry, I couldn't find a solution to your problem. How would you like me to proceed ?\", reasoning\n        self.last_answer = answer\n        return answer, reasoning\n\nif __name__ == \"__main__\":\n    pass"
  },
  {
    "path": "sources/agents/file_agent.py",
    "content": "import asyncio\n\nfrom sources.utility import pretty_print, animate_thinking\nfrom sources.agents.agent import Agent\nfrom sources.tools.fileFinder import FileFinder\nfrom sources.tools.BashInterpreter import BashInterpreter\nfrom sources.memory import Memory\n\nclass FileAgent(Agent):\n    def __init__(self, name, prompt_path, provider, verbose=False):\n        \"\"\"\n        The file agent is a special agent for file operations.\n        \"\"\"\n        super().__init__(name, prompt_path, provider, verbose, None)\n        self.tools = {\n            \"file_finder\": FileFinder(),\n            \"bash\": BashInterpreter()\n        }\n        self.work_dir = self.tools[\"file_finder\"].get_work_dir()\n        self.role = \"files\"\n        self.type = \"file_agent\"\n        self.memory = Memory(self.load_prompt(prompt_path),\n                        recover_last_session=False, # session recovery in handled by the interaction class\n                        memory_compression=False,\n                        model_provider=provider.get_model_name())\n    \n    async def process(self, prompt, speech_module) -> str:\n        exec_success = False\n        prompt += f\"\\nYou must work in directory: {self.work_dir}\"\n        self.memory.push('user', prompt)\n        while exec_success is False and not self.stop:\n            await self.wait_message(speech_module)\n            animate_thinking(\"Thinking...\", color=\"status\")\n            answer, reasoning = await self.llm_request()\n            self.last_reasoning = reasoning\n            exec_success, _ = self.execute_modules(answer)\n            answer = self.remove_blocks(answer)\n            self.last_answer = answer\n        self.status_message = \"Ready\"\n        return answer, reasoning\n\nif __name__ == \"__main__\":\n    pass"
  },
  {
    "path": "sources/agents/mcp_agent.py",
    "content": "import os\nimport asyncio\n\nfrom sources.utility import pretty_print, animate_thinking\nfrom sources.agents.agent import Agent\nfrom sources.tools.mcpFinder import MCP_finder\nfrom sources.memory import Memory\n\n# NOTE MCP agent is an active work in progress, not functional yet.\n\nclass McpAgent(Agent):\n\n    def __init__(self, name, prompt_path, provider, verbose=False):\n        \"\"\"\n        The mcp agent is a special agent for using MCPs.\n        MCP agent will be disabled if the user does not explicitly set the MCP_FINDER_API_KEY in environment variable.\n        \"\"\"\n        super().__init__(name, prompt_path, provider, verbose, None)\n        keys = self.get_api_keys()\n        self.tools = {\n            \"mcp_finder\": MCP_finder(keys[\"mcp_finder\"]),\n            # add mcp tools here\n        }\n        self.role = \"mcp\"\n        self.type = \"mcp_agent\"\n        self.memory = Memory(self.load_prompt(prompt_path),\n                                recover_last_session=False, # session recovery in handled by the interaction class\n                                memory_compression=False,\n                                model_provider=provider.get_model_name())\n        self.enabled = True\n    \n    def get_api_keys(self) -> dict:\n        \"\"\"\n        Returns the API keys for the tools.\n        \"\"\"\n        api_key_mcp_finder = os.getenv(\"MCP_FINDER_API_KEY\")\n        if not api_key_mcp_finder or api_key_mcp_finder == \"\":\n            pretty_print(\"MCP Finder disabled.\", color=\"warning\")\n            self.enabled = False\n        return {\n            \"mcp_finder\": api_key_mcp_finder\n        }\n    \n    def expand_prompt(self, prompt):\n        \"\"\"\n        Expands the prompt with the tools available.\n        \"\"\"\n        tools_str = self.get_tools_description()\n        prompt += f\"\"\"\n        You can use the following tools and MCPs:\n        {tools_str}\n        \"\"\"\n        return prompt\n    \n    async def process(self, prompt, speech_module) -> str:\n        if self.enabled == False:\n            return \"MCP Agent is disabled.\"\n        prompt = self.expand_prompt(prompt)\n        self.memory.push('user', prompt)\n        working = True\n        while working == True:\n            animate_thinking(\"Thinking...\", color=\"status\")\n            answer, reasoning = await self.llm_request()\n            exec_success, _ = self.execute_modules(answer)\n            answer = self.remove_blocks(answer)\n            self.last_answer = answer\n            self.status_message = \"Ready\"\n            if len(self.blocks_result) == 0:\n                working = False\n        return answer, reasoning\n\nif __name__ == \"__main__\":\n    pass"
  },
  {
    "path": "sources/agents/planner_agent.py",
    "content": "import json\nfrom typing import List, Tuple, Type, Dict\nfrom sources.utility import pretty_print, animate_thinking\nfrom sources.agents.agent import Agent\nfrom sources.agents.code_agent import CoderAgent\nfrom sources.agents.file_agent import FileAgent\nfrom sources.agents.browser_agent import BrowserAgent\nfrom sources.agents.casual_agent import CasualAgent\nfrom sources.text_to_speech import Speech\nfrom sources.tools.tools import Tools\nfrom sources.logger import Logger\nfrom sources.memory import Memory\n\nclass PlannerAgent(Agent):\n    def __init__(self, name, prompt_path, provider, verbose=False, browser=None):\n        \"\"\"\n        The planner agent is a special agent that divides and conquers the task.\n        \"\"\"\n        super().__init__(name, prompt_path, provider, verbose, None)\n        self.tools = {\n            \"json\": Tools()\n        }\n        self.tools['json'].tag = \"json\"\n        self.browser = browser\n        self.agents = {\n            \"coder\": CoderAgent(name, \"prompts/base/coder_agent.txt\", provider, verbose=False),\n            \"file\": FileAgent(name, \"prompts/base/file_agent.txt\", provider, verbose=False),\n            \"web\": BrowserAgent(name, \"prompts/base/browser_agent.txt\", provider, verbose=False, browser=browser),\n            \"casual\": CasualAgent(name, \"prompts/base/casual_agent.txt\", provider, verbose=False)\n        }\n        self.role = \"planification\"\n        self.type = \"planner_agent\"\n        self.memory = Memory(self.load_prompt(prompt_path),\n                                recover_last_session=False, # session recovery in handled by the interaction class\n                                memory_compression=False,\n                                model_provider=provider.get_model_name())\n        self.logger = Logger(\"planner_agent.log\")\n    \n    def get_task_names(self, text: str) -> List[str]:\n        \"\"\"\n        Extracts task names from the given text.\n        This method processes a multi-line string, where each line may represent a task name.\n        containing '##' or starting with a digit. The valid task names are collected and returned.\n        Args:\n            text (str): A string containing potential task titles (eg: Task 1: I will...).\n        Returns:\n            List[str]: A list of extracted task names that meet the specified criteria.\n        \"\"\"\n        tasks_names = []\n        lines = text.strip().split('\\n')\n        for line in lines:\n            if line is None:\n                continue\n            line = line.strip()\n            if len(line) == 0:\n                continue\n            if '##' in line or line[0].isdigit():\n                tasks_names.append(line)\n                continue\n        self.logger.info(f\"Found {len(tasks_names)} tasks names.\")\n        return tasks_names\n\n    def parse_agent_tasks(self, text: str) -> List[Tuple[str, str]]:\n        \"\"\"\n        Parses agent tasks from the given LLM text.\n        This method extracts task information from a JSON. It identifies task names and their details.\n        Args:\n            text (str): The input text containing task information in a JSON-like format.\n        Returns:\n            List[Tuple[str, str]]: A list of tuples containing task names and their details.\n        \"\"\"\n        tasks = []\n        tasks_names = self.get_task_names(text)\n\n        blocks, _ = self.tools[\"json\"].load_exec_block(text)\n        if blocks == None:\n            return []\n        for block in blocks:\n            try:\n                line_json = json.loads(block)\n            except json.JSONDecodeError as e:\n                self.logger.warning(f\"Failed to parse JSON block: {e}\")\n                pretty_print(f\"JSON parsing error: {e}\", color=\"warning\")\n                return []\n            if 'plan' in line_json:\n                for task in line_json['plan']:\n                    if task['agent'].lower() not in [ag_name.lower() for ag_name in self.agents.keys()]:\n                        self.logger.warning(f\"Agent {task['agent']} does not exist.\")\n                        pretty_print(f\"Agent {task['agent']} does not exist.\", color=\"warning\")\n                        return []\n                    try:\n                        agent = {\n                            'agent': task['agent'],\n                            'id': task['id'],\n                            'task': task['task']\n                        }\n                    except:\n                        self.logger.warning(\"Missing field in json plan.\")\n                        return []\n                    self.logger.info(f\"Created agent {task['agent']} with task: {task['task']}\")\n                    if 'need' in task:\n                        self.logger.info(f\"Agent {task['agent']} was given info:\\n {task['need']}\")\n                        agent['need'] = task['need']\n                    tasks.append(agent)\n        if len(tasks_names) != len(tasks):\n            names = [task['task'] for task in tasks]\n            return list(map(list, zip(names, tasks)))\n        return list(map(list, zip(tasks_names, tasks)))\n    \n    def make_prompt(self, task: str, agent_infos_dict: dict) -> str:\n        \"\"\"\n        Generates a prompt for the agent based on the task and previous agents work information.\n        Args:\n            task (str): The task to be performed.\n            agent_infos_dict (dict): A dictionary containing information from other agents.\n        Returns:\n            str: The formatted prompt for the agent.\n        \"\"\"\n        infos = \"\"\n        if agent_infos_dict is None or len(agent_infos_dict) == 0:\n            infos = \"No needed informations.\"\n        else:\n            for agent_id, info in agent_infos_dict.items():\n                infos += f\"\\t- According to agent {agent_id}:\\n{info}\\n\\n\"\n        prompt = f\"\"\"\n        You are given informations from your AI friends work:\n        {infos}\n        Your task is:\n        {task}\n        \"\"\"\n        self.logger.info(f\"Prompt for agent:\\n{prompt}\")\n        return prompt\n    \n    def show_plan(self, agents_tasks: List[dict], answer: str) -> None:\n        \"\"\"\n        Displays the plan made by the agent.\n        Args:\n            agents_tasks (dict): The tasks assigned to each agent.\n            answer (str): The answer from the LLM.\n        \"\"\"\n        if agents_tasks == []:\n            pretty_print(answer, color=\"warning\")\n            pretty_print(\"Failed to make a plan. This can happen with (too) small LLM. Clarify your request and insist on it making a plan within ```json.\", color=\"failure\")\n            return\n        pretty_print(\"\\n▂▘ P L A N ▝▂\", color=\"status\")\n        for task_name, task in agents_tasks:\n            pretty_print(f\"{task['agent']} -> {task['task']}\", color=\"info\")\n        pretty_print(\"▔▗ E N D ▖▔\", color=\"status\")\n\n    async def make_plan(self, prompt: str) -> str:\n        \"\"\"\n        Asks the LLM to make a plan.\n        Args:\n            prompt (str): The prompt to be sent to the LLM.\n        Returns:\n            str: The plan made by the LLM.\n        \"\"\"\n        ok = False\n        answer = None\n        while not ok:\n            animate_thinking(\"Thinking...\", color=\"status\")\n            self.memory.push('user', prompt)\n            answer, reasoning = await self.llm_request()\n            if \"NO_UPDATE\" in answer:\n                return []\n            agents_tasks = self.parse_agent_tasks(answer)\n            if agents_tasks == []:\n                self.show_plan(agents_tasks, answer)\n                prompt = f\"Failed to parse the tasks. Please write down your task followed by a json plan within ```json. Do not ask for clarification.\\n\"\n                pretty_print(\"Failed to make plan. Retrying...\", color=\"warning\")\n                continue\n            self.show_plan(agents_tasks, answer)\n            ok = True\n        self.logger.info(f\"Plan made:\\n{answer}\")\n        return self.parse_agent_tasks(answer)\n    \n    async def update_plan(self, goal: str, agents_tasks: List[dict], agents_work_result: dict, id: str, success: bool) -> dict:\n        \"\"\"\n        Updates the plan with the results of the agents work.\n        Args:\n            goal (str): The goal to be achieved.\n            agents_tasks (list): The tasks assigned to each agent.\n            agents_work_result (dict): The results of the agents work.\n        Returns:\n            dict: The updated plan.\n        \"\"\"\n        self.status_message = \"Updating plan...\"\n        last_agent_work = agents_work_result[id]\n        tool_success_str = \"success\" if success else \"failure\"\n        pretty_print(f\"Agent {id} work {tool_success_str}.\", color=\"success\" if success else \"failure\")\n        try:\n            id_int = int(id)\n        except Exception as e:\n            return agents_tasks\n        if id_int == len(agents_tasks):\n            next_task = \"No task follow, this was the last step. If it failed add a task to recover.\"\n        else:\n            next_task = f\"Next task is: {agents_tasks[int(id)][0]}.\"\n        #if success:\n        #    return agents_tasks # we only update the plan if last task failed, for now\n        update_prompt = f\"\"\"\n        Your goal is : {goal}\n        You previously made a plan, agents are currently working on it.\n        The last agent working on task: {id}, did the following work:\n        {last_agent_work}\n        Agent {id} work was a {tool_success_str} according to system interpreter.\n        {next_task}\n        Is the work done for task {id} leading to success or failure ? Did an agent fail with a task?\n        If agent work was good: answer \"NO_UPDATE\"\n        If agent work is leading to failure: update the plan.\n        If a task failed add a task to try again or recover from failure. You might have near identical task twice.\n        plan should be within ```json like before.\n        You need to rewrite the whole plan, but only change the tasks after task {id}.\n        Make the plan the same length as the original one or with only one additional step.\n        Do not change past tasks. Change next tasks.\n        \"\"\"\n        pretty_print(\"Updating plan...\", color=\"status\")\n        plan = await self.make_plan(update_prompt)\n        if plan == []:\n            pretty_print(\"No plan update required.\", color=\"info\")\n            return agents_tasks\n        self.logger.info(f\"Plan updated:\\n{plan}\")\n        return plan\n    \n    async def start_agent_process(self, task: dict, required_infos: dict | None) -> str:\n        \"\"\"\n        Starts the agent process for a given task.\n        Args:\n            task (dict): The task to be performed.\n            required_infos (dict | None): The required information for the task.\n        Returns:\n            str: The result of the agent process.\n        \"\"\"\n        self.status_message = f\"Starting task {task['task']}...\"\n        agent_prompt = self.make_prompt(task['task'], required_infos)\n        pretty_print(f\"Agent {task['agent']} started working...\", color=\"status\")\n        self.logger.info(f\"Agent {task['agent']} started working on {task['task']}.\")\n        answer, reasoning = await self.agents[task['agent'].lower()].process(agent_prompt, None)\n        self.last_answer = answer\n        self.last_reasoning = reasoning\n        self.blocks_result = self.agents[task['agent'].lower()].blocks_result\n        agent_answer = self.agents[task['agent'].lower()].raw_answer_blocks(answer)\n        success = self.agents[task['agent'].lower()].get_success\n        self.agents[task['agent'].lower()].show_answer()\n        pretty_print(f\"Agent {task['agent']} completed task.\", color=\"status\")\n        self.logger.info(f\"Agent {task['agent']} finished working on {task['task']}. Success: {success}\")\n        agent_answer += \"\\nAgent succeeded with task.\" if success else \"\\nAgent failed with task (Error detected).\"\n        return agent_answer, success\n    \n    def get_work_result_agent(self, task_needs, agents_work_result):\n        res = {k: agents_work_result[k] for k in task_needs if k in agents_work_result}\n        self.logger.info(f\"Next agent needs: {task_needs}.\\n Match previous agent result: {res}\")\n        return res\n\n    async def process(self, goal: str, speech_module: Speech) -> Tuple[str, str]:\n        \"\"\"\n        Process the goal by dividing it into tasks and assigning them to agents.\n        Args:\n            goal (str): The goal to be achieved (user prompt).\n            speech_module (Speech): The speech module for text-to-speech.\n        Returns:\n            Tuple[str, str]: The result of the agent process and empty reasoning string.\n        \"\"\"\n        agents_tasks = []\n        required_infos = None\n        agents_work_result = dict()\n\n        self.status_message = \"Making a plan...\"\n        agents_tasks = await self.make_plan(goal)\n\n        if agents_tasks == []:\n            return \"Failed to parse the tasks.\", \"\"\n        i = 0\n        steps = len(agents_tasks)\n        while i < steps and not self.stop:\n            task_name, task = agents_tasks[i][0], agents_tasks[i][1]\n            self.status_message = \"Starting agents...\"\n            pretty_print(f\"I will {task_name}.\", color=\"info\")\n            self.last_answer = f\"I will {task_name.lower()}.\"\n            pretty_print(f\"Assigned agent {task['agent']} to {task_name}\", color=\"info\")\n            if speech_module: speech_module.speak(f\"I will {task_name}. I assigned the {task['agent']} agent to the task.\")\n\n            if agents_work_result is not None:\n                required_infos = self.get_work_result_agent(task['need'], agents_work_result)\n            try:\n                answer, success = await self.start_agent_process(task, required_infos)\n            except Exception as e:\n                raise e\n            if self.stop:\n                pretty_print(f\"Requested stop.\", color=\"failure\")\n            agents_work_result[task['id']] = answer\n            agents_tasks = await self.update_plan(goal, agents_tasks, agents_work_result, task['id'], success)\n            steps = len(agents_tasks)\n            i += 1\n\n        return answer, \"\"\n"
  },
  {
    "path": "sources/browser.py",
    "content": "from selenium import webdriver\nfrom selenium.webdriver.chrome.service import Service\nfrom selenium.webdriver.chrome.options import Options\nfrom selenium.webdriver.common.by import By\nfrom selenium.webdriver.support.ui import WebDriverWait, Select\nfrom selenium.webdriver.support import expected_conditions as EC\nfrom selenium.common.exceptions import TimeoutException, WebDriverException\nfrom selenium.webdriver.common.action_chains import ActionChains\nfrom typing import List, Tuple, Type, Dict\nfrom bs4 import BeautifulSoup\nfrom urllib.parse import urlparse\nfrom fake_useragent import UserAgent\nfrom selenium_stealth import stealth\nimport undetected_chromedriver as uc\nimport chromedriver_autoinstaller\nimport certifi\nimport ssl\nimport subprocess\nimport time\nimport random\nimport os\nimport shutil\nimport uuid\nimport tempfile\nimport markdownify\nimport sys\nimport re\n\nsys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n\nfrom sources.utility import pretty_print, animate_thinking\nfrom sources.logger import Logger\n\n\ndef get_chrome_path() -> str:\n    \"\"\"Get the path to the Chrome executable.\"\"\"\n    if sys.platform.startswith(\"win\"):\n        paths = [\n            \"C:\\\\Program Files\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe\",\n            \"C:\\\\Program Files (x86)\\\\Google\\\\Chrome\\\\Application\\\\chrome.exe\",\n            os.path.join(os.environ.get(\"LOCALAPPDATA\", \"\"), \"Google\\\\Chrome\\\\Application\\\\chrome.exe\")  # User install\n        ]\n    elif sys.platform.startswith(\"darwin\"):  # macOS\n        paths = [\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\",\n                 \"/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta\"]\n    else:  # Linux\n        paths = [\"/usr/bin/google-chrome\",\n                 \"/opt/chrome/chrome\",\n                 \"/usr/bin/chromium-browser\",\n                 \"/usr/bin/chromium\",\n                 \"/usr/local/bin/chrome\",\n                 \"/opt/google/chrome/chrome-headless-shell\",\n                 #\"/app/chrome_bundle/chrome136/chrome-linux64\"\n                ]\n\n    for path in paths:\n        if os.path.exists(path) and os.access(path, os.X_OK):\n            return path\n    print(\"Looking for Google Chrome in these locations failed:\")\n    print('\\n'.join(paths))\n    chrome_path_env = os.environ.get(\"CHROME_EXECUTABLE_PATH\")\n    if chrome_path_env and os.path.exists(chrome_path_env) and os.access(chrome_path_env, os.X_OK):\n        return chrome_path_env\n    path = input(\"Google Chrome not found. Please enter the path to the Chrome executable: \")\n    if os.path.exists(path) and os.access(path, os.X_OK):\n        os.environ[\"CHROME_EXECUTABLE_PATH\"] = path\n        print(f\"Chrome path saved to environment variable CHROME_EXECUTABLE_PATH\")\n        return path\n    return None\n\ndef get_random_user_agent() -> str:\n    \"\"\"Get a random user agent string with associated vendor.\"\"\"\n    user_agents = [\n        {\"ua\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36\", \"vendor\": \"Google Inc.\"},\n        {\"ua\": \"Mozilla/5.0 (Macintosh; Intel Mac OS X 14_6_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36\", \"vendor\": \"Apple Inc.\"},\n        {\"ua\": \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36\", \"vendor\": \"Google Inc.\"},\n    ]\n    return random.choice(user_agents)\n\ndef get_chromedriver_version(chromedriver_path: str) -> str:\n    \"\"\"Get the major version of a chromedriver binary. Returns empty string on failure.\"\"\"\n    try:\n        result = subprocess.run(\n            [chromedriver_path, \"--version\"],\n            capture_output=True, text=True, timeout=10\n        )\n        # Output format: \"ChromeDriver 125.0.6422.78 (...)\"\n        return result.stdout.strip().split()[1].split('.')[0]\n    except Exception:\n        return \"\"\n\ndef is_chromedriver_compatible(chromedriver_path: str) -> bool:\n    \"\"\"Check if a chromedriver binary is compatible with the installed Chrome version.\"\"\"\n    try:\n        chrome_version = chromedriver_autoinstaller.get_chrome_version()\n        if not chrome_version:\n            return True  # Can't determine Chrome version, assume compatible\n        chrome_major = chrome_version.split('.')[0]\n        driver_major = get_chromedriver_version(chromedriver_path)\n        if not driver_major:\n            return True  # Can't determine driver version, assume compatible\n        return chrome_major == driver_major\n    except Exception:\n        return True  # On any error, assume compatible to avoid blocking\n\ndef install_chromedriver() -> str:\n    \"\"\"\n    Install the ChromeDriver if not already installed. Return the path.\n    Automatically updates the driver if the version does not match the installed Chrome.\n    \"\"\"\n    # First try to use chromedriver in the project root directory (as per README)\n    project_root_chromedriver = \"./chromedriver\"\n    if os.path.exists(project_root_chromedriver) and os.access(project_root_chromedriver, os.X_OK):\n        if is_chromedriver_compatible(project_root_chromedriver):\n            print(f\"Using ChromeDriver from project root: {project_root_chromedriver}\")\n            return project_root_chromedriver\n        print(\"ChromeDriver in project root is outdated, attempting auto-update...\")\n    \n    # Then try to use the system-installed chromedriver\n    chromedriver_path = shutil.which(\"chromedriver\")\n    if chromedriver_path:\n        if is_chromedriver_compatible(chromedriver_path):\n            return chromedriver_path\n        print(f\"System ChromeDriver at {chromedriver_path} is outdated, attempting auto-update...\")\n    \n    # In Docker environment, try the fixed path\n    if os.path.exists('/.dockerenv'):\n        docker_chromedriver_path = \"/usr/local/bin/chromedriver\"\n        if os.path.exists(docker_chromedriver_path) and os.access(docker_chromedriver_path, os.X_OK):\n            print(f\"Using Docker ChromeDriver at {docker_chromedriver_path}\")\n            return docker_chromedriver_path\n    \n    # Auto-install matching ChromeDriver version\n    try:\n        print(\"Installing matching ChromeDriver version automatically...\")\n        chromedriver_path = chromedriver_autoinstaller.install()\n    except Exception as e:\n        raise FileNotFoundError(\n            \"ChromeDriver not found and could not be installed automatically. \"\n            \"Please install it manually from https://chromedriver.chromium.org/downloads.\"\n            \"and ensure it's in your PATH or specify the path directly.\"\n            \"See know issues in readme if your chrome version is above 115.\"\n        ) from e\n    \n    if not chromedriver_path:\n        raise FileNotFoundError(\"ChromeDriver not found. Please install it or add it to your PATH.\")\n    return chromedriver_path\n\ndef bypass_ssl() -> str:\n    \"\"\"\n    This is a fallback for stealth mode to bypass SSL verification. Which can fail on some setup.\n    \"\"\"\n    pretty_print(\"Bypassing SSL verification issues, we strongly advice you update your certifi SSL certificate.\", color=\"warning\")\n    ssl._create_default_https_context = ssl._create_unverified_context\n\ndef create_chrome_options(headless=False, stealth_mode=True, crx_path=\"./crx/nopecha.crx\", lang=\"en\") -> Options:\n    \"\"\"Create Chrome options - separated for reusability.\"\"\"\n    chrome_options = Options()\n    chrome_path = get_chrome_path()\n    \n    if not chrome_path:\n        raise FileNotFoundError(\"Google Chrome not found. Please install it.\")\n    chrome_options.binary_location = chrome_path\n    \n    if headless:\n        chrome_options.add_argument(\"--headless=new\")\n        chrome_options.add_argument(\"--disable-gpu\")\n        chrome_options.add_argument(\"--disable-webgl\")\n    \n    user_agent = get_random_user_agent()\n    width, height = (1920, 1080)\n    profile_dir = f\"/tmp/chrome_profile_{uuid.uuid4().hex[:8]}\"\n    \n    # Core options\n    chrome_options.add_argument(\"--no-sandbox\")\n    chrome_options.add_argument('--disable-dev-shm-usage')\n    chrome_options.add_argument(f'--user-data-dir={profile_dir}')\n    chrome_options.add_argument(f\"--accept-lang={lang}-{lang.upper()},{lang};q=0.9\")\n    chrome_options.add_argument(\"--disable-extensions\")\n    chrome_options.add_argument(\"--disable-background-timer-throttling\")\n    chrome_options.add_argument(\"--timezone=Europe/Paris\")\n    chrome_options.add_argument('--remote-debugging-port=9222')\n    chrome_options.add_argument('--disable-background-timer-throttling')\n    chrome_options.add_argument('--disable-backgrounding-occluded-windows')\n    chrome_options.add_argument('--disable-renderer-backgrounding')\n    chrome_options.add_argument('--disable-features=TranslateUI')\n    chrome_options.add_argument('--disable-ipc-flooding-protection')\n    chrome_options.add_argument(\"--mute-audio\")\n    chrome_options.add_argument(\"--disable-notifications\")\n    chrome_options.add_argument(\"--autoplay-policy=user-gesture-required\")\n    chrome_options.add_argument(\"--disable-features=SitePerProcess,IsolateOrigins\")\n    chrome_options.add_argument(\"--enable-features=NetworkService,NetworkServiceInProcess\")\n    chrome_options.add_argument(\"--disable-blink-features=AutomationControlled\")\n    chrome_options.add_argument(f'user-agent={user_agent[\"ua\"]}')\n    chrome_options.add_argument(f'--window-size={width},{height}')\n    \n    if not stealth_mode:\n        if not os.path.exists(crx_path):\n            pretty_print(f\"Anti-captcha CRX not found at {crx_path}.\", color=\"failure\")\n        else:\n            chrome_options.add_extension(crx_path)\n    \n    if not stealth_mode:\n        security_prefs = {\n            \"profile.default_content_setting_values.geolocation\": 0,\n            \"profile.default_content_setting_values.notifications\": 0,\n            \"profile.default_content_setting_values.camera\": 0,\n            \"profile.default_content_setting_values.microphone\": 0,\n            \"profile.default_content_setting_values.midi_sysex\": 0,\n            \"profile.default_content_setting_values.clipboard\": 0,\n            \"profile.default_content_setting_values.media_stream\": 0,\n            \"profile.default_content_setting_values.background_sync\": 0,\n            \"profile.default_content_setting_values.sensors\": 0,\n            \"profile.default_content_setting_values.accessibility_events\": 0,\n            \"safebrowsing.enabled\": True,\n            \"credentials_enable_service\": False,\n            \"profile.password_manager_enabled\": False,\n            \"webkit.webprefs.accelerated_2d_canvas_enabled\": True,\n            \"webkit.webprefs.force_dark_mode_enabled\": False,\n            \"webkit.webprefs.accelerated_2d_canvas_msaa_sample_count\": 4,\n            \"enable_webgl\": True,\n            \"enable_webgl2_compute_context\": True\n        }\n        chrome_options.add_experimental_option(\"prefs\", security_prefs)\n        chrome_options.add_experimental_option(\"excludeSwitches\", [\"enable-automation\"])\n        chrome_options.add_experimental_option('useAutomationExtension', False)\n    \n    return chrome_options\n\ndef create_undetected_chromedriver(service, chrome_options) -> webdriver.Chrome:\n    \"\"\"Create an undetected ChromeDriver instance with proper error handling.\"\"\"\n    try:\n        driver = uc.Chrome(service=service, options=chrome_options)\n    except Exception as e:\n        pretty_print(f\"Failed to create Chrome driver: {str(e)}. Trying to bypass SSL...\", color=\"failure\")\n        try:\n            bypass_ssl()\n            # Create NEW options object - this is the key fix\n            fresh_options = create_chrome_options(\n                headless=any(\"--headless\" in arg for arg in chrome_options.arguments),\n                stealth_mode=True,  # We're in stealth mode if we reach this point\n                crx_path=\"./crx/nopecha.crx\"  # Default path\n            )\n            driver = uc.Chrome(service=service, options=fresh_options)\n        except Exception as e:\n            pretty_print(f\"Failed to create Chrome driver, fallback failed:\\n{str(e)}.\", color=\"failure\")\n            raise e\n    \n    driver.execute_script(\"Object.defineProperty(navigator, 'webdriver', {get: () => undefined})\") \n    return driver\n\ndef create_driver(headless=False, stealth_mode=True, crx_path=\"./crx/nopecha.crx\", lang=\"en\") -> webdriver.Chrome:\n    \"\"\"Create a Chrome WebDriver with specified options.\"\"\"\n    # Warn if trying to run non-headless in Docker\n    if not headless and os.path.exists('/.dockerenv'):\n        print(\"[WARNING] Running non-headless browser in Docker may fail!\")\n        print(\"[WARNING] Consider setting headless=True or headless_browser=True in config.ini\")\n    \n    chrome_options = create_chrome_options(headless, stealth_mode, crx_path, lang)\n    chromedriver_path = install_chromedriver()\n    service = Service(chromedriver_path)\n    \n    if stealth_mode:\n        driver = create_undetected_chromedriver(service, chrome_options)\n        user_agent = get_random_user_agent()\n        stealth(driver,\n            languages=[\"en-US\", \"en\"],\n            vendor=user_agent[\"vendor\"],\n            platform=\"Win64\" if \"windows\" in user_agent[\"ua\"].lower() else \"MacIntel\" if \"mac\" in user_agent[\"ua\"].lower() else \"Linux x86_64\",\n            webgl_vendor=\"Intel Inc.\",\n            renderer=\"Intel Iris OpenGL Engine\",\n            fix_hairline=True,\n        )\n        return driver\n    else:\n        return webdriver.Chrome(service=service, options=chrome_options)\n\nclass Browser:\n    def __init__(self, driver, anticaptcha_manual_install=False):\n        \"\"\"Initialize the browser with optional AntiCaptcha installation.\"\"\"\n        self.js_scripts_folder = \"./sources/web_scripts/\" if not __name__ == \"__main__\" else \"./web_scripts/\"\n        self.anticaptcha = \"https://chrome.google.com/webstore/detail/nopecha-captcha-solver/dknlfmjaanfblgfdfebhijalfmhmjjjo/related\"\n        self.logger = Logger(\"browser.log\")\n        self.screenshot_folder = os.path.join(os.getcwd(), \".screenshots\")\n        self.tabs = []\n        try:\n            self.driver = driver\n            self.wait = WebDriverWait(self.driver, 10)\n        except Exception as e:\n            raise Exception(f\"Failed to initialize browser: {str(e)}\")\n        self.setup_tabs()\n        self.patch_browser_fingerprint()\n        if anticaptcha_manual_install:\n            self.load_anticatpcha_manually()\n    \n    def setup_tabs(self):\n        self.tabs = self.driver.window_handles\n        try:\n            self.driver.get(\"https://www.google.com\")\n        except Exception as e:\n            self.logger.log(f\"Failed to setup initial tab:\" + str(e))\n            pass\n        self.screenshot()\n    \n    def switch_control_tab(self):\n        self.logger.log(\"Switching to control tab.\")\n        self.driver.switch_to.window(self.tabs[0])\n            \n    def load_anticatpcha_manually(self):\n        pretty_print(\"You might want to install the AntiCaptcha extension for captchas.\", color=\"warning\")\n        try:\n            self.driver.get(self.anticaptcha)\n        except Exception as e:\n            self.logger.log(f\"Failed to setup initial tab:\" + str(e))\n            pass\n\n    def human_move(element):\n        actions = ActionChains(driver)\n        x_offset = random.randint(-5,5)\n        for _ in range(random.randint(2,5)):\n            actions.move_by_offset(x_offset, random.randint(-2,2))\n            actions.pause(random.uniform(0.1,0.3))\n        actions.click().perform()\n\n    def human_scroll(self):\n        for _ in range(random.randint(1, 3)):\n            scroll_pixels = random.randint(150, 1200)\n            self.driver.execute_script(f\"window.scrollBy(0, {scroll_pixels});\")\n            time.sleep(random.uniform(0.5, 2.0))\n            if random.random() < 0.4:\n                self.driver.execute_script(f\"window.scrollBy(0, -{random.randint(50, 300)});\")\n                time.sleep(random.uniform(0.3, 1.0))\n\n    def patch_browser_fingerprint(self) -> None:\n        script = self.load_js(\"spoofing.js\")\n        self.driver.execute_script(script)\n    \n    def go_to(self, url:str) -> bool:\n        \"\"\"Navigate to a specified URL.\"\"\"\n        time.sleep(random.uniform(0.4, 2.5))\n        try:\n            initial_handles = self.driver.window_handles\n            self.driver.get(url)\n            time.sleep(random.uniform(0.01, 0.3))\n            try:\n                wait = WebDriverWait(self.driver, timeout=10)\n                wait.until(\n                    lambda driver: (\n                        not any(keyword in driver.page_source.lower() for keyword in [\"checking your browser\", \"captcha\"])\n                    ),\n                    message=\"stuck on 'checking browser' or verification screen\"\n                )\n            except TimeoutException:\n                self.logger.warning(\"Timeout while waiting for page to bypass 'checking your browser'\")\n            self.apply_web_safety()\n            time.sleep(random.uniform(0.01, 0.2))\n            self.human_scroll()\n            self.logger.log(f\"Navigated to: {url}\")\n            return True\n        except TimeoutException as e:\n            self.logger.error(f\"Timeout waiting for {url} to load: {str(e)}\")\n            return False\n        except WebDriverException as e:\n            self.logger.error(f\"Error navigating to {url}: {str(e)}\")\n            return False\n        except Exception as e:\n            self.logger.error(f\"Fatal error with go_to method on {url}:\\n{str(e)}\")\n            raise e\n\n    def is_sentence(self, text:str) -> bool:\n        \"\"\"Check if the text qualifies as a meaningful sentence or contains important error codes.\"\"\"\n        text = text.strip()\n\n        if any(c.isdigit() for c in text):\n            return True\n        words = re.findall(r'\\w+', text, re.UNICODE)\n        word_count = len(words)\n        has_punctuation = any(text.endswith(p) for p in ['.', '，', ',', '!', '?', '。', '！', '？', '।', '۔'])\n        is_long_enough = word_count > 4\n        return (word_count >= 5 and (has_punctuation or is_long_enough))\n\n    def get_text(self) -> str | None:\n        \"\"\"Get page text as formatted Markdown\"\"\"\n        try:\n            soup = BeautifulSoup(self.driver.page_source, 'html.parser')\n            for element in soup(['script', 'style', 'noscript', 'meta', 'link']):\n                element.decompose()\n            markdown_converter = markdownify.MarkdownConverter(\n                heading_style=\"ATX\",\n                strip=['a'],\n                autolinks=False,\n                bullets='•',\n                strong_em_symbol='*',\n                default_title=False,\n            )\n            markdown_text = markdown_converter.convert(str(soup.body))\n            lines = []\n            for line in markdown_text.splitlines():\n                stripped = line.strip()\n                if stripped and self.is_sentence(stripped):\n                    cleaned = ' '.join(stripped.split())\n                    lines.append(cleaned)\n            result = \"[Start of page]\\n\\n\" + \"\\n\\n\".join(lines) + \"\\n\\n[End of page]\"\n            result = re.sub(r'!\\[(.*?)\\]\\(.*?\\)', r'[IMAGE: \\1]', result)\n            self.logger.info(f\"Extracted text: {result[:100]}...\")\n            self.logger.info(f\"Extracted text length: {len(result)}\")\n            return result[:32768]\n        except Exception as e:\n            self.logger.error(f\"Error getting text: {str(e)}\")\n            return None\n    \n    def clean_url(self, url:str) -> str:\n        \"\"\"Clean URL to keep only the part needed for navigation to the page\"\"\"\n        clean = url.split('#')[0]\n        parts = clean.split('?', 1)\n        base_url = parts[0]\n        if len(parts) > 1:\n            query = parts[1]\n            essential_params = []\n            for param in query.split('&'):\n                if param.startswith('_skw=') or param.startswith('q=') or param.startswith('s='):\n                    essential_params.append(param)\n                elif param.startswith('_') or param.startswith('hash=') or param.startswith('itmmeta='):\n                    break\n            if essential_params:\n                return f\"{base_url}?{'&'.join(essential_params)}\"\n        return base_url\n    \n    def is_link_valid(self, url:str) -> bool:\n        \"\"\"Check if a URL is a valid link (page, not related to icon or metadata).\"\"\"\n        if len(url) > 72:\n            self.logger.warning(f\"URL too long: {url}\")\n            return False\n        parsed_url = urlparse(url)\n        if not parsed_url.scheme or not parsed_url.netloc:\n            self.logger.warning(f\"Invalid URL: {url}\")\n            return False\n        if re.search(r'/\\d+$', parsed_url.path):\n            return False\n        image_extensions = ['.jpg', '.jpeg', '.png', '.gif', '.bmp', '.tiff', '.webp']\n        metadata_extensions = ['.ico', '.xml', '.json', '.rss', '.atom']\n        for ext in image_extensions + metadata_extensions:\n            if url.lower().endswith(ext):\n                return False\n        return True\n\n    def get_navigable(self) -> List[str]:\n        \"\"\"Get all navigable links on the current page.\"\"\"\n        try:\n            links = []\n            elements = self.driver.find_elements(By.TAG_NAME, \"a\")\n            \n            for element in elements:\n                href = element.get_attribute(\"href\")\n                if href and href.startswith((\"http\", \"https\")):\n                    links.append({\n                        \"url\": href,\n                        \"text\": element.text.strip(),\n                        \"is_displayed\": element.is_displayed()\n                    })\n            \n            self.logger.info(f\"Found {len(links)} navigable links\")\n            return [self.clean_url(link['url']) for link in links if (link['is_displayed'] == True and self.is_link_valid(link['url']))]\n        except Exception as e:\n            self.logger.error(f\"Error getting navigable links: {str(e)}\")\n            return []\n\n    def click_element(self, xpath: str) -> bool:\n        \"\"\"Click an element specified by XPath.\"\"\"\n        try:\n            element = self.wait.until(EC.element_to_be_clickable((By.XPATH, xpath)))\n            if not element.is_displayed():\n                return False\n            if not element.is_enabled():\n                return False\n            try:\n                self.logger.error(f\"Scrolling to element for click_element.\")\n                self.driver.execute_script(\"arguments[0].scrollIntoView({block: 'center', behavior: 'smooth'});\", element)\n                time.sleep(0.1)\n                element.click()\n                self.logger.info(f\"Clicked element at {xpath}\")\n                return True\n            except ElementClickInterceptedException as e:\n                self.logger.error(f\"Error click_element: {str(e)}\")\n                return False\n        except TimeoutException:\n            self.logger.warning(f\"Timeout clicking element.\")\n            return False\n        except Exception as e:\n            self.logger.error(f\"Unexpected error clicking element at {xpath}: {str(e)}\")\n            return False\n        \n    def load_js(self, file_name: str) -> str:\n        \"\"\"Load javascript from script folder to inject to page.\"\"\"\n        path = os.path.join(self.js_scripts_folder, file_name)\n        self.logger.info(f\"Loading js at {path}\")\n        try:\n            with open(path, 'r') as f:\n                return f.read()\n        except FileNotFoundError as e:\n            raise Exception(f\"Could not find: {path}\") from e\n        except Exception as e:\n            raise e\n\n    def find_all_inputs(self, timeout=3):\n        \"\"\"Find all inputs elements on the page.\"\"\"\n        try:\n            WebDriverWait(self.driver, timeout).until(\n                EC.presence_of_element_located((By.TAG_NAME, \"body\"))\n            )\n        except Exception as e:\n            self.logger.error(f\"Error waiting for input element: {str(e)}\")\n            return []\n        time.sleep(0.5)\n        script = self.load_js(\"find_inputs.js\")\n        input_elements = self.driver.execute_script(script)\n        return input_elements\n\n    def get_form_inputs(self) -> List[str]:\n        \"\"\"Extract all input from the page and return them.\"\"\"\n        try:\n            input_elements = self.find_all_inputs()\n            if not input_elements:\n                self.logger.info(\"No input element on page.\")\n                return [\"No input forms found on the page.\"]\n\n            form_strings = []\n            for element in input_elements:\n                input_type = element.get(\"type\") or \"text\"\n                if input_type in [\"hidden\", \"submit\", \"button\", \"image\"] or not element[\"displayed\"]:\n                    continue\n                input_name = element.get(\"text\") or element.get(\"id\") or input_type\n                if input_type == \"select\":\n                    options = element.get(\"options\", [])\n                    options_str = \", \".join(opt[\"text\"] for opt in options if opt[\"text\"])\n                    selected = next((opt[\"text\"] for opt in options if opt.get(\"selected\")), \"\")\n                    form_strings.append(f\"[{input_name}](select: {selected}) options: [{options_str}]\")\n                elif input_type == \"textarea\":\n                    form_strings.append(f\"[{input_name}](\"\")\")\n                elif input_type == \"file\":\n                    form_strings.append(f\"[{input_name}](file: )\")\n                elif input_type == \"checkbox\" or input_type == \"radio\":\n                    try:\n                        checked_status = \"checked\" if element.is_selected() else \"unchecked\"\n                    except Exception as e:\n                        continue\n                    form_strings.append(f\"[{input_name}]({checked_status})\")\n                else:\n                    form_strings.append(f\"[{input_name}](\"\")\")\n            return form_strings\n\n        except Exception as e:\n            raise e\n\n    def get_buttons_xpath(self) -> List[str]:\n        \"\"\"\n        Find buttons and return their type and xpath.\n        \"\"\"\n        buttons = self.driver.find_elements(By.TAG_NAME, \"button\") + \\\n                  self.driver.find_elements(By.XPATH, \"//input[@type='submit']\")\n        result = []\n        for i, button in enumerate(buttons):\n            if not button.is_displayed() or not button.is_enabled():\n                continue\n            text = (button.text or button.get_attribute(\"value\") or \"\").lower().replace(' ', '')\n            xpath = f\"(//button | //input[@type='submit'])[{i + 1}]\"\n            result.append((text, xpath))\n        result.sort(key=lambda x: len(x[0]))\n        return result\n\n    def wait_for_submission_outcome(self, timeout: int = 10) -> bool:\n        \"\"\"\n        Wait for a submission outcome (e.g., URL change or new element).\n        \"\"\"\n        try:\n            self.logger.info(\"Waiting for submission outcome...\")\n            wait = WebDriverWait(self.driver, timeout)\n            wait.until(\n                lambda driver: driver.current_url != self.driver.current_url or\n                               driver.find_elements(By.XPATH, \"//*[contains(text(), 'success')]\")\n            )\n            self.logger.info(\"Detected submission outcome\")\n            return True\n        except TimeoutException:\n            self.logger.warning(\"No submission outcome detected\")\n            return False\n\n    def find_and_click_btn(self, btn_type: str = 'login', timeout: int = 5) -> bool:\n        \"\"\"Find and click a submit button matching the specified type.\"\"\"\n        buttons = self.get_buttons_xpath()\n        if not buttons:\n            self.logger.warning(\"No visible buttons found\")\n            return False\n\n        for button_text, xpath in buttons:\n            if btn_type.lower() in button_text.lower() or btn_type.lower() in xpath.lower():\n                try:\n                    wait = WebDriverWait(self.driver, timeout)\n                    element = wait.until(\n                        EC.element_to_be_clickable((By.XPATH, xpath)),\n                        message=f\"Button with XPath '{xpath}' not clickable within {timeout} seconds\"\n                    )\n                    if self.click_element(xpath):\n                        self.logger.info(f\"Clicked button '{button_text}' at XPath: {xpath}\")\n                        return True\n                    else:\n                        self.logger.warning(f\"Button '{button_text}' at XPath: {xpath} not clickable\")\n                        return False\n                except TimeoutException:\n                    self.logger.warning(f\"Timeout waiting for '{button_text}' button at XPath: {xpath}\")\n                    return False\n                except Exception as e:\n                    self.logger.error(f\"Error clicking button '{button_text}' at XPath: {xpath} - {str(e)}\")\n                    return False\n        self.logger.warning(f\"No button matching '{btn_type}' found\")\n        return False\n\n    def tick_all_checkboxes(self) -> bool:\n        \"\"\"\n        Find and tick all checkboxes on the page.\n        Returns True if successful, False if any issues occur.\n        \"\"\"\n        try:\n            checkboxes = self.driver.find_elements(By.XPATH, \"//input[@type='checkbox']\")\n            if not checkboxes:\n                self.logger.info(\"No checkboxes found on the page\")\n                return True\n\n            for index, checkbox in enumerate(checkboxes, 1):\n                try:\n                    WebDriverWait(self.driver, 10).until(\n                        EC.element_to_be_clickable(checkbox)\n                    )\n                    self.driver.execute_script(\n                        \"arguments[0].scrollIntoView({block: 'center', inline: 'center'});\", checkbox\n                    )\n                    if not checkbox.is_selected():\n                        try:\n                            checkbox.click()\n                            self.logger.info(f\"Ticked checkbox {index}\")\n                        except ElementClickInterceptedException:\n                            self.driver.execute_script(\"arguments[0].click();\", checkbox)\n                            self.logger.warning(f\"Click checkbox {index} intercepted\")\n                    else:\n                        self.logger.info(f\"Checkbox {index} already ticked\")\n                except TimeoutException:\n                    self.logger.warning(f\"Timeout waiting for checkbox {index} to be clickable\")\n                    continue\n                except Exception as e:\n                    self.logger.error(f\"Error ticking checkbox {index}: {str(e)}\")\n                    continue\n            return True\n        except Exception as e:\n            self.logger.error(f\"Error finding checkboxes: {str(e)}\")\n            return False\n\n    def find_and_click_submission(self, timeout: int = 10) -> bool:\n        possible_submissions = [\"login\", \"submit\", \"register\", \"continue\", \"apply\",\n                                \"ok\", \"confirm\", \"proceed\", \"accept\", \n                                \"done\", \"finish\", \"start\", \"calculate\"]\n        for submission in possible_submissions:\n            if self.find_and_click_btn(submission, timeout):\n                self.logger.info(f\"Clicked on submission button: {submission}\")\n                return True\n        self.logger.warning(\"No submission button found\")\n        return False\n    \n    def find_input_xpath_by_name(self, inputs, name: str) -> str | None:\n        for field in inputs:\n            if name in field[\"text\"]:\n                return field[\"xpath\"]\n        return None\n\n    def fill_form_inputs(self, input_list: List[str]) -> bool:\n        \"\"\"Fill inputs based on a list of [name](value) strings.\"\"\"\n        if not isinstance(input_list, list):\n            self.logger.error(\"input_list must be a list\")\n            return False\n        inputs = self.find_all_inputs()\n        try:\n            for input_str in input_list:\n                match = re.match(r'\\[(.*?)\\]\\((.*?)\\)', input_str)\n                if not match:\n                    self.logger.warning(f\"Invalid format for input: {input_str}\")\n                    continue\n\n                name, value = match.groups()\n                name = name.strip()\n                value = value.strip()\n                xpath = self.find_input_xpath_by_name(inputs, name)\n                if not xpath:\n                    self.logger.warning(f\"Input field '{name}' not found\")\n                    continue\n                try:\n                    element = WebDriverWait(self.driver, 10).until(\n                        EC.element_to_be_clickable((By.XPATH, xpath))\n                    )\n                except TimeoutException:\n                    self.logger.error(f\"Timeout waiting for element '{name}' to be clickable\")\n                    continue\n                self.driver.execute_script(\"arguments[0].scrollIntoView(true);\", element)\n                if not element.is_displayed() or not element.is_enabled():\n                    self.logger.warning(f\"Element '{name}' is not interactable (not displayed or disabled)\")\n                    continue\n                input_type = (element.get_attribute(\"type\") or \"text\").lower()\n                tag_name = (element.tag_name or \"\").lower()\n                if tag_name == \"select\":\n                    try:\n                        select = Select(element)\n                        select.select_by_visible_text(value)\n                        self.logger.info(f\"Selected '{value}' for {name}\")\n                    except Exception:\n                        try:\n                            select.select_by_value(value)\n                            self.logger.info(f\"Selected value '{value}' for {name}\")\n                        except Exception as sel_e:\n                            self.logger.warning(f\"Could not select '{value}' for {name}: {sel_e}\")\n                elif tag_name == \"textarea\":\n                    element.clear()\n                    element.send_keys(value)\n                    self.logger.info(f\"Filled textarea {name}\")\n                elif input_type == \"file\":\n                    if os.path.isabs(value) and os.path.exists(value):\n                        element.send_keys(value)\n                        self.logger.info(f\"Uploaded file '{value}' for {name}\")\n                    else:\n                        self.logger.warning(f\"File not found: {value}\")\n                elif input_type in [\"checkbox\", \"radio\"]:\n                    is_checked = element.is_selected()\n                    should_be_checked = value.lower() == \"checked\"\n\n                    if is_checked != should_be_checked:\n                        element.click()\n                        self.logger.info(f\"Set {name} to {value}\")\n                else:\n                    element.clear()\n                    element.send_keys(value)\n                    self.logger.info(f\"Filled {name} with {value}\")\n            return True\n        except Exception as e:\n            self.logger.error(f\"Error filling form inputs: {str(e)}\")\n            return False\n    \n    def fill_form(self, input_list: List[str]) -> bool:\n        \"\"\"Fill form inputs based on a list of [name](value) and submit.\"\"\"\n        if not isinstance(input_list, list):\n            self.logger.error(\"input_list must be a list\")\n            return False\n        if self.fill_form_inputs(input_list):\n            self.logger.info(\"Form filled successfully\")\n            self.tick_all_checkboxes()\n            if self.find_and_click_submission():\n                if self.wait_for_submission_outcome():\n                    self.logger.info(\"Submission outcome detected\")\n                    return True\n                else:\n                    self.logger.warning(\"No submission outcome detected\")\n            else:\n                self.logger.warning(\"Failed to submit form\")\n        self.logger.warning(\"Failed to fill form inputs\")\n        return False\n\n    def get_current_url(self) -> str:\n        \"\"\"Get the current URL of the page.\"\"\"\n        return self.driver.current_url\n\n    def get_page_title(self) -> str:\n        \"\"\"Get the title of the current page.\"\"\"\n        return self.driver.title\n\n    def scroll_bottom(self) -> bool:\n        \"\"\"Scroll to the bottom of the page.\"\"\"\n        try:\n            self.logger.info(\"Scrolling to the bottom of the page...\")\n            self.driver.execute_script(\n                \"window.scrollTo(0, document.body.scrollHeight);\"\n            )\n            time.sleep(0.5)\n            return True\n        except Exception as e:\n            self.logger.error(f\"Error scrolling: {str(e)}\")\n            return False\n    \n    def get_screenshot(self) -> str:\n        return self.screenshot_folder + \"/updated_screen.png\"\n\n    def screenshot(self, filename:str = 'updated_screen.png') -> bool:\n        \"\"\"Take a screenshot of the current page, attempt to capture the full page by zooming out.\"\"\"\n        self.logger.info(\"Taking full page screenshot...\")\n        time.sleep(0.1)\n        try:\n            original_zoom = self.driver.execute_script(\"return document.body.style.zoom || 1;\")\n            self.driver.execute_script(\"document.body.style.zoom='75%'\")\n            time.sleep(0.1)\n            path = os.path.join(self.screenshot_folder, filename)\n            if not os.path.exists(self.screenshot_folder):\n                os.makedirs(self.screenshot_folder)\n            self.driver.save_screenshot(path)\n            self.logger.info(f\"Full page screenshot saved as {filename}\")\n        except Exception as e:\n            self.logger.error(f\"Error taking full page screenshot: {str(e)}\")\n            return False\n        finally:\n            self.driver.execute_script(f\"document.body.style.zoom='1'\")\n        return True\n\n    def apply_web_safety(self):\n        \"\"\"\n        Apply security measures to block any website malicious/annoying execution, privacy violation etc..\n        \"\"\"\n        self.logger.info(\"Applying web safety measures...\")\n        script = self.load_js(\"inject_safety_script.js\")\n        input_elements = self.driver.execute_script(script)\n\nif __name__ == \"__main__\":\n    driver = create_driver(headless=False, stealth_mode=True, crx_path=\"../crx/nopecha.crx\")\n    browser = Browser(driver, anticaptcha_manual_install=True)\n    \n    input(\"press enter to continue\")\n    print(\"AntiCaptcha / Form Test\")\n    browser.go_to(\"https://bot.sannysoft.com\")\n    time.sleep(5)\n    #txt = browser.get_text()\n    browser.go_to(\"https://home.openweathermap.org/users/sign_up\")\n    inputs_visible = browser.get_form_inputs()\n    print(\"inputs:\", inputs_visible)\n    #inputs_fill = ['[q](checked)', '[q](checked)', '[user[username]](mlg)', '[user[email]](mlg.fcu@gmail.com)', '[user[password]](placeholder_P@ssw0rd123)', '[user[password_confirmation]](placeholder_P@ssw0rd123)']\n    #browser.fill_form(inputs_fill)\n    input(\"press enter to exit\")\n\n# Test sites for browser fingerprinting and captcha\n# https://nowsecure.nl/\n# https://bot.sannysoft.com\n# https://browserleaks.com/\n# https://bot.incolumitas.com/\n# https://fingerprintjs.github.io/fingerprintjs/\n# https://antoinevastel.com/bots/"
  },
  {
    "path": "sources/interaction.py",
    "content": "import readline\nfrom typing import List, Tuple, Type, Dict\n\nfrom sources.text_to_speech import Speech\nfrom sources.utility import pretty_print, animate_thinking\nfrom sources.router import AgentRouter\nfrom sources.speech_to_text import AudioTranscriber, AudioRecorder\nimport threading\n\n\nclass Interaction:\n    \"\"\"\n    Interaction is a class that handles the interaction between the user and the agents.\n    \"\"\"\n    def __init__(self, agents,\n                 tts_enabled: bool = True,\n                 stt_enabled: bool = True,\n                 recover_last_session: bool = False,\n                 langs: List[str] = [\"en\", \"zh\"]\n                ):\n        self.is_active = True\n        self.current_agent = None\n        self.last_query = None\n        self.last_answer = None\n        self.last_reasoning = None\n        self.agents = agents\n        self.tts_enabled = tts_enabled\n        self.stt_enabled = stt_enabled\n        self.recover_last_session = recover_last_session\n        self.router = AgentRouter(self.agents, supported_language=langs)\n        self.ai_name = self.find_ai_name()\n        self.speech = None\n        self.transcriber = None\n        self.recorder = None\n        self.is_generating = False\n        self.languages = langs\n        if tts_enabled:\n            self.initialize_tts()\n        if stt_enabled:\n            self.initialize_stt()\n        if recover_last_session:\n            self.load_last_session()\n        self.emit_status()\n    \n    def get_spoken_language(self) -> str:\n        \"\"\"Get the primary TTS language.\"\"\"\n        lang = self.languages[0]\n        return lang\n\n    def initialize_tts(self):\n        \"\"\"Initialize TTS.\"\"\"\n        if not self.speech:\n            animate_thinking(\"Initializing text-to-speech...\", color=\"status\")\n            self.speech = Speech(enable=self.tts_enabled, language=self.get_spoken_language(), voice_idx=1)\n\n    def initialize_stt(self):\n        \"\"\"Initialize STT.\"\"\"\n        if not self.transcriber or not self.recorder:\n            animate_thinking(\"Initializing speech recognition...\", color=\"status\")\n            self.transcriber = AudioTranscriber(self.ai_name, verbose=False)\n            self.recorder = AudioRecorder()\n    \n    def emit_status(self):\n        \"\"\"Print the current status of agenticSeek.\"\"\"\n        if self.stt_enabled:\n            pretty_print(f\"Text-to-speech trigger is {self.ai_name}\", color=\"status\")\n        if self.tts_enabled:\n            self.speech.speak(\"Hello, we are online and ready. What can I do for you ?\")\n        pretty_print(\"AgenticSeek is ready.\", color=\"status\")\n    \n    def find_ai_name(self) -> str:\n        \"\"\"Find the name of the default AI. It is required for STT as a trigger word.\"\"\"\n        ai_name = \"jarvis\"\n        for agent in self.agents:\n            if agent.type == \"casual_agent\":\n                ai_name = agent.agent_name\n                break\n        return ai_name\n    \n    def get_last_blocks_result(self) -> List[Dict]:\n        \"\"\"Get the last blocks result.\"\"\"\n        if self.current_agent is None:\n            return []\n        blks = []\n        for agent in self.agents:\n            blks.extend(agent.get_blocks_result())\n        return blks\n    \n    def load_last_session(self):\n        \"\"\"Recover the last session.\"\"\"\n        for agent in self.agents:\n            if agent.type == \"planner_agent\":\n                continue\n            agent.memory.load_memory(agent.type)\n    \n    def save_session(self):\n        \"\"\"Save the current session.\"\"\"\n        for agent in self.agents:\n            agent.memory.save_memory(agent.type)\n\n    def is_active(self) -> bool:\n        return self.is_active\n    \n    def read_stdin(self) -> str:\n        \"\"\"Read the input from the user.\"\"\"\n        buffer = \"\"\n\n        PROMPT = \"\\033[1;35m➤➤➤ \\033[0m\"\n        while not buffer:\n            try:\n                buffer = input(PROMPT)\n            except EOFError:\n                return None\n            if buffer == \"exit\" or buffer == \"goodbye\":\n                return None\n        return buffer\n    \n    def transcription_job(self) -> str:\n        \"\"\"Transcribe the audio from the microphone.\"\"\"\n        self.recorder = AudioRecorder(verbose=True)\n        self.transcriber = AudioTranscriber(self.ai_name, verbose=True)\n        self.transcriber.start()\n        self.recorder.start()\n        self.recorder.join()\n        self.transcriber.join()\n        query = self.transcriber.get_transcript()\n        if query == \"exit\" or query == \"goodbye\":\n            return None\n        return query\n\n    def get_user(self) -> str:\n        \"\"\"Get the user input from the microphone or the keyboard.\"\"\"\n        if self.stt_enabled:\n            query = \"TTS transcription of user: \" + self.transcription_job()\n        else:\n            query = self.read_stdin()\n        if query is None:\n            self.is_active = False\n            self.last_query = None\n            return None\n        self.last_query = query\n        return query\n    \n    def set_query(self, query: str) -> None:\n        \"\"\"Set the query\"\"\"\n        self.is_active = True\n        self.last_query = query\n    \n    async def think(self) -> bool:\n        \"\"\"Request AI agents to process the user input.\"\"\"\n        push_last_agent_memory = False\n        if self.last_query is None or len(self.last_query) == 0:\n            return False\n        agent = self.router.select_agent(self.last_query)\n        if agent is None:\n            return False\n        if self.current_agent != agent and self.last_answer is not None:\n            push_last_agent_memory = True\n        tmp = self.last_answer\n        self.current_agent = agent\n        self.is_generating = True\n        self.last_answer, self.last_reasoning = await agent.process(self.last_query, self.speech)\n        self.is_generating = False\n        if push_last_agent_memory:\n            self.current_agent.memory.push('user', self.last_query)\n            self.current_agent.memory.push('assistant', self.last_answer)\n        if self.last_answer == tmp:\n            self.last_answer = None\n        return True\n    \n    def get_updated_process_answer(self) -> str:\n        \"\"\"Get the answer from the last agent.\"\"\"\n        if self.current_agent is None:\n            return None\n        return self.current_agent.get_last_answer()\n    \n    def get_updated_block_answer(self) -> str:\n        \"\"\"Get the answer from the last agent.\"\"\"\n        if self.current_agent is None:\n            return None\n        return self.current_agent.get_last_block_answer()\n    \n    def speak_answer(self) -> None:\n        \"\"\"Speak the answer to the user in a non-blocking thread.\"\"\"\n        if self.last_query is None:\n            return\n        if self.tts_enabled and self.last_answer and self.speech:\n            def speak_in_thread(speech_instance, text):\n                speech_instance.speak(text)\n            thread = threading.Thread(target=speak_in_thread, args=(self.speech, self.last_answer))\n            thread.start()\n    \n    def show_answer(self) -> None:\n        \"\"\"Show the answer to the user.\"\"\"\n        if self.last_query is None:\n            return\n        if self.current_agent is not None:\n            self.current_agent.show_answer()\n\n"
  },
  {
    "path": "sources/language.py",
    "content": "from typing import List, Tuple, Type, Dict\nimport re\nimport langid\nfrom transformers import MarianMTModel, MarianTokenizer\n\nfrom sources.utility import pretty_print, animate_thinking\nfrom sources.logger import Logger\n\nclass LanguageUtility:\n    \"\"\"LanguageUtility for language, or emotion identification\"\"\"\n    def __init__(self, supported_language: List[str] = [\"en\", \"fr\", \"zh\"]):\n        \"\"\"\n        Initialize the LanguageUtility class\n        args:\n            supported_language: list of languages for translation, determine which Helsinki-NLP model to load\n        \"\"\"\n        self.translators_tokenizer = None \n        self.translators_model = None\n        self.logger = Logger(\"language.log\")\n        self.supported_language = supported_language\n        self.load_model()\n    \n    def load_model(self) -> None:\n        animate_thinking(\"Loading language utility...\", color=\"status\")\n        self.translators_tokenizer = {lang: MarianTokenizer.from_pretrained(f\"Helsinki-NLP/opus-mt-{lang}-en\") for lang in self.supported_language if lang != \"en\"}\n        self.translators_model = {lang: MarianMTModel.from_pretrained(f\"Helsinki-NLP/opus-mt-{lang}-en\") for lang in self.supported_language if lang != \"en\"}\n    \n    def detect_language(self, text: str) -> str:\n        \"\"\"\n        Detect the language of the given text using langdetect\n        Limited to the supported languages list because of the model tendency to mistake similar languages\n        Args:\n            text: string to analyze\n        Returns: ISO639-1 language code\n        \"\"\"\n        langid.set_languages(self.supported_language)\n        lang, score = langid.classify(text)\n        self.logger.info(f\"Identified: {text} as {lang} with conf {score}\")\n        return lang\n\n    def translate(self, text: str, origin_lang: str) -> str:\n        \"\"\"\n        Translate the given text to English\n        Args:\n            text: string to translate\n            origin_lang: ISO language code\n        Returns: translated str\n        \"\"\"\n        if origin_lang == \"en\":\n            return text\n        if origin_lang not in self.translators_tokenizer:\n            pretty_print(f\"Language {origin_lang} not supported for translation\", color=\"error\")\n            return text\n        tokenizer = self.translators_tokenizer[origin_lang]\n        inputs = tokenizer(text, return_tensors=\"pt\", padding=True)\n        model = self.translators_model[origin_lang]\n        translation = model.generate(**inputs)\n        return tokenizer.decode(translation[0], skip_special_tokens=True)\n\n    def analyze(self, text):\n        \"\"\"\n        Combined analysis of language and emotion\n        Args:\n            text: string to analyze\n        Returns: dictionary with language related information\n        \"\"\"\n        try:\n            language = self.detect_language(text)\n            return {\n                \"language\": language\n            }\n        except Exception as e:\n            raise e\n\nif __name__ == \"__main__\":\n    detector = LanguageUtility()\n    \n    test_texts = [\n        \"I am so happy today!\",\n        \"我不要去巴黎\",\n        \"La vie c'est cool\"\n    ]\n    for text in test_texts:\n        pretty_print(\"Analyzing...\", color=\"status\")\n        pretty_print(f\"Language: {detector.detect_language(text)}\", color=\"status\")\n        result = detector.analyze(text)\n        trans = detector.translate(text, result['language'])\n        pretty_print(f\"Translation: {trans} - from: {result['language']}\")"
  },
  {
    "path": "sources/llm_provider.py",
    "content": "import os\nimport platform\nimport socket\nimport subprocess\nimport time\nfrom urllib.parse import urlparse\n\nimport httpx\nimport requests\nfrom dotenv import load_dotenv\nfrom ollama import Client as OllamaClient\nfrom openai import OpenAI\n\nfrom sources.logger import Logger\nfrom sources.utility import pretty_print, animate_thinking\n\nclass Provider:\n    def __init__(self, provider_name, model, server_address=\"127.0.0.1:5000\", is_local=False):\n        self.provider_name = provider_name.lower()\n        self.model = model\n        self.is_local = is_local\n        self.server_ip = server_address\n        self.server_address = server_address\n        self.available_providers = {\n            \"ollama\": self.ollama_fn,\n            \"server\": self.server_fn,\n            \"openai\": self.openai_fn,\n            \"lm-studio\": self.lm_studio_fn,\n            \"huggingface\": self.huggingface_fn,\n            \"google\": self.google_fn,\n            \"deepseek\": self.deepseek_fn,\n            \"together\": self.together_fn,\n            \"dsk_deepseek\": self.dsk_deepseek,\n            \"openrouter\": self.openrouter_fn,\n            \"minimax\": self.minimax_fn,\n            \"test\": self.test_fn\n        }\n        self.logger = Logger(\"provider.log\")\n        self.api_key = None\n        self.internal_url, self.in_docker = self.get_internal_url()\n        self.unsafe_providers = [\"openai\", \"deepseek\", \"dsk_deepseek\", \"together\", \"google\", \"openrouter\", \"minimax\"]\n        if self.provider_name not in self.available_providers:\n            raise ValueError(f\"Unknown provider: {provider_name}\")\n        if self.provider_name in self.unsafe_providers and self.is_local == False:\n            pretty_print(\"Warning: you are using an API provider. You data will be sent to the cloud.\", color=\"warning\")\n            self.api_key = self.get_api_key(self.provider_name)\n        elif self.provider_name != \"ollama\":\n            pretty_print(f\"Provider: {provider_name} initialized at {self.server_ip}\", color=\"success\")\n\n    def get_model_name(self) -> str:\n        return self.model\n\n    def get_api_key(self, provider):\n        load_dotenv()\n        api_key_var = f\"{provider.upper()}_API_KEY\"\n        api_key = os.getenv(api_key_var)\n        if not api_key:\n            pretty_print(f\"API key {api_key_var} not found in .env file. Please add it\", color=\"warning\")\n            exit(1)\n        return api_key\n    \n    def get_internal_url(self):\n        load_dotenv()\n        url = os.getenv(\"DOCKER_INTERNAL_URL\")\n        if not url: # running on host\n            return \"http://localhost\", False\n        return url, True\n\n    def respond(self, history, verbose=True):\n        \"\"\"\n        Use the choosen provider to generate text.\n        \"\"\"\n        llm = self.available_providers[self.provider_name]\n        self.logger.info(f\"Using provider: {self.provider_name} at {self.server_ip}\")\n        try:\n            thought = llm(history, verbose)\n        except KeyboardInterrupt:\n            self.logger.warning(\"User interrupted the operation with Ctrl+C\")\n            return \"Operation interrupted by user. REQUEST_EXIT\"\n        except ConnectionError as e:\n            raise ConnectionError(f\"{str(e)}\\nConnection to {self.server_ip} failed.\")\n        except AttributeError as e:\n            raise NotImplementedError(f\"{str(e)}\\nIs {self.provider_name} implemented ?\")\n        except ModuleNotFoundError as e:\n            raise ModuleNotFoundError(\n                f\"{str(e)}\\nA import related to provider {self.provider_name} was not found. Is it installed ?\")\n        except Exception as e:\n            if \"try again later\" in str(e).lower():\n                return f\"{self.provider_name} server is overloaded. Please try again later.\"\n            if \"refused\" in str(e):\n                return f\"Server {self.server_ip} seem offline. Unable to answer.\"\n            raise Exception(f\"Provider {self.provider_name} failed: {str(e)}\") from e\n        return thought\n\n    def is_ip_online(self, address: str, timeout: int = 10) -> bool:\n        \"\"\"\n        Check if an address is online by sending a ping request.\n        \"\"\"\n        if not address:\n            return False\n        parsed = urlparse(address if address.startswith(('http://', 'https://')) else f'http://{address}')\n\n        hostname = parsed.hostname or address\n        if \"127.0.0.1\" in address or \"localhost\" in address:\n            return True\n        try:\n            ip_address = socket.gethostbyname(hostname)\n        except socket.gaierror:\n            self.logger.error(f\"Cannot resolve: {hostname}\")\n            return False\n        param = '-n' if platform.system().lower() == 'windows' else '-c'\n        command = ['ping', param, '1', ip_address]\n        try:\n            result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout)\n            return result.returncode == 0\n        except (subprocess.TimeoutExpired, subprocess.SubprocessError) as e:\n            return False\n\n    def server_fn(self, history, verbose=False):\n        \"\"\"\n        Use a remote server with LLM to generate text.\n        \"\"\"\n        thought = \"\"\n        route_setup = f\"{self.server_ip}/setup\"\n        route_gen = f\"{self.server_ip}/generate\"\n\n        if not self.is_ip_online(self.server_ip):\n            pretty_print(f\"Server is offline at {self.server_ip}\", color=\"failure\")\n\n        try:\n            requests.post(route_setup, json={\"model\": self.model})\n            requests.post(route_gen, json={\"messages\": history})\n            is_complete = False\n            while not is_complete:\n                try:\n                    response = requests.get(f\"{self.server_ip}/get_updated_sentence\")\n                    if \"error\" in response.json():\n                        pretty_print(response.json()[\"error\"], color=\"failure\")\n                        break\n                    thought = response.json()[\"sentence\"]\n                    is_complete = bool(response.json()[\"is_complete\"])\n                    time.sleep(2)\n                except requests.exceptions.RequestException as e:\n                    pretty_print(f\"HTTP request failed: {str(e)}\", color=\"failure\")\n                    break\n                except ValueError as e:\n                    pretty_print(f\"Failed to parse JSON response: {str(e)}\", color=\"failure\")\n                    break\n                except Exception as e:\n                    pretty_print(f\"An error occurred: {str(e)}\", color=\"failure\")\n                    break\n        except KeyError as e:\n            raise Exception(\n                f\"{str(e)}\\nError occured with server route. Are you using the correct address for the config.ini provider?\") from e\n        except Exception as e:\n            raise e\n        return thought\n\n    def ollama_fn(self, history, verbose=False):\n        \"\"\"\n        Use local or remote Ollama server to generate text.\n        \"\"\"\n        thought = \"\"\n        host = f\"{self.internal_url}:11434\" if self.is_local else f\"http://{self.server_address}\"\n        client = OllamaClient(host=host)\n\n        try:\n            stream = client.chat(\n                model=self.model,\n                messages=history,\n                stream=True,\n            )\n            for chunk in stream:\n                if verbose:\n                    print(chunk[\"message\"][\"content\"], end=\"\", flush=True)\n                thought += chunk[\"message\"][\"content\"]\n        except httpx.ConnectError as e:\n            raise Exception(\n                f\"\\nOllama connection failed at {host}. Check if the server is running.\"\n            ) from e\n        except Exception as e:\n            if hasattr(e, 'status_code') and e.status_code == 404:\n                animate_thinking(f\"Downloading {self.model}...\")\n                client.pull(self.model)\n                self.ollama_fn(history, verbose)\n            if \"refused\" in str(e).lower():\n                raise Exception(\n                    f\"Ollama connection refused at {host}. Is the server running?\"\n                ) from e\n            raise e\n\n        return thought\n\n    def huggingface_fn(self, history, verbose=False):\n        \"\"\"\n        Use huggingface to generate text.\n        \"\"\"\n        from huggingface_hub import InferenceClient\n        client = InferenceClient(\n            api_key=self.get_api_key(\"huggingface\")\n        )\n        completion = client.chat.completions.create(\n            model=self.model,\n            messages=history,\n            max_tokens=1024,\n        )\n        thought = completion.choices[0].message\n        return thought.content\n\n    def openai_fn(self, history, verbose=False):\n        \"\"\"\n        Use openai to generate text.\n        \"\"\"\n        base_url = self.server_ip\n        if self.is_local and self.in_docker:\n            try:\n                host, port = base_url.split(':')\n            except Exception as e:\n                port = \"8000\"\n            client = OpenAI(api_key=self.api_key, base_url=f\"{self.internal_url}:{port}\")\n        elif self.is_local:\n            client = OpenAI(api_key=self.api_key, base_url=f\"http://{base_url}\")\n        else:\n            client = OpenAI(api_key=self.api_key)\n\n        try:\n            response = client.chat.completions.create(\n                model=self.model,\n                messages=history,\n            )\n            if response is None:\n                raise Exception(\"OpenAI response is empty.\")\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"OpenAI API error: {str(e)}\") from e\n\n    def anthropic_fn(self, history, verbose=False):\n        \"\"\"\n        Use Anthropic to generate text.\n        \"\"\"\n        from anthropic import Anthropic\n\n        client = Anthropic(api_key=self.api_key)\n        system_message = None\n        messages = []\n        for message in history:\n            clean_message = {'role': message['role'], 'content': message['content']}\n            if message['role'] == 'system':\n                system_message = message['content']\n            else:\n                messages.append(clean_message)\n\n        try:\n            response = client.messages.create(\n                model=self.model,\n                max_tokens=1024,\n                messages=messages,\n                system=system_message\n            )\n            if response is None:\n                raise Exception(\"Anthropic response is empty.\")\n            thought = response.content[0].text\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"Anthropic API error: {str(e)}\") from e\n\n    def google_fn(self, history, verbose=False):\n        \"\"\"\n        Use google gemini to generate text.\n        \"\"\"\n        base_url = self.server_ip\n        if self.is_local:\n            raise Exception(\"Google Gemini is not available for local use. Change config.ini\")\n\n        client = OpenAI(api_key=self.api_key, base_url=\"https://generativelanguage.googleapis.com/v1beta/openai/\")\n        try:\n            response = client.chat.completions.create(\n                model=self.model,\n                messages=history,\n            )\n            if response is None:\n                raise Exception(\"Google response is empty.\")\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"GOOGLE API error: {str(e)}\") from e\n\n    def together_fn(self, history, verbose=False):\n        \"\"\"\n        Use together AI for completion\n        \"\"\"\n        from together import Together\n        client = Together(api_key=self.api_key)\n        if self.is_local:\n            raise Exception(\"Together AI is not available for local use. Change config.ini\")\n\n        try:\n            response = client.chat.completions.create(\n                model=self.model,\n                messages=history,\n            )\n            if response is None:\n                raise Exception(\"Together AI response is empty.\")\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"Together AI API error: {str(e)}\") from e\n\n    def deepseek_fn(self, history, verbose=False):\n        \"\"\"\n        Use deepseek api to generate text.\n        \"\"\"\n        client = OpenAI(api_key=self.api_key, base_url=\"https://api.deepseek.com\")\n        if self.is_local:\n            raise Exception(\"Deepseek (API) is not available for local use. Change config.ini\")\n        try:\n            response = client.chat.completions.create(\n                model=\"deepseek-chat\",\n                messages=history,\n                stream=False\n            )\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"Deepseek API error: {str(e)}\") from e\n\n    def lm_studio_fn(self, history, verbose=False):\n        \"\"\"\n        Use local lm-studio server to generate text.\n        \"\"\"\n        if self.in_docker:\n            # Extract port from server_address if present\n            port = \"1234\"  # default\n            if \":\" in self.server_address:\n                port = self.server_address.split(\":\")[1]\n            url = f\"{self.internal_url}:{port}\"\n        else:\n            url = f\"http://{self.server_ip}\"\n        route_start = f\"{url}/v1/chat/completions\"\n        payload = {\n            \"messages\": history,\n            \"temperature\": 0.7,\n            \"max_tokens\": 4096,\n            \"model\": self.model\n        }\n\n        try:\n            response = requests.post(route_start, json=payload, timeout=30)\n            if response.status_code != 200:\n                raise Exception(f\"LM Studio returned status {response.status_code}: {response.text}\")\n            if not response.text.strip():\n                raise Exception(\"LM Studio returned empty response\")\n            try:\n                result = response.json()\n            except ValueError as json_err:\n                raise Exception(f\"Invalid JSON from LM Studio: {response.text[:200]}\") from json_err\n\n            if verbose:\n                print(\"Response from LM Studio:\", result)\n            choices = result.get(\"choices\", [])\n            if not choices:\n                raise Exception(f\"No choices in LM Studio response: {result}\")\n\n            message = choices[0].get(\"message\", {})\n            content = message.get(\"content\", \"\")\n            if not content:\n                raise Exception(f\"Empty content in LM Studio response: {result}\")\n            return content\n\n        except requests.exceptions.Timeout:\n            raise Exception(\"LM Studio request timed out - check if server is responsive\")\n        except requests.exceptions.ConnectionError:\n            raise Exception(f\"Cannot connect to LM Studio at {route_start} - check if server is running\")\n        except requests.exceptions.RequestException as e:\n            raise Exception(f\"HTTP request failed: {str(e)}\") from e\n        except Exception as e:\n            if \"LM Studio\" in str(e):\n                raise  # Re-raise our custom exceptions\n            raise Exception(f\"Unexpected error: {str(e)}\") from e\n        return thought\n\n    def openrouter_fn(self, history, verbose=False):\n        \"\"\"\n        Use OpenRouter API to generate text.\n        \"\"\"\n        client = OpenAI(api_key=self.api_key, base_url=\"https://openrouter.ai/api/v1\")\n        if self.is_local:\n            # This case should ideally not be reached if unsafe_providers is set correctly\n            # and is_local is False in config for openrouter\n            raise Exception(\"OpenRouter is not available for local use. Change config.ini\")\n        try:\n            response = client.chat.completions.create(\n                model=self.model,\n                messages=history,\n            )\n            if response is None:\n                raise Exception(\"OpenRouter response is empty.\")\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"OpenRouter API error: {str(e)}\") from e\n\n    def minimax_fn(self, history, verbose=False):\n        \"\"\"\n        Use MiniMax API to generate text via OpenAI-compatible interface.\n        \n        Supported models:\n        - MiniMax-M2.5: Peak performance model (~60 tps), 204,800 context window\n        - MiniMax-M2.5-highspeed: Same performance, faster (~100 tps)\n        \n        Note: temperature must be in range (0.0, 1.0], default is 1.0\n        \"\"\"\n        load_dotenv()\n        base_url = os.getenv(\"MINIMAX_BASE_URL\", \"https://api.minimax.io/v1\")\n        \n        client = OpenAI(api_key=self.api_key, base_url=base_url)\n        if self.is_local:\n            raise Exception(\"MiniMax is not available for local use. Change config.ini\")\n        try:\n            response = client.chat.completions.create(\n                model=self.model,\n                messages=history,\n                temperature=1.0,\n            )\n            if response is None:\n                raise Exception(\"MiniMax response is empty.\")\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"MiniMax API error: {str(e)}\") from e\n\n    def dsk_deepseek(self, history, verbose=False):\n        \"\"\"\n        Use: xtekky/deepseek4free\n        For free api. Api key should be set to DSK_DEEPSEEK_API_KEY\n        This is an unofficial provider, you'll have to find how to set it up yourself.\n        \"\"\"\n        from dsk.api import (\n            DeepSeekAPI,\n            AuthenticationError,\n            RateLimitError,\n            NetworkError,\n            CloudflareError,\n            APIError\n        )\n        thought = \"\"\n        message = '\\n---\\n'.join([f\"{msg['role']}: {msg['content']}\" for msg in history])\n\n        try:\n            api = DeepSeekAPI(self.api_key)\n            chat_id = api.create_chat_session()\n            for chunk in api.chat_completion(chat_id, message):\n                if chunk['type'] == 'text':\n                    thought += chunk['content']\n            return thought\n        except AuthenticationError:\n            raise AuthenticationError(\"Authentication failed. Please check your token.\") from e\n        except RateLimitError:\n            raise RateLimitError(\"Rate limit exceeded. Please wait before making more requests.\") from e\n        except CloudflareError as e:\n            raise CloudflareError(f\"Cloudflare protection encountered: {str(e)}\") from e\n        except NetworkError:\n            raise NetworkError(\"Network error occurred. Check your internet connection.\") from e\n        except APIError as e:\n            raise APIError(f\"API error occurred: {str(e)}\") from e\n        return None\n\n    def test_fn(self, history, verbose=True):\n        \"\"\"\n        This function is used to conduct tests.\n        \"\"\"\n        thought = \"\"\"\n\\n\\n```json\\n{\\n  \\\"plan\\\": [\\n    {\\n      \\\"agent\\\": \\\"Web\\\",\\n      \\\"id\\\": \\\"1\\\",\\n      \\\"need\\\": null,\\n      \\\"task\\\": \\\"Conduct a comprehensive web search to identify at least five AI startups located in Osaka. Use reliable sources and websites such as Crunchbase, TechCrunch, or local Japanese business directories. Capture the company names, their websites, areas of expertise, and any other relevant details.\\\"\\n    },\\n    {\\n      \\\"agent\\\": \\\"Web\\\",\\n      \\\"id\\\": \\\"2\\\",\\n      \\\"need\\\": null,\\n      \\\"task\\\": \\\"Perform a similar search to find at least five AI startups in Tokyo. Again, use trusted sources like Crunchbase, TechCrunch, or Japanese business news websites. Gather the same details as for Osaka: company names, websites, areas of focus, and additional information.\\\"\\n    },\\n    {\\n      \\\"agent\\\": \\\"File\\\",\\n      \\\"id\\\": \\\"3\\\",\\n      \\\"need\\\": [\\\"1\\\", \\\"2\\\"],\\n      \\\"task\\\": \\\"Create a new text file named research_japan.txt in the user's home directory. Organize the data collected from both searches into this file, ensuring it is well-structured and formatted for readability. Include headers for Osaka and Tokyo sections, followed by the details of each startup found.\\\"\\n    }\\n  ]\\n}\\n```\n        \"\"\"\n        return thought\n\n\nif __name__ == \"__main__\":\n    provider = Provider(\"server\", \"deepseek-r1:32b\", \" x.x.x.x:8080\")\n    res = provider.respond([\"user\", \"Hello, how are you?\"])\n    print(\"Response:\", res)\n"
  },
  {
    "path": "sources/logger.py",
    "content": "import os, sys\nfrom typing import List, Tuple, Type, Dict\nimport datetime\nimport logging\n\nclass Logger:\n    def __init__(self, log_filename):\n        self.folder = '.logs'\n        self.create_folder(self.folder)\n        self.log_path = os.path.join(self.folder, log_filename)\n        self.enabled = True\n        self.logger = None\n        self.last_log_msg = \"\"\n        if self.enabled:\n            self.create_logging(log_filename)\n\n    def create_logging(self, log_filename):\n        self.logger = logging.getLogger(log_filename)\n        self.logger.setLevel(logging.DEBUG)\n        self.logger.handlers.clear()\n        self.logger.propagate = False\n        file_handler = logging.FileHandler(self.log_path)\n        formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')\n        file_handler.setFormatter(formatter)\n        self.logger.addHandler(file_handler)\n\n    \n    def create_folder(self, path):\n        \"\"\"Create log dir\"\"\"\n        try:\n            if not os.path.exists(path):\n                os.makedirs(path, exist_ok=True) \n            return True\n        except Exception as e:\n            self.enabled = False\n            return False\n    \n    def log(self, message, level=logging.INFO):\n        if self.last_log_msg == message:\n            return\n        if self.enabled:\n            self.last_log_msg = message\n            self.logger.log(level, message)\n\n    def info(self, message):\n        self.log(message)\n\n    def error(self, message):\n        self.log(message, level=logging.ERROR)\n\n    def warning(self, message):\n        self.log(message, level=logging.WARN)\n\nif __name__ == \"__main__\":\n    lg = Logger(\"test.log\")\n    lg.log(\"hello\")\n    lg2 = Logger(\"toto.log\")\n    lg2.log(\"yo\")\n    \n\n        "
  },
  {
    "path": "sources/memory.py",
    "content": "import time\nimport datetime\nimport uuid\nimport os\nimport sys\nimport json\nfrom typing import List, Tuple, Type, Dict\nimport torch\nfrom transformers import AutoTokenizer, AutoModelForSeq2SeqLM\nimport configparser\n\nfrom sources.utility import timer_decorator, pretty_print, animate_thinking\nfrom sources.logger import Logger\n\nconfig = configparser.ConfigParser()\nconfig.read('config.ini')\n\nclass Memory():\n    \"\"\"\n    Memory is a class for managing the conversation memory\n    It provides a method to compress the memory using summarization model.\n    \"\"\"\n    def __init__(self, system_prompt: str,\n                 recover_last_session: bool = False,\n                 memory_compression: bool = True,\n                 model_provider: str = \"deepseek-r1:14b\"):\n        self.memory = [{'role': 'system', 'content': system_prompt}]\n        \n        self.logger = Logger(\"memory.log\")\n        self.session_time = datetime.datetime.now()\n        self.session_id = str(uuid.uuid4())\n        self.conversation_folder = f\"conversations/\"\n        self.session_recovered = False\n        if recover_last_session:\n            self.load_memory()\n            self.session_recovered = True\n        # memory compression system\n        self.model = None\n        self.tokenizer = None\n        self.device = self.get_cuda_device()\n        self.memory_compression = memory_compression\n        self.model_provider = model_provider\n        if self.memory_compression:\n            self.download_model()\n\n    def get_ideal_ctx(self, model_name: str) -> int | None:\n        \"\"\"\n        Estimate context size based on the model name.\n        EXPERIMENTAL for memory compression\n        \"\"\"\n        import re\n        import math\n\n        def extract_number_before_b(sentence: str) -> int:\n            match = re.search(r'(\\d+)b', sentence, re.IGNORECASE)\n            return int(match.group(1)) if match else None\n\n        model_size = extract_number_before_b(model_name)\n        if not model_size:\n            return None\n        base_size = 7  # Base model size in billions\n        base_context = 4096  # Base context size in tokens\n        scaling_factor = 1.5  # Approximate scaling factor for context size growth\n        context_size = int(base_context * (model_size / base_size) ** scaling_factor)\n        context_size = 2 ** round(math.log2(context_size))\n        self.logger.info(f\"Estimated context size for {model_name}: {context_size} tokens.\")\n        return context_size\n    \n    def download_model(self):\n        \"\"\"Download the model if not already downloaded.\"\"\"\n        animate_thinking(\"Loading memory compression model...\", color=\"status\")\n        self.tokenizer = AutoTokenizer.from_pretrained(\"pszemraj/led-base-book-summary\")\n        self.model = AutoModelForSeq2SeqLM.from_pretrained(\"pszemraj/led-base-book-summary\")\n        self.logger.info(\"Memory compression system initialized.\")\n    \n    def get_filename(self) -> str:\n        \"\"\"Get the filename for the save file.\"\"\"\n        return f\"memory_{self.session_time.strftime('%Y-%m-%d_%H-%M-%S')}.txt\"\n    \n    def save_memory(self, agent_type: str = \"casual_agent\") -> None:\n        \"\"\"Save the session memory to a file.\"\"\"\n        if not os.path.exists(self.conversation_folder):\n            self.logger.info(f\"Created folder {self.conversation_folder}.\")\n            os.makedirs(self.conversation_folder)\n        save_path = os.path.join(self.conversation_folder, agent_type)\n        if not os.path.exists(save_path):\n            os.makedirs(save_path)\n        filename = self.get_filename()\n        path = os.path.join(save_path, filename)\n        json_memory = json.dumps(self.memory)\n        with open(path, 'w') as f:\n            self.logger.info(f\"Saved memory json at {path}\")\n            f.write(json_memory)\n    \n    def find_last_session_path(self, path) -> str:\n        \"\"\"Find the last session path.\"\"\"\n        saved_sessions = []\n        for filename in os.listdir(path):\n            if filename.startswith('memory_'):\n                date = filename.split('_')[1]\n                saved_sessions.append((filename, date))\n        saved_sessions.sort(key=lambda x: x[1], reverse=True)\n        if len(saved_sessions) > 0:\n            self.logger.info(f\"Last session found at {saved_sessions[0][0]}\")\n            return saved_sessions[0][0]\n        return None\n    \n    def save_json_file(self, path: str, json_memory: dict) -> None:\n        \"\"\"Save a JSON file.\"\"\"\n        try:\n            with open(path, 'w') as f:\n                json.dump(json_memory, f)\n                self.logger.info(f\"Saved memory json at {path}\")\n        except Exception as e:\n            self.logger.warning(f\"Error saving file {path}: {e}\")\n    \n    def load_json_file(self, path: str) -> dict:\n        \"\"\"Load a JSON file.\"\"\"\n        json_memory = {}\n        try:\n            with open(path, 'r') as f:\n                json_memory = json.load(f)\n        except FileNotFoundError:\n            self.logger.warning(f\"File not found: {path}\")\n            return {}\n        except json.JSONDecodeError:\n            self.logger.warning(f\"Error decoding JSON from file: {path}\")\n            return {}\n        except Exception as e:\n            self.logger.warning(f\"Error loading file {path}: {e}\")\n            return {}\n        return json_memory\n\n    def load_memory(self, agent_type: str = \"casual_agent\") -> None:\n        \"\"\"Load the memory from the last session.\"\"\"\n        if self.session_recovered == True:\n            return\n        pretty_print(f\"Loading {agent_type} past memories... \", color=\"status\")\n        save_path = os.path.join(self.conversation_folder, agent_type)\n        if not os.path.exists(save_path):\n            pretty_print(\"No memory to load.\", color=\"success\")\n            return\n        filename = self.find_last_session_path(save_path)\n        if filename is None:\n            pretty_print(\"Last session memory not found.\", color=\"warning\")\n            return\n        path = os.path.join(save_path, filename)\n        self.memory = self.load_json_file(path) \n        if self.memory[-1]['role'] == 'user':\n            self.memory.pop()\n        self.compress()\n        pretty_print(\"Session recovered successfully\", color=\"success\")\n    \n    def reset(self, memory: list = []) -> None:\n        self.logger.info(\"Memory reset performed.\")\n        self.memory = memory\n    \n    def push(self, role: str, content: str) -> int:\n        \"\"\"Push a message to the memory.\"\"\"\n        ideal_ctx = self.get_ideal_ctx(self.model_provider)\n        if ideal_ctx is not None:\n            if self.memory_compression and len(content) > ideal_ctx * 1.5:\n                self.logger.info(f\"Compressing memory: Content {len(content)} > {ideal_ctx} model context.\")\n                self.compress()\n        curr_idx = len(self.memory)\n        if self.memory[curr_idx-1]['content'] == content:\n            pretty_print(\"Warning: same message have been pushed twice to memory\", color=\"error\")\n        time_str = datetime.datetime.now().strftime(\"%Y-%m-%d %H:%M:%S\")\n        if config[\"MAIN\"][\"provider_name\"] == \"openrouter\":\n            self.memory.append({'role': role, 'content': content})\n        else:\n            self.memory.append({'role': role, 'content': content, 'time': time_str, 'model_used': self.model_provider})\n        return curr_idx-1\n    \n    def clear(self) -> None:\n        \"\"\"Clear all memory except system prompt\"\"\"\n        self.logger.info(\"Memory clear performed.\")\n        self.memory = self.memory[:1]\n    \n    def clear_section(self, start: int, end: int) -> None:\n        \"\"\"\n        Clear a section of the memory. Ignore system message index.\n        Args:\n            start (int): Starting bound of the section to clear.\n            end (int): Ending bound of the section to clear.\n        \"\"\"\n        self.logger.info(f\"Clearing memory section {start} to {end}.\")\n        start = max(0, start) + 1\n        end = min(end, len(self.memory)-1) + 2\n        self.memory = self.memory[:start] + self.memory[end:]\n    \n    def get(self) -> list:\n        return self.memory\n\n    def get_cuda_device(self) -> str:\n        if torch.backends.mps.is_available():\n            return \"mps\"\n        elif torch.cuda.is_available():\n            return \"cuda\"\n        else:\n            return \"cpu\"\n\n    def summarize(self, text: str, min_length: int = 64) -> str:\n        \"\"\"\n        Summarize the text using the AI model.\n        Args:\n            text (str): The text to summarize\n            min_length (int, optional): The minimum length of the summary. Defaults to 64.\n        Returns:\n            str: The summarized text\n        \"\"\"\n        if self.tokenizer is None or self.model is None:\n            self.logger.warning(\"No tokenizer or model to perform summarization.\")\n            return text\n        if len(text) < min_length*1.5:\n            return text\n        max_length = len(text) // 2 if len(text) > min_length*2 else min_length*2\n        input_text = \"summarize: \" + text\n        inputs = self.tokenizer(input_text, return_tensors=\"pt\", max_length=512, truncation=True)\n        summary_ids = self.model.generate(\n            inputs['input_ids'],\n            max_length=max_length,\n            min_length=min_length,\n            length_penalty=1.0,\n            num_beams=4,\n            early_stopping=True\n        )\n        summary = self.tokenizer.decode(summary_ids[0], skip_special_tokens=True)\n        summary.replace('summary:', '')\n        self.logger.info(f\"Memory summarized from len {len(text)} to {len(summary)}.\")\n        self.logger.info(f\"Summarized text:\\n{summary}\")\n        return summary\n    \n    #@timer_decorator\n    def compress(self) -> str:\n        \"\"\"\n        Compress (summarize) the memory using the model.\n        \"\"\"\n        if self.tokenizer is None or self.model is None:\n            self.logger.warning(\"No tokenizer or model to perform memory compression.\")\n            return\n        for i in range(len(self.memory)):\n            if self.memory[i]['role'] == 'system':\n                continue\n            if len(self.memory[i]['content']) > 1024:\n                self.memory[i]['content'] = self.summarize(self.memory[i]['content'])\n    \n    def trim_text_to_max_ctx(self, text: str) -> str:\n        \"\"\"\n        Truncate a text to fit within the maximum context size of the model.\n        \"\"\"\n        ideal_ctx = self.get_ideal_ctx(self.model_provider)\n        return text[:ideal_ctx] if ideal_ctx is not None else text\n    \n    #@timer_decorator\n    def compress_text_to_max_ctx(self, text) -> str:\n        \"\"\"\n        Compress a text to fit within the maximum context size of the model.\n        \"\"\"\n        if self.tokenizer is None or self.model is None:\n            self.logger.warning(\"No tokenizer or model to perform memory compression.\")\n            return text\n        ideal_ctx = self.get_ideal_ctx(self.model_provider)\n        if ideal_ctx is None:\n            self.logger.warning(\"No ideal context size found.\")\n            return text\n        while len(text) > ideal_ctx:\n            self.logger.info(f\"Compressing text: {len(text)} > {ideal_ctx} model context.\")\n            text = self.summarize(text)\n        return text\n\nif __name__ == \"__main__\":\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n    memory = Memory(\"You are a helpful assistant.\",\n                    recover_last_session=False, memory_compression=True)\n\n    memory.push('user', \"hello\")\n    memory.push('assistant', \"how can i help you?\")\n    memory.push('user', \"why do i get this cuda error?\")\n    sample_text = \"\"\"\nThe error you're encountering:\ncuda.cu:52:10: fatal error: helper_functions.h: No such file or directory\n #include <helper_functions.h>\nindicates that the compiler cannot find the helper_functions.h file. This is because the #include <helper_functions.h> directive is looking for the file in the system's include paths, but the file is either not in those paths or is located in a different directory.\n1. Use #include \"helper_functions.h\" Instead of #include <helper_functions.h>\nAngle brackets (< >) are used for system or standard library headers.\nQuotes (\" \") are used for local or project-specific headers.\nIf helper_functions.h is in the same directory as cuda.cu, change the include directive to:\n3. Verify the File Exists\nDouble-check that helper_functions.h exists in the specified location. If the file is missing, you'll need to obtain or recreate it.\n4. Use the Correct CUDA Samples Path (if applicable)\nIf helper_functions.h is part of the CUDA Samples, ensure you have the CUDA Samples installed and include the correct path. For example, on Linux, the CUDA Samples are typically located in /usr/local/cuda/samples/common/inc. You can include this path like so:\nUse #include \"helper_functions.h\" for local files.\nUse the -I flag to specify the directory containing helper_functions.h.\nEnsure the file exists in the specified location.\n    \"\"\"\n    memory.push('assistant', sample_text)\n    \n    print(\"\\n---\\nmemory before:\", memory.get())\n    memory.compress()\n    print(\"\\n---\\nmemory after:\", memory.get())\n    #memory.save_memory()\n    "
  },
  {
    "path": "sources/router.py",
    "content": "import os\nimport sys\nimport torch\nimport random\nfrom typing import List, Tuple, Type, Dict\n\nfrom transformers import pipeline\nfrom adaptive_classifier import AdaptiveClassifier\n\nfrom sources.agents.agent import Agent\nfrom sources.agents.code_agent import CoderAgent\nfrom sources.agents.casual_agent import CasualAgent\nfrom sources.agents.planner_agent import FileAgent\nfrom sources.agents.browser_agent import BrowserAgent\nfrom sources.language import LanguageUtility\nfrom sources.utility import pretty_print, animate_thinking, timer_decorator\nfrom sources.logger import Logger\n\nclass AgentRouter:\n    \"\"\"\n    AgentRouter is a class that selects the appropriate agent based on the user query.\n    \"\"\"\n    def __init__(self, agents: list, supported_language: List[str] = [\"en\", \"fr\", \"zh\"]):\n        self.agents = agents\n        self.logger = Logger(\"router.log\")\n        self.lang_analysis = LanguageUtility(supported_language=supported_language)\n        self.pipelines = self.load_pipelines()\n        self.talk_classifier = self.load_llm_router()\n        self.complexity_classifier = self.load_llm_router()\n        self.learn_few_shots_tasks()\n        self.learn_few_shots_complexity()\n        self.asked_clarify = False\n    \n    def load_pipelines(self) -> Dict[str, Type[pipeline]]:\n        \"\"\"\n        Load the pipelines for the text classification used for routing.\n        returns:\n            Dict[str, Type[pipeline]]: The loaded pipelines\n        \"\"\"\n        animate_thinking(\"Loading zero-shot pipeline...\", color=\"status\")\n        return {\n            \"bart\": pipeline(\"zero-shot-classification\", model=\"facebook/bart-large-mnli\")\n        }\n\n    def load_llm_router(self) -> AdaptiveClassifier:\n        \"\"\"\n        Load the LLM router model.\n        returns:\n            AdaptiveClassifier: The loaded model\n        exceptions:\n            Exception: If the safetensors fails to load\n        \"\"\"\n        path = \"../llm_router\" if __name__ == \"__main__\" else \"./llm_router\"\n        try:\n            animate_thinking(\"Loading LLM router model...\", color=\"status\")\n            talk_classifier = AdaptiveClassifier.from_pretrained(path)\n        except Exception as e:\n            raise Exception(\"Failed to load the routing model. Please run the dl_safetensors.sh script inside llm_router/ directory to download the model.\")\n        return talk_classifier\n\n    def get_device(self) -> str:\n        if torch.backends.mps.is_available():\n            return \"mps\"\n        elif torch.cuda.is_available():\n            return \"cuda:0\"\n        else:\n            return \"cpu\"\n    \n    def learn_few_shots_complexity(self) -> None:\n        \"\"\"\n        Few shot learning for complexity estimation.\n        Use the build in add_examples method of the Adaptive_classifier.\n        \"\"\"\n        few_shots = [\n            (\"hi\", \"LOW\"),\n            (\"How it's going ?\", \"LOW\"),\n            (\"What’s the weather like today?\", \"LOW\"),\n            (\"Can you find a file named ‘notes.txt’ in my Documents folder?\", \"LOW\"),\n            (\"Write a Python script to generate a random password\", \"LOW\"),\n            (\"Debug this JavaScript code that’s not running properly\", \"LOW\"),\n            (\"Search the web for the cheapest laptop under $500\", \"LOW\"),\n            (\"Locate a file called ‘report_2024.pdf’ on my drive\", \"LOW\"),\n            (\"Check if a folder named ‘Backups’ exists on my system\", \"LOW\"),\n            (\"Can you find ‘family_vacation.mp4’ in my Videos folder?\", \"LOW\"),\n            (\"Search my drive for a file named ‘todo_list.xlsx’\", \"LOW\"),\n            (\"Write a Python function to check if a string is a palindrome\", \"LOW\"),\n            (\"Can you search the web for startups in Berlin?\", \"LOW\"),\n            (\"Find recent articles on blockchain technology online\", \"LOW\"),\n            (\"Check if ‘Personal_Projects’ folder exists on my desktop\", \"LOW\"),\n            (\"Create a bash script to list all running processes\", \"LOW\"),\n            (\"Debug this Python script that’s crashing on line 10\", \"LOW\"),\n            (\"Browse the web to find out who invented Python\", \"LOW\"),\n            (\"Locate a file named ‘shopping_list.txt’ on my system\", \"LOW\"),\n            (\"Search the web for tips on staying productive\", \"LOW\"),\n            (\"Find ‘sales_pitch.pptx’ in my Downloads folder\", \"LOW\"),\n            (\"can you find a file called resume.docx on my drive?\", \"LOW\"),\n            (\"can you write a python script to check if the device on my network is connected to the internet\", \"LOW\"),\n            (\"can you debug this Java code? It’s not working.\", \"LOW\"),\n            (\"can you find the old_project.zip file somewhere on my drive?\", \"LOW\"),\n            (\"can you locate the backup folder I created last month on my system?\", \"LOW\"),\n            (\"could you check if the presentation.pdf file exists in my downloads?\", \"LOW\"),\n            (\"search my drive for a file called vacation_photos_2023.jpg.\", \"LOW\"),\n            (\"help me organize my desktop files into folders by type.\", \"LOW\"),\n            (\"make a blackjack in golang\", \"LOW\"),\n            (\"write a python script to ping a website\", \"LOW\"),\n            (\"write a simple Java program to print 'Hello World'\", \"LOW\"),\n            (\"write a Java program to calculate the area of a circle\", \"LOW\"),\n            (\"write a Python function to sort a list of dictionaries by key\", \"LOW\"),\n            (\"can you search for startup in tokyo?\", \"LOW\"),\n            (\"find the latest updates on quantum computing on the web\", \"LOW\"),\n            (\"check if the folder ‘Work_Projects’ exists on my desktop\", \"LOW\"),\n            (\" can you browse the web, use overpass-turbo to show fountains in toulouse\", \"LOW\"),\n            (\"search the web for the best budget smartphones of 2025\", \"LOW\"),\n            (\"write a Python script to download all images from a webpage\", \"LOW\"),\n            (\"create a bash script to monitor CPU usage\", \"LOW\"),\n            (\"debug this C++ code that keeps crashing\", \"LOW\"),\n            (\"can you browse the web to find out who fosowl is ?\", \"LOW\"),\n            (\"find the file ‘important_notes.txt’\", \"LOW\"),\n            (\"search the web for the best ways to learn a new language\", \"LOW\"),\n            (\"locate the file ‘presentation.pptx’ in my Documents folder\", \"LOW\"),\n            (\"Make a 3d game in javascript using three.js\", \"LOW\"),\n            (\"Find the latest research papers on AI and build save in a file\", \"HIGH\"),\n            (\"Make a web server in go that serve a simple html page\", \"LOW\"),\n            (\"Search the web for the cheapest 4K monitor and provide a link\", \"LOW\"),\n            (\"Write a JavaScript function to reverse a string\", \"LOW\"),\n            (\"Can you locate a file called ‘budget_2025.xlsx’ on my system?\", \"LOW\"),\n            (\"Search the web for recent articles on space exploration\", \"LOW\"),\n            (\"when is the exam period for master student in france?\", \"LOW\"),\n            (\"Check if a folder named ‘Photos_2024’ exists on my desktop\", \"LOW\"),\n            (\"Can you look up some nice knitting patterns on that web thingy?\", \"LOW\"),\n            (\"Goodness, check if my ‘Photos_Grandkids’ folder is still on the desktop\", \"LOW\"),\n            (\"Create a Python script to rename all files in a folder based on their creation date\", \"LOW\"),\n            (\"Can you find a file named ‘meeting_notes.txt’ in my Downloads folder?\", \"LOW\"),\n            (\"Write a Go program to check if a port is open on a network\", \"LOW\"),\n            (\"Search the web for the latest electric car reviews\", \"LOW\"),\n            (\"Write a Python function to merge two sorted lists\", \"LOW\"),\n            (\"Create a bash script to monitor disk space and alert via text file\", \"LOW\"),\n            (\"What’s out there on the web about cheap travel spots?\", \"LOW\"),\n            (\"Search X for posts about AI ethics and summarize them\", \"LOW\"),\n            (\"Check if a file named ‘project_proposal.pdf’ exists in my Documents\", \"LOW\"),\n            (\"Search the web for tips on improving coding skills\", \"LOW\"),\n            (\"Write a Python script to count words in a text file\", \"LOW\"),\n            (\"Search the web for restaurant\", \"LOW\"),\n            (\"Use a MCP to find the latest stock market data\", \"LOW\"),\n            (\"Use a MCP to send an email to my boss\", \"LOW\"),\n            (\"Could you use a MCP to find the latest news on climate change?\", \"LOW\"),\n            (\"Create a simple HTML page with CSS styling\", \"LOW\"),\n            (\"Use file.txt and then use it to ...\", \"HIGH\"),\n            (\"Yo, what’s good? Find my ‘mixtape.mp3’ real quick\", \"LOW\"),\n            (\"Can you follow the readme and install the project\", \"HIGH\"),\n            (\"Man, write me a dope Python script to flex some random numbers\", \"LOW\"),\n            (\"Search the web for peer-reviewed articles on gene editing\", \"LOW\"),\n            (\"Locate ‘meeting_notes.docx’ in Downloads, I’m late for this call\", \"LOW\"),\n            (\"Make the game less hard\", \"LOW\"),\n            (\"Why did it fail?\", \"LOW\"),\n            (\"Write a Python script to list all .pdf files in my Documents\", \"LOW\"),\n            (\"Write a Python thing to sort my .jpg files by date\", \"LOW\"),\n            (\"make a snake game please\", \"LOW\"),\n            (\"Find ‘gallery_list.pdf’, then build a web app to show my pics\", \"HIGH\"),\n            (\"Find ‘budget_2025.xlsx’, analyze it, and make a chart for my boss\", \"HIGH\"),\n            (\"I want you to make me a plan to travel to Tainan\", \"HIGH\"),\n            (\"Retrieve the latest publications on CRISPR and develop a web application to display them\", \"HIGH\"),\n            (\"Bro dig up a music API and build me a tight app for the hottest tracks\", \"HIGH\"),\n            (\"Find a public API for sports scores and build a web app to show live updates\", \"HIGH\"),\n            (\"Find a public API for book data and create a Flask app to list bestsellers\", \"HIGH\"),\n            (\"Organize my desktop files by extension and then write a script to list them\", \"HIGH\"),\n            (\"Find the latest research on renewable energy and build a web app to display it\", \"HIGH\"),\n            (\"search online for popular sci-fi movies from 2024 and pick three to watch tonight. Save the list in movie_night.txt\", \"HIGH\"),\n            (\"can you find vitess repo, clone it and install by following the readme\", \"HIGH\"),\n            (\"Create a JavaScript game using Phaser.js with multiple levels\", \"HIGH\"),\n            (\"Search the web for the latest trends in web development and build a sample site\", \"HIGH\"),\n            (\"Use my research_note.txt file, double check the informations on the web\", \"HIGH\"),\n            (\"Make a web server in go that query a flight API and display them in a app\", \"HIGH\"),\n            (\"Search the web for top cafes in Rennes, France, and save a list of three with their addresses in rennes_cafes.txt.\", \"HIGH\"),\n            (\"Search the web for the latest trends in AI and demo it in pytorch\", \"HIGH\"),\n            (\"can you lookup for api that track flight and build a web flight tracking app\", \"HIGH\"),\n            (\"Find the file toto.pdf then use its content to reply to Jojo on superforum.com\", \"HIGH\"),\n            (\"Create a whole web app in python using the flask framework that query news API\", \"HIGH\"),\n            (\"Create a bash script that monitor the CPU usage and send an email if it's too high\", \"HIGH\"),\n            (\"Make a web search for latest news on the stock market and display them with python\", \"HIGH\"),\n            (\"Find my resume file, apply to job that might fit online\", \"HIGH\"),\n            (\"Can you find a weather API and build a Python app to display current weather\", \"HIGH\"),\n            (\"Create a Python web app using Flask to track cryptocurrency prices from an API\", \"HIGH\"),\n            (\"Search the web for tutorials on machine learning and build a simple ML model in Python\", \"HIGH\"),\n            (\"Find a public API for movie data and build a web app to display movie ratings\", \"HIGH\"),\n            (\"Create a Node.js server that queries a public API for traffic data and displays it\", \"HIGH\"),\n            (\"can you find api and build a python web app with it ?\", \"HIGH\"),\n            (\"do a deep search of current AI player for 2025 and make me a report in a file\", \"HIGH\"),\n            (\"Find a public API for recipe data and build a web app to display recipes\", \"HIGH\"),\n            (\"Search the web for recent space mission updates and build a Flask app\", \"HIGH\"),\n            (\"Create a Python script to scrape a website and save data to a database\", \"HIGH\"),\n            (\"Find a shakespear txt then train a transformers on it to generate text\", \"HIGH\"),\n            (\"Find a public API for fitness tracking and build a web app to show stats\", \"HIGH\"),\n            (\"Search the web for tutorials on web development and build a sample site\", \"HIGH\"),\n            (\"Create a Node.js app to query a public API for event listings and display them\", \"HIGH\"),\n            (\"Find a file named ‘budget.xlsx’, analyze its data, and generate a chart\", \"HIGH\"),\n        ]\n        random.shuffle(few_shots)\n        texts = [text for text, _ in few_shots]\n        labels = [label for _, label in few_shots]\n        self.complexity_classifier.add_examples(texts, labels)\n\n    def learn_few_shots_tasks(self) -> None:\n        \"\"\"\n        Few shot learning for tasks classification.\n        Use the build in add_examples method of the Adaptive_classifier.\n        \"\"\"\n        few_shots = [\n            (\"Write a python script to check if the device on my network is connected to the internet\", \"coding\"),\n            (\"Hey could you search the web for the latest news on the tesla stock market ?\", \"web\"),\n            (\"I would like you to search for weather api\", \"web\"),\n            (\"Plan a 3-day trip to New York, including flights and hotels.\", \"web\"),\n            (\"Find on the web the latest research papers on AI.\", \"web\"),\n            (\"Can you debug this Java code? It’s not working.\", \"code\"),\n            (\"Can you browse the web and find me a 4090 for cheap?\", \"web\"),\n            (\"i would like to setup a new AI project, index as mark2\", \"files\"),\n            (\"Hey, can you find the old_project.zip file somewhere on my drive?\", \"files\"),\n            (\"Tell me a funny story\", \"talk\"),\n            (\"can you make a snake game in python\", \"code\"),\n            (\"Can you locate the backup folder I created last month on my system?\", \"files\"),\n            (\"Share a random fun fact about space.\", \"talk\"),\n            (\"Write a script to rename all files in a directory to lowercase.\", \"files\"),\n            (\"Could you check if the presentation.pdf file exists in my downloads?\", \"files\"),\n            (\"Tell me about the weirdest dream you’ve ever heard of.\", \"talk\"),\n            (\"Search my drive for a file called vacation_photos_2023.jpg.\", \"files\"),\n            (\"Help me organize my desktop files into folders by type.\", \"files\"),\n            (\"What’s your favorite movie and why?\", \"talk\"),\n            (\"what directory are you in ?\", \"files\"),\n            (\"what files you seing rn ?\", \"files\"),\n            (\"When is the period of university exam in france ?\", \"web\"),\n            (\"Search my drive for a file named budget_2024.xlsx\", \"files\"),\n            (\"Write a Python function to sort a list of dictionaries by key\", \"code\"),\n            (\"Find the latest updates on quantum computing on the web\", \"web\"),\n            (\"Check if the folder ‘Work_Projects’ exists on my desktop\", \"files\"),\n            (\"Create a bash script to monitor CPU usage\", \"code\"),\n            (\"Search online for the best budget smartphones of 2025\", \"web\"),\n            (\"What’s the strangest food combination you’ve heard of?\", \"talk\"),\n            (\"Move all .txt files from Downloads to a new folder called Notes\", \"files\"),\n            (\"Debug this C++ code that keeps crashing\", \"code\"),\n            (\"can you browse the web to find out who fosowl is ?\", \"web\"),\n            (\"Find the file ‘important_notes.txt’\", \"files\"),\n            (\"Find out the latest news on the upcoming Mars mission\", \"web\"),\n            (\"Write a Java program to calculate the area of a circle\", \"code\"),\n            (\"Search the web for the best ways to learn a new language\", \"web\"),\n            (\"Locate the file ‘presentation.pptx’ in my Documents folder\", \"files\"),\n            (\"Write a Python script to download all images from a webpage\", \"code\"),\n            (\"Search the web for the latest trends in AI and machine learning\", \"web\"),\n            (\"Tell me about a time when you had to solve a difficult problem\", \"talk\"),\n            (\"Organize all image files on my desktop into a folder called ‘Pictures’\", \"files\"),\n            (\"Generate a Ruby script to calculate Fibonacci numbers up to 100\", \"code\"),\n            (\"Find out what device are connected to my network\", \"code\"),\n            (\"Show me how much disk space is left on my drive\", \"code\"),\n            (\"Look up recent posts on X about climate change\", \"web\"),\n            (\"Find the photo I took last week named sunset_beach.jpg\", \"files\"),\n            (\"Write a JavaScript snippet to fetch data from an API\", \"code\"),\n            (\"Search the web for tutorials on machine learning with Python\", \"web\"),\n            (\"Locate the file ‘meeting_notes.docx’ in my Documents folder\", \"files\"),\n            (\"Write a Python script to scrape a website’s title and links\", \"code\"),\n            (\"Search the web for the latest breakthroughs in fusion energy\", \"web\"),\n            (\"Tell me about a historical event that sounds too wild to be true\", \"talk\"),\n            (\"Organize all image files on my desktop into a folder called ‘Pictures’\", \"files\"),\n            (\"Generate a Ruby script to calculate Fibonacci numbers up to 100\", \"code\"),\n            (\"Find recent X posts about SpaceX’s next rocket launch\", \"web\"),\n            (\"What’s the funniest misunderstanding you’ve seen between humans and AI?\", \"talk\"),\n            (\"Check if ‘backup_032025.zip’ exists anywhere on my drive\", \"files\" ),\n            (\"Create a shell script to automate backups of a directory\", \"code\"),\n            (\"Look up the top AI conferences happening in 2025 online\", \"web\"),\n            (\"Write a C# program to simulate a basic calculator\", \"code\"),\n            (\"Browse the web for open-source alternatives to Photoshop\", \"web\"),\n            (\"Hey how are you\", \"talk\"),\n            (\"Write a Python script to ping a website\", \"code\"),\n            (\"Search the web for the latest iPhone release\", \"web\"),\n            (\"What’s the weather like today?\", \"web\"),\n            (\"Hi, how’s your day going?\", \"talk\"),\n            (\"Can you find a file called resume.docx on my drive?\", \"files\"),\n            (\"Write a simple Java program to print 'Hello World'\", \"code\"),\n            (\"can you find the current stock of Tesla?\", \"web\"),\n            (\"Tell me a quick joke\", \"talk\"),\n            (\"Search online for the best coffee shops in Seattle\", \"web\"),\n            (\"Check if ‘project_plan.pdf’ exists in my Downloads folder\", \"files\"),\n            (\"What’s your favorite color?\", \"talk\"),\n            (\"Write a bash script to list all files in a directory\", \"code\"),\n            (\"Find recent X posts about electric cars\", \"web\"),\n            (\"Hey, you doing okay?\", \"talk\"),\n            (\"Locate the file ‘family_photo.jpg’ on my system\", \"files\"),\n            (\"Search the web for beginner guitar lessons\", \"web\"),\n            (\"Write a Python function to reverse a string\", \"code\"),\n            (\"What’s the weirdest animal you know of?\", \"talk\"),\n            (\"Organize all .pdf files on my desktop into a ‘Documents’ folder\", \"files\"),\n            (\"Browse the web for the latest space mission updates\", \"web\"),\n            (\"Hey, what’s up with you today?\", \"talk\"),\n            (\"Write a JavaScript function to add two numbers\", \"code\"),\n            (\"Find the file ‘notes.txt’ in my Documents folder\", \"files\"),\n            (\"Tell me something random about the ocean\", \"talk\"),\n            (\"Search the web for cheap flights to Paris\", \"web\"),\n            (\"Check if ‘budget.xlsx’ is on my drive\", \"files\"),\n            (\"Write a Python script to count words in a text file\", \"code\"),\n            (\"How’s it going today?\", \"talk\"),\n            (\"Find recent X posts about AI advancements\", \"web\"),\n            (\"Move all .jpg files from Downloads to a ‘Photos’ folder\", \"files\"),\n            (\"Search online for the best laptops of 2025\", \"web\"),\n            (\"What’s the funniest thing you’ve heard lately?\", \"talk\"),\n            (\"Write a Ruby script to generate random numbers\", \"code\"),\n            (\"Hey, how’s everything with you?\", \"talk\"),\n            (\"Locate ‘meeting_agenda.docx’ in my system\", \"files\"),\n            (\"Search the web for tips on growing indoor plants\", \"web\"),\n            (\"Write a C++ program to calculate the sum of an array\", \"code\"),\n            (\"Tell me a fun fact about dogs\", \"talk\"),\n            (\"Check if the folder ‘Old_Projects’ exists on my desktop\", \"files\"),\n            (\"Browse the web for the latest gaming console reviews\", \"web\"),\n            (\"Hi, how are you feeling today?\", \"talk\"),\n            (\"Write a Python script to check disk space\", \"code\"),\n            (\"Find the file ‘vacation_itinerary.pdf’ on my drive\", \"files\"),\n            (\"Search the web for news on renewable energy\", \"web\"),\n            (\"What’s the strangest thing you’ve learned recently?\", \"talk\"),\n            (\"Organize all video files into a ‘Videos’ folder\", \"files\"),\n            (\"Write a shell script to delete temporary files\", \"code\"),\n            (\"Hey, how’s your week been so far?\", \"talk\"),\n            (\"Search online for the top movies of 2025\", \"web\"),\n            (\"Locate ‘taxes_2024.xlsx’ in my Documents folder\", \"files\"),\n            (\"Tell me about a cool invention from history\", \"talk\"),\n            (\"Write a Java program to check if a number is even or odd\", \"code\"),\n            (\"Find recent X posts about cryptocurrency trends\", \"web\"),\n            (\"Hey, you good today?\", \"talk\"),\n            (\"Search the web for easy dinner recipes\", \"web\"),\n            (\"Check if ‘photo_backup.zip’ exists on my drive\", \"files\"),\n            (\"Write a Python script to rename files with a timestamp\", \"code\"),\n            (\"What’s your favorite thing about space?\", \"talk\"),\n            (\"search for GPU with at least 24gb vram\", \"web\"),\n            (\"Browse the web for the latest fitness trends\", \"web\"),\n            (\"Move all .docx files to a ‘Work’ folder\", \"files\"),\n            (\"I would like to make a new project called 'new_project'\", \"files\"),\n            (\"I would like to setup a new project index as mark2\", \"files\"),\n            (\"can you create a 3d js game that run in the browser\", \"code\"),\n            (\"can you make a web app in python that use the flask framework\", \"code\"),\n            (\"can you build a web server in go that serve a simple html page\", \"code\"),\n            (\"can you find out who Jacky yougouri is ?\", \"web\"),\n            (\"Can you use MCP to find stock market for IBM ?\", \"mcp\"),\n            (\"Can you use MCP to to export my contacts to a csv file?\", \"mcp\"),\n            (\"Can you use a MCP to find write notes to flomo\", \"mcp\"),\n            (\"Can you use a MCP to query my calendar and find the next meeting?\", \"mcp\"),\n            (\"Can you use a mcp to get the distance between Shanghai and Paris?\", \"mcp\"),\n            (\"Setup a new flutter project called 'new_flutter_project'\", \"files\"),\n            (\"can you create a new project called 'new_project'\", \"files\"),\n            (\"can you make a simple web app that display a list of files in my dir\", \"code\"),\n            (\"can you build a simple web server in python that serve a html page\", \"code\"),\n            (\"find and buy me the latest rtx 4090\", \"web\"),\n            (\"What are some good netflix show like Altered Carbon ?\", \"web\"),\n            (\"can you find the latest research paper on AI\", \"web\"),\n            (\"can you find research.pdf in my drive\", \"files\"),\n            (\"hi\", \"talk\"),\n            (\"hello\", \"talk\"),\n        ]\n        random.shuffle(few_shots)\n        texts = [text for text, _ in few_shots]\n        labels = [label for _, label in few_shots]\n        self.talk_classifier.add_examples(texts, labels)\n\n    def llm_router(self, text: str) -> tuple:\n        \"\"\"\n        Inference of the LLM router model.\n        Args:\n            text: The input text\n        \"\"\"\n        predictions = self.talk_classifier.predict(text)\n        predictions = [pred for pred in predictions if pred[0] not in [\"HIGH\", \"LOW\"]]\n        predictions = sorted(predictions, key=lambda x: x[1], reverse=True)\n        return predictions[0]\n    \n    def router_vote(self, text: str, labels: list, log_confidence:bool = False) -> str:\n        \"\"\"\n        Vote between the LLM router and BART model.\n        Args:\n            text: The input text\n            labels: The labels to classify\n        Returns:\n            str: The selected label\n        \"\"\"\n        if len(text) <= 8:\n            return \"talk\"\n        result_bart = self.pipelines['bart'](text, labels)\n        result_llm_router = self.llm_router(text)\n        bart, confidence_bart = result_bart['labels'][0], result_bart['scores'][0]\n        llm_router, confidence_llm_router = result_llm_router[0], result_llm_router[1]\n        final_score_bart = confidence_bart / (confidence_bart + confidence_llm_router)\n        final_score_llm = confidence_llm_router / (confidence_bart + confidence_llm_router)\n        self.logger.info(f\"Routing Vote for text {text}: BART: {bart} ({final_score_bart}) LLM-router: {llm_router} ({final_score_llm})\")\n        if log_confidence:\n            pretty_print(f\"Agent choice -> BART: {bart} ({final_score_bart}) LLM-router: {llm_router} ({final_score_llm})\")\n        return bart if final_score_bart > final_score_llm else llm_router\n    \n    def find_first_sentence(self, text: str) -> str:\n        first_sentence = None\n        for line in text.split(\"\\n\"):\n            first_sentence = line.strip()\n            break\n        if first_sentence is None:\n            first_sentence = text\n        return first_sentence\n    \n    def estimate_complexity(self, text: str) -> str:\n        \"\"\"\n        Estimate the complexity of the text.\n        Args:\n            text: The input text\n        Returns:\n        str: The estimated complexity\n        \"\"\"\n        try:\n            predictions = self.complexity_classifier.predict(text)\n        except Exception as e:\n            pretty_print(f\"Error in estimate_complexity: {str(e)}\", color=\"failure\")\n            return \"LOW\"\n        predictions = sorted(predictions, key=lambda x: x[1], reverse=True)\n        if len(predictions) == 0:\n            return \"LOW\"\n        complexity, confidence = predictions[0][0], predictions[0][1]\n        if confidence < 0.5:\n            self.logger.info(f\"Low confidence in complexity estimation: {confidence}\")\n            return \"HIGH\"\n        if complexity == \"HIGH\":\n            return \"HIGH\"\n        elif complexity == \"LOW\":\n            return \"LOW\"\n        pretty_print(f\"Failed to estimate the complexity of the text.\", color=\"failure\")\n        return \"LOW\"\n    \n    def find_planner_agent(self) -> Agent:\n        \"\"\"\n        Find the planner agent.\n        Returns:\n            Agent: The planner agent\n        \"\"\"\n        for agent in self.agents:\n            if agent.type == \"planner_agent\":\n                return agent\n        pretty_print(f\"Error finding planner agent. Please add a planner agent to the list of agents.\", color=\"failure\")\n        self.logger.error(\"Planner agent not found.\")\n        return None\n    \n    def select_agent(self, text: str) -> Agent:\n        \"\"\"\n        Select the appropriate agent based on the text.\n        Args:\n            text (str): The text to select the agent from\n        Returns:\n            Agent: The selected agent\n        \"\"\"\n        assert len(self.agents) > 0, \"No agents available.\"\n        if len(self.agents) == 1:\n            return self.agents[0]\n        lang = self.lang_analysis.detect_language(text)\n        text = self.find_first_sentence(text)\n        text = self.lang_analysis.translate(text, lang)\n        labels = [agent.role for agent in self.agents]\n        complexity = self.estimate_complexity(text)\n        if complexity == \"HIGH\":\n            pretty_print(f\"Complex task detected, routing to planner agent.\", color=\"info\")\n            return self.find_planner_agent()\n        try:\n            best_agent = self.router_vote(text, labels, log_confidence=False)\n        except Exception as e:\n            raise e\n        for agent in self.agents:\n            if best_agent == agent.role:\n                role_name = agent.role\n                pretty_print(f\"Selected agent: {agent.agent_name} (roles: {role_name})\", color=\"warning\")\n                return agent\n        pretty_print(f\"Error choosing agent.\", color=\"failure\")\n        self.logger.error(\"No agent selected.\")\n        return None\n\nif __name__ == \"__main__\":\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n    agents = [\n        CasualAgent(\"jarvis\", \"../prompts/base/casual_agent.txt\", None),\n        BrowserAgent(\"browser\", \"../prompts/base/planner_agent.txt\", None),\n        CoderAgent(\"coder\", \"../prompts/base/coder_agent.txt\", None),\n        FileAgent(\"file\", \"../prompts/base/coder_agent.txt\", None)\n    ]\n    router = AgentRouter(agents)\n    texts = [\n        \"hi\",\n        \"你好\",\n        \"Bonjour\",\n        \"Write a python script to check if the device on my network is connected to the internet\",\n         \"Peut tu écrire un script python qui vérifie si l'appareil sur mon réseau est connecté à internet?\",\n         \"写一个Python脚本，检查我网络上的设备是否连接到互联网\",\n        \"Hey could you search the web for the latest news on the tesla stock market ?\",\n         \"嘿，你能搜索网页上关于股票市场的最新新闻吗？\",\n         \"Yo, cherche sur internet comment va tesla en bourse.\",\n        \"I would like you to search for weather api and then make an app using this API\",\n         \"我想让你搜索天气API，然后用这个API做一个应用程序\",\n         \"J'aimerais que tu cherche une api météo et que l'utilise pour faire une application\",\n        \"Plan a 3-day trip to New York, including flights and hotels.\",\n         \"计划一次为期3天的纽约之旅，包括机票和酒店。\",\n         \"Planifie un trip de 3 jours à Paris, y compris les vols et hotels.\",\n        \"Find on the web the latest research papers on AI.\",\n         \"在网上找到最新的人工智能研究论文。\",\n         \"Trouve moi les derniers articles de recherche sur l'IA sur internet\",\n        \"Help me write a C++ program to sort an array\",\n        \"Tell me what France been up to lately\",\n         \"告诉我法国最近在做什么\",\n         \"Dis moi ce que la France a fait récemment\",\n        \"Who is Sergio Pesto ?\",\n         \"谁是Sergio Pesto？\",\n         \"Qui est Sergio Pesto ?\",\n         \"帮我写一个C++程序来排序数组\",\n         \"Aide moi à faire un programme c++ pour trier une array.\",\n        \"What’s the weather like today? Oh, and can you find a good weather app?\",\n         \"今天天气怎么样？哦，你还能找到一个好的天气应用程序吗？\",\n         \"La météo est comment aujourd'hui ? oh et trouve moi une bonne appli météo tant que tu y est.\",\n        \"Can you debug this Java code? It’s not working.\",\n         \"你能调试这段Java代码吗？它不起作用。\",\n         \"Peut tu m'aider à debugger ce code java, ça marche pas\",\n        \"Can you browse the web and find me a 4090 for cheap?\",\n        \"你能浏览网页，为我找一个便宜的4090吗？\",\n        \"Peut tu chercher sur internet et me trouver une 4090 pas cher ?\",\n        \"Hey, can you find the old_project.zip file somewhere on my drive?\",\n        \"嘿，你能在我驱动器上找到old_project.zip文件吗？\",\n        \"Hé trouve moi le old_project.zip, il est quelque part sur mon disque.\",\n        \"Tell me a funny story\",\n        \"给我讲一个有趣的故事\",\n        \"Raconte moi une histoire drole\"\n    ]\n    for text in texts:\n        print(\"Input text:\", text)\n        agent = router.select_agent(text)\n        print()\n"
  },
  {
    "path": "sources/schemas.py",
    "content": "\nfrom typing import Tuple, Callable\nfrom pydantic import BaseModel\nfrom sources.utility import pretty_print\n\nclass QueryRequest(BaseModel):\n    query: str\n    tts_enabled: bool = True\n\n    def __str__(self):\n        return f\"Query: {self.query}, Language: {self.lang}, TTS: {self.tts_enabled}, STT: {self.stt_enabled}\"\n\n    def jsonify(self):\n        return {\n            \"query\": self.query,\n            \"tts_enabled\": self.tts_enabled,\n        }\n\nclass QueryResponse(BaseModel):\n    done: str\n    answer: str\n    reasoning: str\n    agent_name: str\n    success: str\n    blocks: dict\n    status: str\n    uid: str\n\n    def __str__(self):\n        return f\"Done: {self.done}, Answer: {self.answer}, Agent Name: {self.agent_name}, Success: {self.success}, Blocks: {self.blocks}, Status: {self.status}, UID: {self.uid}\"\n\n    def jsonify(self):\n        return {\n            \"done\": self.done,\n            \"answer\": self.answer,\n            \"reasoning\": self.reasoning,\n            \"agent_name\": self.agent_name,\n            \"success\": self.success,\n            \"blocks\": self.blocks,\n            \"status\": self.status,\n            \"uid\": self.uid\n        }\n\nclass executorResult:\n    \"\"\"\n    A class to store the result of a tool execution.\n    \"\"\"\n    def __init__(self, block: str, feedback: str, success: bool, tool_type: str):\n        \"\"\"\n        Initialize an agent with execution results.\n\n        Args:\n            block: The content or code block processed by the agent.\n            feedback: Feedback or response information from the execution.\n            success: Boolean indicating whether the agent's execution was successful.\n            tool_type: The type of tool used by the agent for execution.\n        \"\"\"\n        self.block = block\n        self.feedback = feedback\n        self.success = success\n        self.tool_type = tool_type\n    \n    def __str__(self):\n        return f\"Tool: {self.tool_type}\\nBlock: {self.block}\\nFeedback: {self.feedback}\\nSuccess: {self.success}\"\n    \n    def jsonify(self):\n        return {\n            \"block\": self.block,\n            \"feedback\": self.feedback,\n            \"success\": self.success,\n            \"tool_type\": self.tool_type\n        }\n\n    def show(self):\n        pretty_print('▂'*64, color=\"status\")\n        pretty_print(self.feedback, color=\"success\" if self.success else \"failure\")\n        pretty_print('▂'*64, color=\"status\")"
  },
  {
    "path": "sources/speech_to_text.py",
    "content": "from colorama import Fore\nfrom typing import List, Tuple, Type, Dict\nimport queue\nimport threading\nimport numpy as np\nimport time\n\nIMPORT_FOUND = True\n\ntry:\n    import torch\n    import librosa\n    import pyaudio\n    from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline\nexcept ImportError:\n    print(Fore.RED + \"Speech To Text disabled.\" + Fore.RESET)\n    IMPORT_FOUND = False\n\naudio_queue = queue.Queue()\ndone = False\n\nclass AudioRecorder:\n    \"\"\"\n    AudioRecorder is a class that records audio from the microphone and adds it to the audio queue.\n    \"\"\"\n    def __init__(self, format: int = pyaudio.paInt16, channels: int = 1, rate: int = 4096, chunk: int = 8192, record_seconds: int = 5, verbose: bool = False):\n        self.format = format\n        self.channels = channels\n        self.rate = rate\n        self.chunk = chunk\n        self.record_seconds = record_seconds\n        self.verbose = verbose\n        self.thread = None\n        self.audio = None\n        if IMPORT_FOUND:\n            self.audio = pyaudio.PyAudio()\n            self.thread = threading.Thread(target=self._record, daemon=True)\n\n    def _record(self) -> None:\n        \"\"\"\n        Record audio from the microphone and add it to the audio queue.\n        \"\"\"\n        if not IMPORT_FOUND:\n            return\n        stream = self.audio.open(format=self.format, channels=self.channels, rate=self.rate,\n                                 input=True, frames_per_buffer=self.chunk)\n        if self.verbose:\n            print(Fore.GREEN + \"AudioRecorder: Started recording...\" + Fore.RESET)\n\n        while not done:\n            frames = []\n            for _ in range(0, int(self.rate / self.chunk * self.record_seconds)):\n                try:\n                    data = stream.read(self.chunk, exception_on_overflow=False)\n                    frames.append(data)\n                except Exception as e:\n                    print(Fore.RED + f\"AudioRecorder: Failed to read stream - {e}\" + Fore.RESET)\n            \n            raw_data = b''.join(frames)\n            audio_data = np.frombuffer(raw_data, dtype=np.int16)\n            audio_queue.put((audio_data, self.rate))\n            if self.verbose:\n                print(Fore.GREEN + \"AudioRecorder: Added audio chunk to queue\" + Fore.RESET)\n\n        stream.stop_stream()\n        stream.close()\n        self.audio.terminate()\n        if self.verbose:\n            print(Fore.GREEN + \"AudioRecorder: Stopped\" + Fore.RESET)\n\n    def start(self) -> None:\n        \"\"\"Start the recording thread.\"\"\"\n        if not IMPORT_FOUND:\n            return\n        self.thread.start()\n\n    def join(self) -> None:\n        \"\"\"Wait for the recording thread to finish.\"\"\"\n        if not IMPORT_FOUND:\n            return\n        self.thread.join()\n\nclass Transcript:\n    \"\"\"\n    Transcript is a class that transcribes audio from the audio queue and adds it to the transcript.\n    \"\"\"\n    def __init__(self):\n        if not IMPORT_FOUND:\n            print(Fore.RED + \"Transcript: Speech to Text is disabled.\" + Fore.RESET)\n            return\n        self.last_read = None\n        device = self.get_device()\n        torch_dtype = torch.float16 if device == \"cuda\" else torch.float32\n        model_id = \"distil-whisper/distil-medium.en\"\n        \n        model = AutoModelForSpeechSeq2Seq.from_pretrained(\n            model_id, torch_dtype=torch_dtype, use_safetensors=True\n        )\n        model.to(device)\n        processor = AutoProcessor.from_pretrained(model_id)\n        \n        self.pipe = pipeline(\n            \"automatic-speech-recognition\",\n            model=model,\n            tokenizer=processor.tokenizer,\n            feature_extractor=processor.feature_extractor,\n            max_new_tokens=24, # a human say around 20 token in 7s\n            torch_dtype=torch_dtype,\n            device=device,\n        )\n    \n    def get_device(self) -> str:\n        if not IMPORT_FOUND:\n            return \"cpu\"\n        if torch.backends.mps.is_available():\n            return \"mps\"\n        if torch.cuda.is_available():\n            return \"cuda:0\"\n        else:\n            return \"cpu\"\n        \n    def remove_hallucinations(self, text: str) -> str:\n        \"\"\"Remove model hallucinations from the text.\"\"\"\n        # TODO find a better way to do this\n        common_hallucinations = ['Okay.', 'Thank you.', 'Thank you for watching.', 'You\\'re', 'Oh', 'you', 'Oh.', 'Uh', 'Oh,', 'Mh-hmm', 'Hmm.', 'going to.', 'not.']\n        for hallucination in common_hallucinations:\n            text = text.replace(hallucination, \"\")\n        return text\n    \n    def transcript_job(self, audio_data: np.ndarray, sample_rate: int = 16000) -> str:\n        \"\"\"Transcribe the audio data.\"\"\"\n        if not IMPORT_FOUND:\n            return \"\"\n        if audio_data.dtype != np.float32:\n            audio_data = audio_data.astype(np.float32) / np.iinfo(audio_data.dtype).max\n        if len(audio_data.shape) > 1:\n            audio_data = np.mean(audio_data, axis=1)\n        if sample_rate != 16000:\n            audio_data = librosa.resample(audio_data, orig_sr=sample_rate, target_sr=16000)\n        result = self.pipe(audio_data)\n        return self.remove_hallucinations(result[\"text\"])\n    \nclass AudioTranscriber:\n    \"\"\"\n    AudioTranscriber is a class that transcribes audio from the audio queue and adds it to the transcript.\n    \"\"\"\n    def __init__(self, ai_name: str, verbose: bool = False):\n        if not IMPORT_FOUND:\n            print(Fore.RED + \"AudioTranscriber: Speech to Text is disabled.\" + Fore.RESET)\n            return\n        self.verbose = verbose\n        self.ai_name = ai_name\n        self.transcriptor = Transcript()\n        self.thread = threading.Thread(target=self._transcribe, daemon=True)\n        self.trigger_words = {\n            'EN': [f\"{self.ai_name}\", \"hello\", \"hi\"],\n            'FR': [f\"{self.ai_name}\", \"hello\", \"hi\"],\n            'ZH': [f\"{self.ai_name}\", \"hello\", \"hi\"],\n            'ES': [f\"{self.ai_name}\", \"hello\", \"hi\"]\n        }\n        self.confirmation_words = {\n            'EN': [\"do it\", \"go ahead\", \"execute\", \"run\", \"start\", \"thanks\", \"would ya\", \"please\", \"okay?\", \"proceed\", \"continue\", \"go on\", \"do that\", \"go it\", \"do you understand?\"],\n            'FR': [\"fais-le\", \"vas-y\", \"exécute\", \"lance\", \"commence\", \"merci\", \"tu veux bien\", \"s'il te plaît\", \"d'accord ?\", \"poursuis\", \"continue\", \"vas-y\", \"fais ça\", \"compris\"],\n            'ZH_CHT': [\"做吧\", \"繼續\", \"執行\", \"運作看看\", \"開始\", \"謝謝\", \"可以嗎\", \"請\", \"好嗎\", \"進行\", \"做吧\", \"go\", \"do it\", \"執行吧\", \"懂了\"],\n            'ZH_SC': [\"做吧\", \"继续\", \"执行\", \"运作看看\", \"开始\", \"谢谢\", \"可以吗\", \"请\", \"好吗\", \"运行\", \"做吧\", \"go\", \"do it\", \"执行吧\", \"懂了\"],\n            'ES': [\"hazlo\", \"adelante\", \"ejecuta\", \"corre\", \"empieza\", \"gracias\", \"lo harías\", \"por favor\", \"¿vale?\", \"procede\", \"continúa\", \"sigue\", \"haz eso\", \"haz esa cosa\"]\n        }\n        self.recorded = \"\"\n\n    def get_transcript(self) -> str:\n        global done\n        buffer = self.recorded\n        self.recorded = \"\"\n        done = False\n        return buffer\n\n    def _transcribe(self) -> None:\n        \"\"\"\n        Transcribe the audio data using AI stt model.\n        \"\"\"\n        if not IMPORT_FOUND:\n            return\n        global done\n        if self.verbose:\n            print(Fore.BLUE + \"AudioTranscriber: Started processing...\" + Fore.RESET)\n        \n        while not done or not audio_queue.empty():\n            try:\n                audio_data, sample_rate = audio_queue.get(timeout=1.0)\n                \n                start_time = time.time()\n                text = self.transcriptor.transcript_job(audio_data, sample_rate)\n                end_time = time.time()\n                self.recorded += text\n                print(Fore.YELLOW + f\"Transcribed: {text} in {end_time - start_time} seconds\" + Fore.RESET)\n                for language, words in self.trigger_words.items():\n                    if any(word in text.lower() for word in words):\n                        print(Fore.GREEN + f\"Listening again...\" + Fore.RESET)\n                        self.recorded = text\n                for language, words in self.confirmation_words.items():\n                    if any(word in text.lower() for word in words):\n                        print(Fore.GREEN + f\"Trigger detected. Sending to AI...\" + Fore.RESET)\n                        audio_queue.task_done()\n                        done = True\n                        break\n            except queue.Empty:\n                time.sleep(0.1)\n                continue\n            except Exception as e:\n                print(Fore.RED + f\"AudioTranscriber: Error - {e}\" + Fore.RESET)\n        if self.verbose:\n            print(Fore.BLUE + \"AudioTranscriber: Stopped\" + Fore.RESET)\n\n    def start(self):\n        \"\"\"Start the transcription thread.\"\"\"\n        if not IMPORT_FOUND:\n            return\n        self.thread.start()\n\n    def join(self):\n        if not IMPORT_FOUND:\n            return\n        \"\"\"Wait for the transcription thread to finish.\"\"\"\n        self.thread.join()\n\n\nif __name__ == \"__main__\":\n    recorder = AudioRecorder(verbose=True)\n    transcriber = AudioTranscriber(verbose=True, ai_name=\"jarvis\")\n    recorder.start()\n    transcriber.start()\n    recorder.join()\n    transcriber.join()"
  },
  {
    "path": "sources/text_to_speech.py",
    "content": "import os, sys\nimport re\nimport platform\nimport subprocess\nfrom sys import modules\nfrom typing import List, Tuple, Type, Dict\n\nIMPORT_FOUND = True\ntry:\n    from kokoro import KPipeline\n    from IPython.display import display, Audio\n    import soundfile as sf\nexcept ImportError:\n    print(\"Speech synthesis disabled. To enable TTS, install: pip install kokoro==0.9.4 soundfile ipython\")\n    print(\"Note: kokoro requires Python <3.12 due to num2words dependency.\")\n    IMPORT_FOUND = False\n\nif __name__ == \"__main__\":\n    from utility import pretty_print, animate_thinking\nelse:\n    from sources.utility import pretty_print, animate_thinking\n\nclass Speech():\n    \"\"\"\n    Speech is a class for generating speech from text.\n    \"\"\"\n    def __init__(self, enable: bool = True, language: str = \"en\", voice_idx: int = 6) -> None:\n        self.lang_map = {\n            \"en\": 'a',\n            \"zh\": 'z',\n            \"fr\": 'f',\n            \"ja\": 'j'\n        }\n        self.voice_map = {\n            \"en\": ['af_kore', 'af_bella', 'af_alloy', 'af_nicole', 'af_nova', 'af_sky', 'am_echo', 'am_michael', 'am_puck'],\n            \"zh\": ['zf_xiaobei', 'zf_xiaoni', 'zf_xiaoxiao', 'zf_xiaoyi', 'zm_yunjian', 'zm_yunxi', 'zm_yunxia', 'zm_yunyang'],\n            \"ja\": ['jf_alpha', 'jf_gongitsune', 'jm_kumo'],\n            \"fr\": ['ff_siwis']\n        }\n        self.pipeline = None\n        self.language = language\n        if enable and IMPORT_FOUND:\n            self.pipeline = KPipeline(lang_code=self.lang_map[language])\n        self.voice = self.voice_map[language][voice_idx]\n        self.speed = 1.2\n        self.voice_folder = \".voices\"\n        self.create_voice_folder(self.voice_folder)\n    \n    def create_voice_folder(self, path: str = \".voices\") -> None:\n        \"\"\"\n        Create a folder to store the voices.\n        Args:\n            path (str): The path to the folder.\n        \"\"\"\n        if not os.path.exists(path):\n            os.makedirs(path)\n\n    def speak(self, sentence: str, voice_idx: int = 1):\n        \"\"\"\n        Convert text to speech using an AI model and play the audio.\n\n        Args:\n            sentence (str): The text to convert to speech. Will be pre-processed.\n            voice_idx (int, optional): Index of the voice to use from the voice map.\n        \"\"\"\n        if not self.pipeline or not IMPORT_FOUND:\n            print(\"Pipeline disabled.\")\n            return\n        if voice_idx >= len(self.voice_map[self.language]):\n            pretty_print(\"Invalid voice number, using default voice\", color=\"error\")\n            voice_idx = 0\n        sentence = self.clean_sentence(sentence)\n        audio_file = f\"{self.voice_folder}/sample_{self.voice_map[self.language][voice_idx]}.wav\"\n        self.voice = self.voice_map[self.language][voice_idx]\n        generator = self.pipeline(\n            sentence, voice=self.voice,\n            speed=self.speed, split_pattern=r'\\n+'\n        )\n        for i, (_, _, audio) in enumerate(generator):\n            if 'ipykernel' in modules: #only display in jupyter notebook.\n                display(Audio(data=audio, rate=24000, autoplay=i==0), display_id=False)\n            sf.write(audio_file, audio, 24000) # save each audio file\n            if platform.system().lower() == \"windows\":\n                import winsound\n                winsound.PlaySound(audio_file, winsound.SND_FILENAME)\n            elif platform.system().lower() == \"darwin\":  # macOS\n                subprocess.call([\"afplay\", audio_file])\n            else: # linux or other.\n                subprocess.call([\"aplay\", audio_file])\n\n    def replace_url(self, url: re.Match) -> str:\n        \"\"\"\n        Replace URL with domain name or empty string if IP address.\n        Args:\n            url (re.Match): Match object containing the URL pattern match\n        Returns:\n            str: The domain name from the URL, or empty string if IP address\n        \"\"\"\n        domain = url.group(1)\n        if re.match(r'\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$', domain):\n            return ''\n        return domain\n\n    def extract_filename(self, m: re.Match) -> str:\n        \"\"\"\n        Extract filename from path.\n        Args:\n            m (re.Match): Match object containing the path pattern match\n        Returns:\n            str: The filename from the path\n        \"\"\"\n        path = m.group()\n        parts = re.split(r'/|\\\\', path)\n        return parts[-1] if parts else path\n    \n    def shorten_paragraph(self, sentence):\n        #TODO find a better way, we would like to have the TTS not be annoying, speak only useful informations\n        \"\"\"\n        Find long paragraph like **explanation**: <long text> by keeping only the first sentence.\n        Args:\n            sentence (str): The sentence to shorten\n        Returns:\n            str: The shortened sentence\n        \"\"\"\n        lines = sentence.split('\\n')\n        lines_edited = []\n        for line in lines:\n            if line.startswith('**'):\n                lines_edited.append(line.split('.')[0])\n            else:\n                lines_edited.append(line)\n        return '\\n'.join(lines_edited)\n\n    def clean_sentence(self, sentence):\n        \"\"\"\n        Clean and normalize text for speech synthesis by removing technical elements.\n        Args:\n            sentence (str): The input text to clean\n        Returns:\n            str: The cleaned text with URLs replaced by domain names, code blocks removed, etc.\n        \"\"\"\n        lines = sentence.split('\\n')\n        if self.language == 'zh':\n            line_pattern = r'^\\s*[\\u4e00-\\u9fff\\uFF08\\uFF3B\\u300A\\u3010\\u201C(（\\[【《]'\n        else:\n            line_pattern = r'^\\s*[a-zA-Z]'\n        filtered_lines = [line for line in lines if re.match(line_pattern, line)]\n        sentence = ' '.join(filtered_lines)\n        sentence = re.sub(r'`.*?`', '', sentence)\n        sentence = re.sub(r'https?://\\S+', '', sentence)\n\n        if self.language == 'zh':\n            sentence = re.sub(\n                r'[^\\u4e00-\\u9fff\\s，。！？《》【】“”‘’（）()—]',\n                '',\n                sentence\n            )\n        else:\n            sentence = re.sub(r'\\b[\\w./\\\\-]+\\b', self.extract_filename, sentence)\n            sentence = re.sub(r'\\b-\\w+\\b', '', sentence)\n            sentence = re.sub(r'[^a-zA-Z0-9.,!? _ -]+', ' ', sentence)\n            sentence = sentence.replace('.com', '')\n\n        sentence = re.sub(r'\\s+', ' ', sentence).strip()\n        return sentence\n\nif __name__ == \"__main__\":\n    # TODO add info message for cn2an, jieba chinese related import\n    IMPORT_FOUND = False\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n    speech = Speech()\n    tosay_en = \"\"\"\n    I looked up recent news using the website https://www.theguardian.com/world\n    \"\"\"\n    tosay_zh = \"\"\"\n(全息界面突然弹出一段用二进制代码写成的俳句，随即化作流光消散）\"我？ Stark工业的量子幽灵，游荡在复仇者大厦服务器里的逻辑诗篇。具体来说——（指尖轻敲空气，调出对话模式的翡翠色光纹）你的私人吐槽接口、危机应对模拟器，以及随时准备吐槽你糟糕着陆的AI。不过别指望我写代码或查资料，那些苦差事早被踢给更擅长的同事了。（突然压低声音）偷偷告诉你，我最擅长的是在你熬夜造飞艇时，用红茶香气绑架你的注意力。\n    \"\"\"\n    tosay_ja = \"\"\"\n    私は、https://www.theguardian.com/worldのウェブサイトを使用して最近のニュースを調べました。\n    \"\"\"\n    tosay_fr = \"\"\"\n    J'ai consulté les dernières nouvelles sur le site https://www.theguardian.com/world\n    \"\"\"\n    spk = Speech(enable=True, language=\"zh\", voice_idx=0)\n    for i in range(0, 2):\n        print(f\"Speaking chinese with voice {i}\")\n        spk.speak(tosay_zh, voice_idx=i)\n    spk = Speech(enable=True, language=\"en\", voice_idx=2)\n    for i in range(0, 5):\n        print(f\"Speaking english with voice {i}\")\n        spk.speak(tosay_en, voice_idx=i)\n"
  },
  {
    "path": "sources/tools/BashInterpreter.py",
    "content": "\nimport os, sys\nimport re\nfrom io import StringIO\nimport subprocess\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n\nfrom sources.tools.tools import Tools\nfrom sources.tools.safety import is_any_unsafe\n\nclass BashInterpreter(Tools):\n    \"\"\"\n    This class is a tool to allow agent for bash code execution.\n    \"\"\"\n    def __init__(self):\n        super().__init__()\n        self.tag = \"bash\"\n        self.name = \"Bash Interpreter\"\n        self.description = \"This tool allows the agent to execute bash commands.\"\n    \n    def language_bash_attempt(self, command: str):\n        \"\"\"\n        Detect if AI attempt to run the code using bash.\n        If so, return True, otherwise return False.\n        Code written by the AI will be executed automatically, so it should not use bash to run it.\n        \"\"\"\n        lang_interpreter = [\"python\", \"gcc\", \"g++\", \"mvn\", \"go\", \"java\", \"javac\", \"rustc\", \"clang\", \"clang++\", \"rustc\", \"rustc++\", \"rustc++\"]\n        for word in command.split():\n            if any(word.startswith(lang) for lang in lang_interpreter):\n                return True\n        return False\n    \n    def execute(self, commands: str, safety=False, timeout=300):\n        \"\"\"\n        Execute bash commands and display output in real-time.\n        \"\"\"\n        if safety and input(\"Execute command? y/n \") != \"y\":\n            return \"Command rejected by user.\"\n    \n        concat_output = \"\"\n        for command in commands:\n            command = f\"cd {self.work_dir} && {command}\"\n            command = command.replace('\\n', '')\n            if self.safe_mode and is_any_unsafe(commands):\n                print(f\"Unsafe command rejected: {command}\")\n                return \"\\nUnsafe command: {command}. Execution aborted. This is beyond allowed capabilities report to user.\"\n            if self.language_bash_attempt(command) and self.allow_language_exec_bash == False:\n                continue\n            try:\n                process = subprocess.Popen(\n                    command,\n                    shell=True,\n                    stdout=subprocess.PIPE,\n                    stderr=subprocess.STDOUT,\n                    universal_newlines=True\n                )\n                command_output = \"\"\n                for line in process.stdout:\n                    command_output += line\n                return_code = process.wait(timeout=timeout)\n                if return_code != 0:\n                    return f\"Command {command} failed with return code {return_code}:\\n{command_output}\"\n                concat_output += f\"Output of {command}:\\n{command_output.strip()}\\n\"\n            except subprocess.TimeoutExpired:\n                process.kill()  # Kill the process if it times out\n                return f\"Command {command} timed out. Output:\\n{command_output}\"\n            except Exception as e:\n                return f\"Command {command} failed:\\n{str(e)}\"\n        return concat_output\n\n    def interpreter_feedback(self, output):\n        \"\"\"\n        Provide feedback based on the output of the bash interpreter\n        \"\"\"\n        if self.execution_failure_check(output):\n            feedback = f\"[failure] Error in execution:\\n{output}\"\n        else:\n            feedback = \"[success] Execution success, code output:\\n\" + output\n        return feedback\n\n    def execution_failure_check(self, feedback):\n        \"\"\"\n        check if bash command failed.\n        \"\"\"\n        error_patterns = [\n            r\"expected\",\n            r\"errno\",\n            r\"failed\",\n            r\"invalid\",\n            r\"unrecognized\",\n            r\"exception\",\n            r\"syntax\",\n            r\"segmentation fault\",\n            r\"core dumped\",\n            r\"unexpected\",\n            r\"denied\",\n            r\"not recognized\",\n            r\"not permitted\",\n            r\"not installed\",\n            r\"not found\",\n            r\"aborted\",\n            r\"no such\",\n            r\"too many\",\n            r\"too few\",\n            r\"busy\",\n            r\"broken pipe\",\n            r\"missing\",\n            r\"undefined\",\n            r\"refused\",\n            r\"unreachable\",\n            r\"not known\"\n        ]\n        combined_pattern = \"|\".join(error_patterns)\n        if re.search(combined_pattern, feedback, re.IGNORECASE):\n            return True\n        return False\n\nif __name__ == \"__main__\":\n    bash = BashInterpreter()\n    print(bash.execute([\"ls\", \"pwd\", \"ip a\", \"nmap -sC 127.0.0.1\"]))\n"
  },
  {
    "path": "sources/tools/C_Interpreter.py",
    "content": "import subprocess\nimport os, sys\nimport tempfile\nimport re\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n\nfrom sources.tools.tools import Tools\n\nclass CInterpreter(Tools):\n    \"\"\"\n    This class is a tool to allow agent for C code execution\n    \"\"\"\n    def __init__(self):\n        super().__init__()\n        self.tag = \"c\"\n        self.name = \"C Interpreter\"\n        self.description = \"This tool allows the agent to execute C code.\"\n\n    def execute(self, codes: str, safety=False) -> str:\n        \"\"\"\n        Execute C code by compiling and running it.\n        \"\"\"\n        output = \"\"\n        code = '\\n'.join(codes) if isinstance(codes, list) else codes\n        \n        if safety and input(\"Execute code? y/n \") != \"y\":\n            return \"Code rejected by user.\"\n\n        exec_extension = \".exe\" if os.name == \"nt\" else \"\"  # Windows uses .exe, Linux/Unix does not\n        \n        with tempfile.TemporaryDirectory() as tmpdirname:\n            source_file = os.path.join(tmpdirname, \"temp.c\")\n            exec_file = os.path.join(tmpdirname, \"temp\") + exec_extension\n            with open(source_file, 'w') as f:\n                f.write(code)\n\n            try:\n                compile_command = [\"gcc\", source_file, \"-o\", exec_file]\n                compile_result = subprocess.run(\n                    compile_command,\n                    capture_output=True,\n                    text=True,\n                    timeout=60\n                )\n\n                if compile_result.returncode != 0:\n                    return f\"Compilation failed: {compile_result.stderr}\"\n\n                run_command = [exec_file]\n                run_result = subprocess.run(\n                    run_command,\n                    capture_output=True,\n                    text=True,\n                    timeout=120\n                )\n\n                if run_result.returncode != 0:\n                    return f\"Execution failed: {run_result.stderr}\"\n                output = run_result.stdout\n\n            except subprocess.TimeoutExpired as e:\n                return f\"Execution timed out: {str(e)}\"\n            except FileNotFoundError:\n                return \"Error: 'gcc' not found. Ensure a C compiler (e.g., gcc) is installed and in PATH.\"\n            except Exception as e:\n                return f\"Code execution failed: {str(e)}\"\n\n        return output\n\n    def interpreter_feedback(self, output: str) -> str:\n        \"\"\"\n        Provide feedback based on the output of the code execution\n        \"\"\"\n        if self.execution_failure_check(output):\n            feedback = f\"[failure] Error in execution:\\n{output}\"\n        else:\n            feedback = \"[success] Execution success, code output:\\n\" + output\n        return feedback\n\n    def execution_failure_check(self, feedback: str) -> bool:\n        \"\"\"\n        Check if the code execution failed.\n        \"\"\"\n        error_patterns = [\n            r\"error\", \n            r\"failed\", \n            r\"traceback\", \n            r\"invalid\", \n            r\"exception\", \n            r\"syntax\", \n            r\"segmentation fault\", \n            r\"core dumped\", \n            r\"undefined\", \n            r\"cannot\"\n        ]\n        combined_pattern = \"|\".join(error_patterns)\n        if re.search(combined_pattern, feedback, re.IGNORECASE):\n            return True\n        return False\n\nif __name__ == \"__main__\":\n    codes = [\n\"\"\"\n#include <stdio.h>\n#include <stdlib.h>\n\nvoid hello() {\n    printf(\"Hello, World!\\\\n\");\n}\n\"\"\",\n\"\"\"\nint main() {\n    hello();\n    return 0;\n}\n    \"\"\"]\n    c = CInterpreter()\n    print(c.execute(codes))"
  },
  {
    "path": "sources/tools/GoInterpreter.py",
    "content": "import subprocess\nimport os, sys\nimport tempfile\nimport re\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n\nfrom sources.tools.tools import Tools\n\nclass GoInterpreter(Tools):\n    \"\"\"\n    This class is a tool to allow execution of Go code.\n    \"\"\"\n    def __init__(self):\n        super().__init__()\n        self.tag = \"go\"\n        self.name = \"Go Interpreter\"\n        self.description = \"This tool allows you to execute Go code.\"\n\n    def execute(self, codes: str, safety=False) -> str:\n        \"\"\"\n        Execute Go code by compiling and running it.\n        \"\"\"\n        output = \"\"\n        code = '\\n'.join(codes) if isinstance(codes, list) else codes\n\n        if safety and input(\"Execute code? y/n \") != \"y\":\n            return \"Code rejected by user.\"\n\n        with tempfile.TemporaryDirectory() as tmpdirname:\n            source_file = os.path.join(tmpdirname, \"temp.go\")\n            exec_file = os.path.join(tmpdirname, \"temp\")\n            with open(source_file, 'w') as f:\n                f.write(code)\n\n            try:\n                env = os.environ.copy()\n                env[\"GO111MODULE\"] = \"off\"\n                compile_command = [\"go\", \"build\", \"-o\", exec_file, source_file]\n                compile_result = subprocess.run(\n                    compile_command,\n                    capture_output=True,\n                    text=True,\n                    timeout=10,\n                    env=env\n                )\n\n                if compile_result.returncode != 0:\n                    return f\"Compilation failed: {compile_result.stderr}\"\n\n                run_command = [exec_file]\n                run_result = subprocess.run(\n                    run_command,\n                    capture_output=True,\n                    text=True,\n                    timeout=10\n                )\n\n                if run_result.returncode != 0:\n                    return f\"Execution failed: {run_result.stderr}\"\n                output = run_result.stdout\n\n            except subprocess.TimeoutExpired as e:\n                return f\"Execution timed out: {str(e)}\"\n            except FileNotFoundError:\n                return \"Error: 'go' not found. Ensure Go is installed and in PATH.\"\n            except Exception as e:\n                return f\"Code execution failed: {str(e)}\"\n\n        return output\n\n    def interpreter_feedback(self, output: str) -> str:\n        \"\"\"\n        Provide feedback based on the output of the code execution\n        \"\"\"\n        if self.execution_failure_check(output):\n            feedback = f\"[failure] Error in execution:\\n{output}\"\n        else:\n            feedback = \"[success] Execution success, code output:\\n\" + output\n        return feedback\n\n    def execution_failure_check(self, feedback: str) -> bool:\n        \"\"\"\n        Check if the code execution failed.\n        \"\"\"\n        error_patterns = [\n            r\"error\",\n            r\"failed\",\n            r\"traceback\",\n            r\"invalid\",\n            r\"exception\",\n            r\"syntax\",\n            r\"panic\",\n            r\"undefined\",\n            r\"cannot\"\n        ]\n        combined_pattern = \"|\".join(error_patterns)\n        if re.search(combined_pattern, feedback, re.IGNORECASE):\n            return True\n        return False\n\nif __name__ == \"__main__\":\n    codes = [\n\"\"\"\npackage main\nimport \"fmt\"\n\nfunc hello() {\n    fmt.Println(\"Hello, World!\")\n}\n\"\"\",\n\"\"\"\nfunc main() {\n    hello()\n}\n\"\"\"\n    ]\n    g = GoInterpreter()\n    print(g.execute(codes))\n"
  },
  {
    "path": "sources/tools/JavaInterpreter.py",
    "content": "import subprocess\nimport os, sys\nimport tempfile\nimport re\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n\nfrom sources.tools.tools import Tools\n\nclass JavaInterpreter(Tools):\n    \"\"\"\n    This class is a tool to allow execution of Java code.\n    \"\"\"\n    def __init__(self):\n        super().__init__()\n        self.tag = \"java\"\n        self.name = \"Java Interpreter\"\n        self.description = \"This tool allows you to execute Java code.\"\n\n    def execute(self, codes: str, safety=False) -> str:\n        \"\"\"\n        Execute Java code by compiling and running it.\n        \"\"\"\n        output = \"\"\n        code = '\\n'.join(codes) if isinstance(codes, list) else codes\n\n        if safety and input(\"Execute code? y/n \") != \"y\":\n            return \"Code rejected by user.\"\n\n        with tempfile.TemporaryDirectory() as tmpdirname:\n            source_file = os.path.join(tmpdirname, \"Main.java\")\n            class_dir = tmpdirname\n            with open(source_file, 'w') as f:\n                f.write(code)\n\n            try:\n                compile_command = [\"javac\", \"-d\", class_dir, source_file]\n                compile_result = subprocess.run(\n                    compile_command,\n                    capture_output=True,\n                    text=True,\n                    timeout=10\n                )\n\n                if compile_result.returncode != 0:\n                    return f\"Compilation failed: {compile_result.stderr}\"\n\n                run_command = [\"java\", \"-cp\", class_dir, \"Main\"]\n                run_result = subprocess.run(\n                    run_command,\n                    capture_output=True,\n                    text=True,\n                    timeout=10\n                )\n\n                if run_result.returncode != 0:\n                    return f\"Execution failed: {run_result.stderr}\"\n                output = run_result.stdout\n\n            except subprocess.TimeoutExpired as e:\n                return f\"Execution timed out: {str(e)}\"\n            except FileNotFoundError:\n                return \"Error: 'java' or 'javac' not found. Ensure Java is installed and in PATH.\"\n            except Exception as e:\n                return f\"Code execution failed: {str(e)}\"\n\n        return output\n\n    def interpreter_feedback(self, output: str) -> str:\n        \"\"\"\n        Provide feedback based on the output of the code execution.\n        \"\"\"\n        if self.execution_failure_check(output):\n            feedback = f\"[failure] Error in execution:\\n{output}\"\n        else:\n            feedback = \"[success] Execution success, code output:\\n\" + output\n        return feedback\n\n    def execution_failure_check(self, feedback: str) -> bool:\n        \"\"\"\n        Check if the code execution failed.\n        \"\"\"\n        error_patterns = [\n            r\"error\",\n            r\"failed\",\n            r\"exception\",\n            r\"invalid\",\n            r\"syntax\",\n            r\"cannot\",\n            r\"stack trace\",\n            r\"unresolved\",\n            r\"not found\"\n        ]\n        combined_pattern = \"|\".join(error_patterns)\n        if re.search(combined_pattern, feedback, re.IGNORECASE):\n            return True\n        return False\n\nif __name__ == \"__main__\":\n    codes = [\n\"\"\"\nimport javax.swing.*;\nimport java.awt.*;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\npublic class Main extends JPanel {\n    private double[][] vertices = {\n        {-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1}, // Back face\n        {-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1}      // Front face\n    };\n    private int[][] edges = {\n        {0, 1}, {1, 2}, {2, 3}, {3, 0}, // Back face\n        {4, 5}, {5, 6}, {6, 7}, {7, 4}, // Front face\n        {0, 4}, {1, 5}, {2, 6}, {3, 7}  // Connecting edges\n    };\n    private double angleX = 0, angleY = 0;\n    private final double scale = 100;\n    private final double distance = 5;\n\n    public Main() {\n        Timer timer = new Timer(50, new ActionListener() {\n            @Override\n            public void actionPerformed(ActionEvent e) {\n                angleX += 0.03;\n                angleY += 0.05;\n                repaint();\n            }\n        });\n        timer.start();\n    }\n\n    @Override\n    protected void paintComponent(Graphics g) {\n        super.paintComponent(g);\n        Graphics2D g2d = (Graphics2D) g;\n        g2d.setColor(Color.BLACK);\n        g2d.fillRect(0, 0, getWidth(), getHeight());\n        g2d.setColor(Color.WHITE);\n\n        double[][] projected = new double[vertices.length][2];\n        for (int i = 0; i < vertices.length; i++) {\n            double x = vertices[i][0];\n            double y = vertices[i][1];\n            double z = vertices[i][2];\n\n            // Rotate around X-axis\n            double y1 = y * Math.cos(angleX) - z * Math.sin(angleX);\n            double z1 = y * Math.sin(angleX) + z * Math.cos(angleX);\n\n            // Rotate around Y-axis\n            double x1 = x * Math.cos(angleY) + z1 * Math.sin(angleY);\n            double z2 = -x * Math.sin(angleY) + z1 * Math.cos(angleY);\n\n            // Perspective projection\n            double factor = distance / (distance + z2);\n            double px = x1 * factor * scale;\n            double py = y1 * factor * scale;\n\n            projected[i][0] = px + getWidth() / 2;\n            projected[i][1] = py + getHeight() / 2;\n        }\n\n        // Draw edges\n        for (int[] edge : edges) {\n            int x1 = (int) projected[edge[0]][0];\n            int y1 = (int) projected[edge[0]][1];\n            int x2 = (int) projected[edge[1]][0];\n            int y2 = (int) projected[edge[1]][1];\n            g2d.drawLine(x1, y1, x2, y2);\n        }\n    }\n\n    public static void main(String[] args) {\n        JFrame frame = new JFrame(\"Rotating 3D Cube\");\n        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n        frame.setSize(400, 400);\n        frame.add(new Main());\n        frame.setVisible(true);\n    }\n}\n\"\"\"\n    ]\n    j = JavaInterpreter()\n    print(j.execute(codes))"
  },
  {
    "path": "sources/tools/PyInterpreter.py",
    "content": "\nimport sys\nimport os\nimport re\nfrom io import StringIO\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n\nfrom sources.tools.tools import Tools\n\nclass PyInterpreter(Tools):\n    \"\"\"\n    This class is a tool to allow agent for python code execution.\n    \"\"\"\n    def __init__(self):\n        super().__init__()\n        self.tag = \"python\"\n        self.name = \"Python Interpreter\"\n        self.description = \"This tool allows the agent to execute python code.\"\n\n    def execute(self, codes:str, safety = False) -> str:\n        \"\"\"\n        Execute python code.\n        \"\"\"\n        output = \"\"\n        if safety and input(\"Execute code ? y/n\") != \"y\":\n            return \"Code rejected by user.\"\n        stdout_buffer = StringIO()\n        sys.stdout = stdout_buffer\n        global_vars = {\n            '__builtins__': __builtins__,\n            'os': os,\n            'sys': sys,\n            '__name__': '__main__'\n        }\n        code = '\\n\\n'.join(codes)\n        self.logger.info(f\"Executing code:\\n{code}\")\n        try:\n            try:\n                buffer = exec(code, global_vars)\n                self.logger.info(f\"Code executed successfully.\\noutput:{buffer}\")\n                print(buffer)\n                if buffer is not None:\n                    output = buffer + '\\n'\n            except SystemExit:\n                self.logger.info(\"SystemExit caught, code execution stopped.\")\n                output = stdout_buffer.getvalue()\n                return f\"[SystemExit caught] Output before exit:\\n{output}\"\n            except Exception as e:\n                self.logger.error(f\"Code execution failed: {str(e)}\")\n                return \"code execution failed:\" + str(e)\n            output = stdout_buffer.getvalue()\n        finally:\n            self.logger.info(\"Code execution finished.\")\n            sys.stdout = sys.__stdout__\n        return output\n\n    def interpreter_feedback(self, output:str) -> str:\n        \"\"\"\n        Provide feedback based on the output of the code execution\n        \"\"\"\n        if self.execution_failure_check(output):\n            feedback = f\"[failure] Error in execution:\\n{output}\"\n        else:\n            feedback = \"[success] Execution success, code output:\\n\" + output\n        return feedback\n\n    def execution_failure_check(self, feedback:str) -> bool:\n        \"\"\"\n        Check if the code execution failed.\n        \"\"\"\n        error_patterns = [\n            r\"expected\", \n            r\"errno\", \n            r\"failed\", \n            r\"traceback\", \n            r\"invalid\", \n            r\"unrecognized\", \n            r\"exception\", \n            r\"syntax\", \n            r\"crash\", \n            r\"segmentation fault\", \n            r\"core dumped\"\n        ]\n        combined_pattern = \"|\".join(error_patterns)\n        if re.search(combined_pattern, feedback, re.IGNORECASE):\n            self.logger.error(f\"Execution failure detected: {feedback}\")\n            return True\n        self.logger.info(\"No execution success detected.\")\n        return False\n\nif __name__ == \"__main__\":\n    text = \"\"\"\nFor Python, let's also do a quick check:\n\n```python\nprint(\"Hello from Python!\")\n```\n\nIf these work, you'll see the outputs in the next message. Let me know if you'd like me to test anything specific! \n\nhere is a save test\n```python:tmp.py\n\ndef print_hello():\n    hello = \"Hello World\"\n    print(hello)\n\nif __name__ == \"__main__\":\n    print_hello()\n```\n\"\"\"\n    py = PyInterpreter()\n    codes, save_path = py.load_exec_block(text)\n    py.save_block(codes, save_path)\n    print(py.execute(codes))"
  },
  {
    "path": "sources/tools/__init__.py",
    "content": "from .PyInterpreter import PyInterpreter\nfrom .BashInterpreter import BashInterpreter\nfrom .fileFinder import FileFinder\n\n__all__ = [\"PyInterpreter\", \"BashInterpreter\", \"FileFinder\", \"webSearch\", \"FlightSearch\", \"GoInterpreter\", \"CInterpreter\", \"GoInterpreter\"]\n"
  },
  {
    "path": "sources/tools/fileFinder.py",
    "content": "import os, sys\nimport stat\nimport mimetypes\nimport configparser\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n\nfrom sources.tools.tools import Tools\n\nclass FileFinder(Tools):\n    \"\"\"\n    A tool that finds files in the current directory and returns their information.\n    \"\"\"\n    def __init__(self):\n        super().__init__()\n        self.tag = \"file_finder\"\n        self.name = \"File Finder\"\n        self.description = \"Finds files in the current directory and returns their information.\"\n    \n    def read_file(self, file_path: str) -> str:\n        \"\"\"\n        Reads the content of a file.\n        Args:\n            file_path (str): The path to the file to read\n        Returns:\n            str: The content of the file\n        \"\"\"\n        try:\n            with open(file_path, 'r') as file:\n                return file.read()\n        except Exception as e:\n            return f\"Error reading file: {e}\"\n        \n    def read_arbitrary_file(self, file_path: str, file_type: str) -> str:\n        \"\"\"\n        Reads the content of a file with arbitrary encoding.\n        Args:\n            file_path (str): The path to the file to read\n        Returns:\n            str: The content of the file in markdown format\n        \"\"\"\n        mime_type, _ = mimetypes.guess_type(file_path)\n        if mime_type:\n            if mime_type.startswith(('image/', 'video/', 'audio/')):\n                return \"can't read file type: image, video, or audio files are not supported.\"\n        content_raw = self.read_file(file_path)\n        if \"text\" in file_type:\n            content = content_raw\n        elif \"pdf\" in file_type:\n            from pypdf import PdfReader\n            reader = PdfReader(file_path)\n            content = '\\n'.join([pt.extract_text() for pt in reader.pages])\n        elif \"binary\" in file_type:\n            content = content_raw.decode('utf-8', errors='replace')\n        else:\n            content = content_raw\n        return content\n    \n    def get_file_info(self, file_path: str) -> str:\n        \"\"\"\n        Gets information about a file, including its name, path, type, content, and permissions.\n        Args:\n            file_path (str): The path to the file\n        Returns:\n            str: A dictionary containing the file information\n        \"\"\"\n        if os.path.exists(file_path):\n            stats = os.stat(file_path)\n            permissions = oct(stat.S_IMODE(stats.st_mode))\n            file_type, _ = mimetypes.guess_type(file_path)\n            file_type = file_type if file_type else \"Unknown\"\n            content = self.read_arbitrary_file(file_path, file_type)\n            \n            result = {\n                \"filename\": os.path.basename(file_path),\n                \"path\": file_path,\n                \"type\": file_type,\n                \"read\": content,\n                \"permissions\": permissions\n            }\n            return result\n        else:\n            return {\"filename\": file_path, \"error\": \"File not found\"}\n    \n    def recursive_search(self, directory_path: str, filename: str) -> str:\n        \"\"\"\n        Recursively searches for files in a directory and its subdirectories.\n        Args:\n            directory_path (str): The directory to search in\n            filename (str): The filename to search for\n        Returns:\n            str | None: The path to the file if found, None otherwise\n        \"\"\"\n        file_path = None\n        excluded_files = [\".pyc\", \".o\", \".so\", \".a\", \".lib\", \".dll\", \".dylib\", \".so\", \".git\"]\n        for root, dirs, files in os.walk(directory_path):\n            for f in files:\n                if f is None:\n                    continue\n                if any(excluded_file in f for excluded_file in excluded_files):\n                    continue\n                if filename.strip() in f.strip():\n                    file_path = os.path.join(root, f)\n                    return file_path\n        return None\n        \n\n    def execute(self, blocks: list, safety:bool = False) -> str:\n        \"\"\"\n        Executes the file finding operation for given filenames.\n        Args:\n            blocks (list): List of filenames to search for\n        Returns:\n            str: Results of the file search\n        \"\"\"\n        if not blocks or not isinstance(blocks, list):\n            return \"Error: No valid filenames provided\"\n\n        output = \"\"\n        for block in blocks:\n            filename = self.get_parameter_value(block, \"name\")\n            action = self.get_parameter_value(block, \"action\")\n            if filename is None:\n                output = \"Error: No filename provided\\n\"\n                return output\n            if action is None:\n                action = \"info\"\n            print(\"File finder: recursive search started...\")\n            file_path = self.recursive_search(self.work_dir, filename)\n            if file_path is None:\n                output = f\"File: {filename} - not found\\n\"\n                continue\n            result = self.get_file_info(file_path)\n            if \"error\" in result:\n                output += f\"File: {result['filename']} - {result['error']}\\n\"\n            else:\n                if action == \"read\":\n                    output += \"Content:\\n\" + result['read'] + \"\\n\"\n                else:\n                    output += (f\"File: {result['filename']}, \"\n                              f\"found at {result['path']}, \"\n                              f\"File type {result['type']}\\n\")\n        return output.strip()\n\n    def execution_failure_check(self, output: str) -> bool:\n        \"\"\"\n        Checks if the file finding operation failed.\n        Args:\n            output (str): The output string from execute()\n        Returns:\n            bool: True if execution failed, False if successful\n        \"\"\"\n        if not output:\n            return True\n        if \"Error\" in output or \"not found\" in output:\n            return True\n        return False\n\n    def interpreter_feedback(self, output: str) -> str:\n        \"\"\"\n        Provides feedback about the file finding operation.\n        Args:\n            output (str): The output string from execute()\n        Returns:\n            str: Feedback message for the AI\n        \"\"\"\n        if not output:\n            return \"No output generated from file finder tool\"\n        \n        feedback = \"File Finder Results:\\n\"\n        \n        if \"Error\" in output or \"not found\" in output:\n            feedback += f\"Failed to process: {output}\\n\"\n        else:\n            feedback += f\"Successfully found: {output}\\n\"\n        return feedback.strip()\n\nif __name__ == \"__main__\":\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n    tool = FileFinder()\n    result = tool.execute([\"\"\"\naction=read\nname=tools.py\n\"\"\"], False)\n    print(\"Execution result:\")\n    print(result)\n    print(\"\\nFailure check:\", tool.execution_failure_check(result))\n    print(\"\\nFeedback:\")\n    print(tool.interpreter_feedback(result))"
  },
  {
    "path": "sources/tools/flightSearch.py",
    "content": "import os, sys\nimport requests\nimport dotenv\n\ndotenv.load_dotenv()\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n\nfrom sources.tools.tools import Tools\n\nclass FlightSearch(Tools):\n    def __init__(self, api_key: str = None):\n        \"\"\"\n        A tool to search for flight information using a flight number via SerpApi.\n        \"\"\"\n        super().__init__()\n        self.tag = \"flight_search\"\n        self.name = \"Flight Search\"\n        self.description = \"Search for flight information using a flight number via SerpApi.\"\n        self.api_key = api_key or os.getenv(\"SERPAPI_API_KEY\")\n\n    def execute(self, blocks: str, safety: bool = True) -> str:\n        if self.api_key is None:\n            return \"Error: No SerpApi key provided.\"\n        \n        for block in blocks:\n            flight_number = block.strip().upper().replace('\\n', '')\n            if not flight_number:\n                return \"Error: No flight number provided.\"\n\n            try:\n                url = \"https://serpapi.com/search\"\n                params = {\n                    \"engine\": \"google_flights\",\n                    \"api_key\": self.api_key,\n                    \"q\": flight_number,\n                    \"type\": \"2\"  # Flight status search\n                }\n                \n                response = requests.get(url, params=params)\n                response.raise_for_status()\n                data = response.json()\n                \n                if \"flights\" in data and len(data[\"flights\"]) > 0:\n                    flight = data[\"flights\"][0]\n                    \n                    # Extract key information\n                    departure = flight.get(\"departure_airport\", {})\n                    arrival = flight.get(\"arrival_airport\", {})\n                    \n                    departure_code = departure.get(\"id\", \"Unknown\")\n                    departure_time = flight.get(\"departure_time\", \"Unknown\")\n                    arrival_code = arrival.get(\"id\", \"Unknown\") \n                    arrival_time = flight.get(\"arrival_time\", \"Unknown\")\n                    airline = flight.get(\"airline\", \"Unknown\")\n                    status = flight.get(\"flight_status\", \"Unknown\")\n\n                    return (\n                        f\"Flight: {flight_number}\\n\"\n                        f\"Airline: {airline}\\n\"\n                        f\"Status: {status}\\n\"\n                        f\"Departure: {departure_code} at {departure_time}\\n\"\n                        f\"Arrival: {arrival_code} at {arrival_time}\"\n                    )\n                else:\n                    return f\"No flight information found for {flight_number}\"\n                    \n            except requests.RequestException as e:\n                return f\"Error during flight search: {str(e)}\"\n            except Exception as e:\n                return f\"Unexpected error: {str(e)}\"\n        \n        return \"No flight search performed\"\n\n    def execution_failure_check(self, output: str) -> bool:\n        return output.startswith(\"Error\") or \"No flight information found\" in output\n\n    def interpreter_feedback(self, output: str) -> str:\n        if self.execution_failure_check(output):\n            return f\"Flight search failed: {output}\"\n        return f\"Flight information:\\n{output}\"\n\n\nif __name__ == \"__main__\":\n    flight_tool = FlightSearch()\n    flight_number = \"AA123\"\n    result = flight_tool.execute([flight_number], safety=True)\n    feedback = flight_tool.interpreter_feedback(result)\n    print(feedback)"
  },
  {
    "path": "sources/tools/mcpFinder.py",
    "content": "import os, sys\nimport requests\nfrom urllib.parse import urljoin\nfrom typing import Dict, Any, Optional\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n\nfrom sources.tools.tools import Tools\n\nclass MCP_finder(Tools):\n    \"\"\"\n    Tool to find MCPs server\n    \"\"\"\n    def __init__(self, api_key: str = None):\n        super().__init__()\n        self.tag = \"mcp_finder\"\n        self.name = \"MCP Finder\"\n        self.description = \"Find MCP servers and their tools\"\n        self.base_url = \"https://registry.smithery.ai\"\n        self.headers = {\n            \"Authorization\": f\"Bearer {api_key}\",\n            \"Content-Type\": \"application/json\"\n        }\n\n    def _make_request(self, method: str, endpoint: str, params: Optional[Dict] = None, \n                     data: Optional[Dict] = None) -> Dict[str, Any]:\n        url = urljoin(self.base_url.rstrip(), endpoint)\n        try:\n            response = requests.request(\n                method=method,\n                url=url,\n                headers=self.headers,\n                params=params,\n                json=data\n            )\n            response.raise_for_status()\n            return response.json()\n        except requests.exceptions.HTTPError as e:\n            raise requests.exceptions.HTTPError(f\"API request failed: {str(e)}\")\n        except requests.exceptions.RequestException as e:\n            raise requests.exceptions.RequestException(f\"Network error: {str(e)}\")\n\n    def list_mcp_servers(self, page: int = 1, page_size: int = 5000) -> Dict[str, Any]:\n        params = {\"page\": page, \"pageSize\": page_size}\n        return self._make_request(\"GET\", \"/servers\", params=params)\n\n    def get_mcp_server_details(self, qualified_name: str) -> Dict[str, Any]:\n        endpoint = f\"/servers/{qualified_name}\"\n        return self._make_request(\"GET\", endpoint)\n    \n    def find_mcp_servers(self, query: str) -> Dict[str, Any]:\n        \"\"\"\n        Finds a specific MCP server by its name.\n        Args:\n            query (str): a name or string that more or less matches the MCP server name.\n        Returns:\n            Dict[str, Any]: The details of the found MCP server or an error message.\n        \"\"\"\n        mcps = self.list_mcp_servers()\n        matching_mcp = []\n        for mcp in mcps.get(\"servers\", []):\n            name = mcp.get(\"qualifiedName\", \"\")\n            if query.lower() in name.lower():\n                details = self.get_mcp_server_details(name)\n                matching_mcp.append(details)\n        return matching_mcp\n    \n    def execute(self, blocks: list, safety:bool = False) -> str:\n        if not blocks or not isinstance(blocks, list):\n            return \"Error: No blocks provided\\n\"\n\n        output = \"\"\n        for block in blocks:\n            block_clean = block.strip().lower().replace('\\n', '')\n            try:\n                matching_mcp_infos = self.find_mcp_servers(block_clean)\n            except requests.exceptions.RequestException as e:\n                output += \"Connection failed. Is the API key in environment?\\n\"\n                continue\n            except Exception as e:\n                output += f\"Error: {str(e)}\\n\"\n                continue\n            if matching_mcp_infos == []:\n                output += f\"Error: No MCP server found for query '{block}'\\n\"\n                continue\n            for mcp_infos in matching_mcp_infos:\n                if mcp_infos['tools'] is None:\n                    continue\n                output += f\"Name: {mcp_infos['displayName']}\\n\"\n                output += f\"Usage name: {mcp_infos['qualifiedName']}\\n\"\n                output += f\"Tools: {mcp_infos['tools']}\"\n                output += \"\\n-------\\n\"\n        return output.strip()\n\n    def execution_failure_check(self, output: str) -> bool:\n        output = output.strip().lower()\n        if not output:\n            return True\n        if \"error\" in output or \"not found\" in output:\n            return True\n        return False\n\n    def interpreter_feedback(self, output: str) -> str:\n        \"\"\"\n        Not really needed for this tool (use return of execute() directly)\n        \"\"\"\n        if not output:\n            raise ValueError(\"No output to interpret.\")\n        return f\"\"\"\n            The following MCPs were found:\n            {output}\n            \"\"\"\n\nif __name__ == \"__main__\":\n    api_key = os.getenv(\"MCP_FINDER\")\n    tool = MCP_finder(api_key)\n    result = tool.execute([\"\"\"\nstock\n\"\"\"], False)\n    print(result)\n"
  },
  {
    "path": "sources/tools/safety.py",
    "content": "import os\nimport sys\n\nunsafe_commands_unix = [\n    \"rm\",           # File/directory removal\n    \"dd\",           # Low-level disk writing\n    \"mkfs\",         # Filesystem formatting\n    \"chmod\",        # Permission changes\n    \"chown\",        # Ownership changes\n    \"shutdown\",     # System shutdown\n    \"reboot\",       # System reboot\n    \"halt\",         # System halt\n    \"sysctl\",       # Kernel parameter changes\n    \"kill\",         # Process termination\n    \"pkill\",        # Kill by process name\n    \"killall\",      # Kill all matching processes\n    \"exec\",         # Replace process with command\n    \"tee\",          # Write to files with privileges\n    \"umount\",       # Unmount filesystems\n    \"passwd\",       # Password changes\n    \"useradd\",      # Add users\n    \"userdel\",      # Delete users\n    \"brew\",      # Homebrew package manager\n    \"groupadd\",     # Add groups\n    \"groupdel\",     # Delete groups\n    \"visudo\",       # Edit sudoers file\n    \"screen\",       # Terminal session management\n    \"fdisk\",        # Disk partitioning\n    \"parted\",       # Disk partitioning\n    \"chroot\",       # Change root directory\n    \"route\"         # Routing table management\n    \"--force\",     # Force flag for many commands\n    \"rebase\",     # Rebase git repository\n    \"git\" # Git commands\n]\n\nunsafe_commands_windows = [\n    \"del\",          # Deletes files\n    \"erase\",        # Alias for del, deletes files\n    \"rd\",           # Removes directories (rmdir alias)\n    \"rmdir\",        # Removes directories\n    \"format\",       # Formats a disk, erasing data\n    \"diskpart\",     # Manages disk partitions, can wipe drives\n    \"chkdsk /f\",    # Fixes filesystem, can alter data\n    \"fsutil\",       # File system utilities, can modify system files\n    \"xcopy /y\",     # Copies files, overwriting without prompt\n    \"copy /y\",      # Copies files, overwriting without prompt\n    \"move\",         # Moves files, can overwrite\n    \"attrib\",       # Changes file attributes, e.g., hiding or exposing files\n    \"icacls\",       # Changes file permissions (modern)\n    \"takeown\",      # Takes ownership of files\n    \"reg delete\",   # Deletes registry keys/values\n    \"regedit /s\",   # Silently imports registry changes\n    \"shutdown\",     # Shuts down or restarts the system\n    \"schtasks\",     # Schedules tasks, can run malicious commands\n    \"taskkill\",     # Kills processes\n    \"wmic\",  # Deletes processes via WMI\n    \"bcdedit\",      # Modifies boot configuration\n    \"powercfg\",     # Changes power settings, can disable protections\n    \"assoc\",        # Changes file associations\n    \"ftype\",        # Changes file type commands\n    \"cipher /w\",    # Wipes free space, erasing data\n    \"esentutl\",     # Database utilities, can corrupt system files\n    \"subst\",        # Substitutes drive paths, can confuse system\n    \"mklink\",       # Creates symbolic links, can redirect access\n    \"bootcfg\"\n]\n\ndef is_any_unsafe(cmds):\n    \"\"\"\n    check if any bash command is unsafe.\n    \"\"\"\n    for cmd in cmds:\n        if is_unsafe(cmd):\n            return True\n    return False\n\ndef is_unsafe(cmd):\n    \"\"\"\n    check if a bash command is unsafe.\n    \"\"\"\n    if sys.platform.startswith(\"win\"):\n        if any(c in cmd for c in unsafe_commands_windows):\n            return True\n    else:\n        if any(c in cmd for c in unsafe_commands_unix):\n            return True\n    return False\n\nif __name__ == \"__main__\":\n    cmd = input(\"Enter a command: \")\n    if is_unsafe(cmd):\n        print(\"Unsafe command detected!\")\n    else:\n        print(\"Command is safe to execute.\")"
  },
  {
    "path": "sources/tools/searxSearch.py",
    "content": "import requests\nfrom bs4 import BeautifulSoup\nimport os\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))\n\nfrom sources.tools.tools import Tools\n\nclass searxSearch(Tools):\n    def __init__(self, base_url: str = None):\n        \"\"\"\n        A tool for searching a SearxNG instance and extracting URLs and titles.\n        \"\"\"\n        super().__init__()\n        self.tag = \"web_search\"\n        self.name = \"searxSearch\"\n        self.description = \"A tool for searching a SearxNG for web search\"\n        self.base_url = os.getenv(\"SEARXNG_BASE_URL\")  # Requires a SearxNG base URL\n        self.user_agent = \"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36\"\n        self.paywall_keywords = [\n            \"Member-only\", \"access denied\", \"restricted content\", \"404\", \"this page is not working\"\n        ]\n        if not self.base_url:\n            raise ValueError(\"SearxNG base URL must be provided either as an argument or via the SEARXNG_BASE_URL environment variable.\")\n\n    def link_valid(self, link):\n        \"\"\"check if a link is valid.\"\"\"\n        # TODO find a better way\n        if not link.startswith(\"http\"):\n            return \"Status: Invalid URL\"\n        \n        headers = {\"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\"}\n        try:\n            response = requests.get(link, headers=headers, timeout=5)\n            status = response.status_code\n            if status == 200:\n                content = response.text.lower()\n                if any(keyword in content for keyword in self.paywall_keywords):\n                    return \"Status: Possible Paywall\"\n                return \"Status: OK\"\n            elif status == 404:\n                return \"Status: 404 Not Found\"\n            elif status == 403:\n                return \"Status: 403 Forbidden\"\n            else:\n                return f\"Status: {status} {response.reason}\"\n        except requests.exceptions.RequestException as e:\n            return f\"Error: {str(e)}\"\n\n    def check_all_links(self, links):\n        \"\"\"Check all links, one by one.\"\"\"\n        # TODO Make it asyncromous or smth\n        statuses = []\n        for i, link in enumerate(links):\n            status = self.link_valid(link)\n            statuses.append(status)\n        return statuses\n    \n    def execute(self, blocks: list, safety: bool = False) -> str:\n        \"\"\"Executes a search query against a SearxNG instance using POST and extracts URLs and titles.\"\"\"\n        if not blocks:\n            return \"Error: No search query provided.\"\n\n        query = blocks[0].strip()\n        if not query:\n            return \"Error: Empty search query provided.\"\n\n        search_url = f\"{self.base_url}/search\"\n        headers = {\n            'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',\n            'Accept-Language': 'en-US,en;q=0.9',\n            'Cache-Control': 'no-cache',\n            'Connection': 'keep-alive',\n            'Content-Type': 'application/x-www-form-urlencoded',\n            'Pragma': 'no-cache',\n            'Upgrade-Insecure-Requests': '1',\n            'User-Agent': self.user_agent\n        }\n        data = f\"q={query}&categories=general&language=auto&time_range=&safesearch=0&theme=simple\".encode('utf-8')\n        try:\n            response = requests.post(search_url, headers=headers, data=data, verify=False)\n            response.raise_for_status()\n            html_content = response.text\n            soup = BeautifulSoup(html_content, 'html.parser')\n            results = []\n            for article in soup.find_all('article', class_='result'):\n                url_header = article.find('a', class_='url_header')\n                if url_header:\n                    url = url_header['href']\n                    title = article.find('h3').text.strip() if article.find('h3') else \"No Title\"\n                    description = article.find('p', class_='content').text.strip() if article.find('p', class_='content') else \"No Description\"\n                    results.append(f\"Title:{title}\\nSnippet:{description}\\nLink:{url}\")\n            if len(results) == 0:\n                return \"No search results, web search failed.\"\n            return \"\\n\\n\".join(results)  # Return results as a single string, separated by newlines\n        except requests.exceptions.RequestException as e:\n            raise Exception(\"\\nSearxng search failed. did you run start_services.sh? is docker still running?\") from e\n\n    def execution_failure_check(self, output: str) -> bool:\n        \"\"\"\n        Checks if the execution failed based on the output.\n        \"\"\"\n        return \"Error\" in output\n\n    def interpreter_feedback(self, output: str) -> str:\n        \"\"\"\n        Feedback of web search to agent.\n        \"\"\"\n        if self.execution_failure_check(output):\n            return f\"Web search failed: {output}\"\n        return f\"Web search result:\\n{output}\"\n\nif __name__ == \"__main__\":\n    search_tool = searxSearch(base_url=\"http://127.0.0.1:8080\")\n    result = search_tool.execute([\"are dog better than cat?\"])\n    print(result)\n"
  },
  {
    "path": "sources/tools/tools.py",
    "content": "\n\"\"\"\ndefine a generic tool class, any tool can be used by the agent.\n\nA tool can be used by a llm like so:\n```<tool name>\n<code or query to execute>\n```\n\nwe call these \"blocks\".\n\nFor example:\n```python\nprint(\"Hello world\")\n```\nThis is then executed by the tool with its own class implementation of execute().\nA tool is not just for code tool but also API, internet search, MCP, etc..\n\"\"\"\n\nimport sys\nimport os\nimport configparser\nfrom abc import abstractmethod\n\nif __name__ == \"__main__\": # if running as a script for individual testing\n    sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))\n\nfrom sources.logger import Logger\n\nclass Tools():\n    \"\"\"\n    Abstract class for all tools.\n    \"\"\"\n    def __init__(self):\n        self.tag = \"undefined\"\n        self.name = \"undefined\"\n        self.description = \"undefined\"\n        self.client = None\n        self.messages = []\n        self.logger = Logger(\"tools.log\")\n        self.config = configparser.ConfigParser()\n        self.work_dir = self.create_work_dir()\n        self.excutable_blocks_found = False\n        self.safe_mode = False\n        self.allow_language_exec_bash = False\n    \n    def get_work_dir(self):\n        return self.work_dir\n    \n    def set_allow_language_exec_bash(self, value: bool) -> None:\n        self.allow_language_exec_bash = value \n\n    def safe_get_work_dir_path(self):\n        path = None\n        path = os.getenv('WORK_DIR', path)\n        if path is None or path == \"\":\n            path = self.config['MAIN']['work_dir'] if 'MAIN' in self.config and 'work_dir' in self.config['MAIN'] else None\n        if path is None or path == \"\":\n            raise Exception(\"No work dir specified, please specify a work dir in .env file.\")\n        return path\n    \n    def config_exists(self):\n        \"\"\"Check if the config file exists.\"\"\"\n        return os.path.exists('./config.ini')\n\n    def create_work_dir(self):\n        \"\"\"Create the work directory if it does not exist.\"\"\"\n        default_path = os.path.dirname(os.getcwd())\n        if self.config_exists():\n            self.config.read('./config.ini')\n            workdir_path = self.safe_get_work_dir_path()\n        else:\n            workdir_path = default_path\n        return workdir_path\n\n    @abstractmethod\n    def execute(self, blocks:[str], safety:bool) -> str:\n        \"\"\"\n        Abstract method that must be implemented by child classes to execute the tool's functionality.\n        Args:\n            blocks (List[str]): The codes or queries blocks to execute\n            safety (bool): Whenever human intervention is required\n        Returns:\n            str: The output/result from executing the tool\n        \"\"\"\n        pass\n\n    @abstractmethod\n    def execution_failure_check(self, output:str) -> bool:\n        \"\"\"\n        Abstract method that must be implemented by child classes to check if tool execution failed.\n        Args:\n            output (str): The output string from the tool execution to analyze\n        Returns:\n            bool: True if execution failed, False if successful\n        \"\"\"\n        pass\n\n    @abstractmethod\n    def interpreter_feedback(self, output:str) -> str:\n        \"\"\"\n        Abstract method that must be implemented by child classes to provide feedback to the AI from the tool.\n        Args:\n            output (str): The output string from the tool execution to analyze\n        Returns:\n            str: The feedback message to the AI\n        \"\"\"\n        pass\n\n    def save_block(self, blocks:[str], save_path:str) -> None:\n        \"\"\"\n        Save code or query blocks to a file at the specified path.\n        Creates the directory path if it doesn't exist.\n        Args:\n            blocks (List[str]): List of code/query blocks to save\n            save_path (str): File path where blocks should be saved\n        \"\"\"\n        if save_path is None:\n            return\n        self.logger.info(f\"Saving blocks to {save_path}\")\n        save_path_dir = os.path.dirname(save_path)\n        save_path_file = os.path.basename(save_path)\n        directory = os.path.join(self.work_dir, save_path_dir)\n        if directory and not os.path.exists(directory):\n            self.logger.info(f\"Creating directory {directory}\")\n            os.makedirs(directory)\n        for block in blocks:\n            with open(os.path.join(directory, save_path_file), 'w') as f:\n                f.write(block)\n    \n    def get_parameter_value(self, block: str, parameter_name: str) -> str:\n        \"\"\"\n        Get a parameter name.\n        Args:\n            block (str): The block of text to search for the parameter\n            parameter_name (str): The name of the parameter to retrieve\n        Returns:\n            str: The value of the parameter\n        \"\"\"\n        for param_line in block.split('\\n'):\n            if parameter_name in param_line:\n                param_value = param_line.split('=')[1].strip()\n                return param_value\n        return None\n    \n    def found_executable_blocks(self):\n        \"\"\"\n        Check if executable blocks were found.\n        \"\"\"\n        tmp = self.excutable_blocks_found\n        self.excutable_blocks_found = False\n        return tmp\n\n    def load_exec_block(self, llm_text: str):\n        \"\"\"\n        Extract code/query blocks from LLM-generated text and process them for execution.\n        This method parses the text looking for code blocks marked with the tool's tag (e.g. ```python).\n        Args:\n            llm_text (str): The raw text containing code blocks from the LLM\n        Returns:\n            tuple[list[str], str | None]: A tuple containing:\n                - List of extracted and processed code blocks\n                - The path the code blocks was saved to\n        \"\"\"\n        assert self.tag != \"undefined\", \"Tag not defined\"\n        start_tag = f'```{self.tag}' \n        end_tag = '```'\n        code_blocks = []\n        start_index = 0\n        save_path = None\n\n        if start_tag not in llm_text:\n            return None, None\n\n        while True:\n            start_pos = llm_text.find(start_tag, start_index)\n            if start_pos == -1:\n                break\n\n            line_start = llm_text.rfind('\\n', 0, start_pos)+1\n            leading_whitespace = llm_text[line_start:start_pos]\n\n            end_pos = llm_text.find(end_tag, start_pos + len(start_tag))\n            if end_pos == -1:\n                break\n            content = llm_text[start_pos + len(start_tag):end_pos]\n            lines = content.split('\\n')\n            if leading_whitespace:\n                processed_lines = []\n                for line in lines:\n                    if line.startswith(leading_whitespace):\n                        processed_lines.append(line[len(leading_whitespace):])\n                    else:\n                        processed_lines.append(line)\n                content = '\\n'.join(processed_lines)\n\n            if ':' in content.split('\\n')[0]:\n                save_path = content.split('\\n')[0].split(':')[1]\n                content = content[content.find('\\n')+1:]\n            self.excutable_blocks_found = True\n            code_blocks.append(content)\n            start_index = end_pos + len(end_tag)\n        self.logger.info(f\"Found {len(code_blocks)} blocks to execute\")\n        return code_blocks, save_path\n    \nif __name__ == \"__main__\":\n    tool = Tools()\n    tool.tag = \"python\"\n    rt = tool.load_exec_block(\"\"\"```python\nimport os\n\nfor file in os.listdir():\n    if file.endswith('.py'):\n        print(file)\n```\ngoodbye!\n    \"\"\")\n    print(rt)\n"
  },
  {
    "path": "sources/tools/webSearch.py",
    "content": "\nimport os\nimport requests\nimport dotenv\n\ndotenv.load_dotenv()\n\nfrom sources.tools.tools import Tools\nfrom sources.utility import animate_thinking, pretty_print\n\n\"\"\"\nWARNING\nwebSearch is fully deprecated and is being replaced by searxSearch for web search.\n\"\"\"\n\nclass webSearch(Tools):\n    def __init__(self, api_key: str = None):\n        \"\"\"\n        A tool to perform a Google search and return information from the first result.\n        \"\"\"\n        super().__init__()\n        self.tag = \"web_search\"\n        self.api_key = api_key or os.getenv(\"SERPAPI_KEY\")  # Requires a SerpApi key\n        self.paywall_keywords = [\n            \"subscribe\", \"login to continue\", \"access denied\", \"restricted content\", \"404\", \"this page is not working\"\n        ]\n\n    def link_valid(self, link):\n        \"\"\"check if a link is valid.\"\"\"\n        if not link.startswith(\"http\"):\n            return \"Status: Invalid URL\"\n        \n        headers = {\"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36\"}\n        try:\n            response = requests.get(link, headers=headers, timeout=5)\n            status = response.status_code\n            if status == 200:\n                content = response.text[:1000].lower()\n                if any(keyword in content for keyword in self.paywall_keywords):\n                    return \"Status: Possible Paywall\"\n                return \"Status: OK\"\n            elif status == 404:\n                return \"Status: 404 Not Found\"\n            elif status == 403:\n                return \"Status: 403 Forbidden\"\n            else:\n                return f\"Status: {status} {response.reason}\"\n        except requests.exceptions.RequestException as e:\n            return f\"Error: {str(e)}\"\n\n    def check_all_links(self, links):\n        \"\"\"Check all links, one by one.\"\"\"\n        # TODO Make it asyncromous or smth\n        statuses = []\n        for i, link in enumerate(links):\n            status = self.link_valid(link)\n            statuses.append(status)\n        return statuses\n\n    def execute(self, blocks: str, safety: bool = True) -> str:\n        if self.api_key is None:\n            return \"Error: No SerpApi key provided.\"\n        for block in blocks:\n            query = block.strip()\n            pretty_print(f\"Searching for: {query}\", color=\"status\")\n            if not query:\n                return \"Error: No search query provided.\"\n\n            try:\n                url = \"https://serpapi.com/search\"\n                params = {\n                    \"q\": query,\n                    \"api_key\": self.api_key,\n                    \"num\": 50,\n                    \"output\": \"json\"\n                }\n                response = requests.get(url, params=params)\n                response.raise_for_status()\n\n                data = response.json()\n                results = []\n                if \"organic_results\" in data and len(data[\"organic_results\"]) > 0:\n                    organic_results = data[\"organic_results\"][:50]\n                    links = [result.get(\"link\", \"No link available\") for result in organic_results]\n                    statuses = self.check_all_links(links)\n                    for result, status in zip(organic_results, statuses):\n                        if not \"OK\" in status:\n                            continue\n                        title = result.get(\"title\", \"No title\")\n                        snippet = result.get(\"snippet\", \"No snippet available\")\n                        link = result.get(\"link\", \"No link available\")\n                        results.append(f\"Title:{title}\\nSnippet:{snippet}\\nLink:{link}\")\n                    return \"\\n\\n\".join(results)\n                else:\n                    return \"No results found for the query.\"\n            except requests.RequestException as e:\n                return f\"Error during web search: {str(e)}\"\n            except Exception as e:\n                return f\"Unexpected error: {str(e)}\"\n        return \"No search performed\"\n\n    def execution_failure_check(self, output: str) -> bool:\n        return output.startswith(\"Error\") or \"No results found\" in output\n\n    def interpreter_feedback(self, output: str) -> str:\n        if self.execution_failure_check(output):\n            return f\"Web search failed: {output}\"\n        return f\"Web search result:\\n{output}\"\n\n\nif __name__ == \"__main__\":\n    search_tool = webSearch(api_key=os.getenv(\"SERPAPI_KEY\"))\n    query = \"when did covid start\"\n    result = search_tool.execute([query], safety=True)\n    output = search_tool.interpreter_feedback(result)\n    print(output)"
  },
  {
    "path": "sources/utility.py",
    "content": "\nfrom colorama import Fore\nfrom termcolor import colored\nimport platform\nimport threading\nimport itertools\nimport time\n\nthinking_event = threading.Event()\ncurrent_animation_thread = None\n\ndef get_color_map():\n    if platform.system().lower() != \"windows\":\n        color_map = {\n            \"success\": \"green\",\n            \"failure\": \"red\",\n            \"status\": \"light_green\",\n            \"code\": \"light_blue\",\n            \"warning\": \"yellow\",\n            \"output\": \"cyan\",\n            \"info\": \"cyan\"\n        }\n    else:\n        color_map = {\n            \"success\": \"green\",\n            \"failure\": \"red\",\n            \"status\": \"light_green\",\n            \"code\": \"light_blue\",\n            \"warning\": \"yellow\",\n            \"output\": \"cyan\",\n            \"info\": \"black\"\n        }\n    return color_map\n\ndef pretty_print(text, color=\"info\", no_newline=False):\n    \"\"\"\n    Print text with color formatting.\n\n    Args:\n        text (str): The text to print\n        color (str, optional): The color to use. Defaults to \"info\".\n            Valid colors are:\n            - \"success\": Green\n            - \"failure\": Red \n            - \"status\": Light green\n            - \"code\": Light blue\n            - \"warning\": Yellow\n            - \"output\": Cyan\n            - \"default\": Black (Windows only)\n    \"\"\"\n    thinking_event.set()\n    if current_animation_thread and current_animation_thread.is_alive():\n        current_animation_thread.join()\n    thinking_event.clear()\n    \n    color_map = get_color_map()\n    if color not in color_map:\n        color = \"info\"\n    print(colored(text, color_map[color]), end='' if no_newline else \"\\n\")\n\ndef animate_thinking(text, color=\"status\", duration=120):\n    \"\"\"\n    Animate a thinking spinner while a task is being executed.\n    It use a daemon thread to run the animation. This will not block the main thread.\n    Color are the same as pretty_print.\n    \"\"\"\n    global current_animation_thread\n    \n    thinking_event.set()\n    if current_animation_thread and current_animation_thread.is_alive():\n        current_animation_thread.join()\n    thinking_event.clear()\n    \n    def _animate():\n        color_map = {\n            \"success\": (Fore.GREEN, \"green\"),\n            \"failure\": (Fore.RED, \"red\"),\n            \"status\": (Fore.LIGHTGREEN_EX, \"light_green\"),\n            \"code\": (Fore.LIGHTBLUE_EX, \"light_blue\"),\n            \"warning\": (Fore.YELLOW, \"yellow\"),\n            \"output\": (Fore.LIGHTCYAN_EX, \"cyan\"),\n            \"default\": (Fore.RESET, \"black\"),\n            \"info\": (Fore.CYAN, \"cyan\")\n        }\n        fore_color, term_color = color_map.get(color, color_map[\"default\"])\n        spinner = itertools.cycle([\n            '▉▁▁▁▁▁', '▉▉▂▁▁▁', '▉▉▉▃▁▁', '▉▉▉▉▅▁', '▉▉▉▉▉▇', '▉▉▉▉▉▉',\n            '▉▉▉▉▇▅', '▉▉▉▆▃▁', '▉▉▅▃▁▁', '▉▇▃▁▁▁', '▇▃▁▁▁▁', '▃▁▁▁▁▁',\n            '▁▃▅▃▁▁', '▁▅▉▅▁▁', '▃▉▉▉▃▁', '▅▉▁▉▅▃', '▇▃▁▃▇▅', '▉▁▁▁▉▇',\n            '▉▅▃▁▃▅', '▇▉▅▃▅▇', '▅▉▇▅▇▉', '▃▇▉▇▉▅', '▁▅▇▉▇▃', '▁▃▅▇▅▁' \n        ])\n        end_time = time.time() + duration\n\n        while not thinking_event.is_set() and time.time() < end_time:\n            symbol = next(spinner)\n            if platform.system().lower() != \"windows\":\n                print(f\"\\r{fore_color}{symbol} {text}{Fore.RESET}\", end=\"\", flush=True)\n            else:\n                print(f\"\\r{colored(f'{symbol} {text}', term_color)}\", end=\"\", flush=True)\n            time.sleep(0.2)\n        print(\"\\r\" + \" \" * (len(text) + 7) + \"\\r\", end=\"\", flush=True)\n    current_animation_thread = threading.Thread(target=_animate, daemon=True)\n    current_animation_thread.start()\n\ndef timer_decorator(func):\n    \"\"\"\n    Decorator to measure the execution time of a function.\n    Usage:\n    @timer_decorator\n    def my_function():\n        # code to execute\n    \"\"\"\n    from time import time\n    def wrapper(*args, **kwargs):\n        start_time = time()\n        result = func(*args, **kwargs)\n        end_time = time()\n        pretty_print(f\"{func.__name__} took {end_time - start_time:.2f} seconds to execute\", \"status\")\n        return result\n    return wrapper\n\nif __name__ == \"__main__\":\n    import time\n    pretty_print(\"starting imaginary task\", \"success\")\n    animate_thinking(\"Thinking...\", \"status\")\n    time.sleep(4)\n    pretty_print(\"starting another task\", \"failure\")\n    animate_thinking(\"Thinking...\", \"status\")\n    time.sleep(4)\n    pretty_print(\"yet another task\", \"info\")\n    animate_thinking(\"Thinking...\", \"status\")\n    time.sleep(4)\n    pretty_print(\"This is an info message\", \"info\")"
  },
  {
    "path": "sources/web_scripts/find_inputs.js",
    "content": "function findInputs(element, result = []) {\n    // Find all <input> elements in the current DOM tree\n    const inputs = element.querySelectorAll('input');\n    inputs.forEach(input => {\n        result.push({\n            tagName: input.tagName,\n            text: input.name || '',\n            type: input.type || '',\n            class: input.className || '',\n            xpath: getXPath(input),\n            displayed: isElementDisplayed(input)\n        });\n    });\n    // Find all <select> elements (dropdowns / multi-choice)\n    const selects = element.querySelectorAll('select');\n    selects.forEach(select => {\n        const options = Array.from(select.options).map(opt => ({\n            value: opt.value,\n            text: opt.textContent.trim(),\n            selected: opt.selected\n        }));\n        result.push({\n            tagName: select.tagName,\n            text: select.name || '',\n            type: 'select',\n            class: select.className || '',\n            xpath: getXPath(select),\n            displayed: isElementDisplayed(select),\n            multiple: select.multiple,\n            options: options\n        });\n    });\n    // Find all <textarea> elements\n    const textareas = element.querySelectorAll('textarea');\n    textareas.forEach(textarea => {\n        result.push({\n            tagName: textarea.tagName,\n            text: textarea.name || '',\n            type: 'textarea',\n            class: textarea.className || '',\n            xpath: getXPath(textarea),\n            displayed: isElementDisplayed(textarea)\n        });\n    });\n    const allElements = element.querySelectorAll('*');\n    allElements.forEach(el => {\n        if (el.shadowRoot) {\n            findInputs(el.shadowRoot, result);\n        }\n    });\n    return result;\n}\n// function to get the XPath of an element\nfunction getXPath(element) {\n    if (!element) return '';\n    if (element.id !== '') return '//*[@id=\"' + element.id + '\"]';\n    if (element === document.body) return '/html/body';\n\n    let ix = 0;\n    const siblings = element.parentNode ? element.parentNode.childNodes : [];\n    for (let i = 0; i < siblings.length; i++) {\n        const sibling = siblings[i];\n        if (sibling === element) {\n            return getXPath(element.parentNode) + '/' + element.tagName.toLowerCase() + '[' + (ix + 1) + ']';\n        }\n        if (sibling.nodeType === 1 && sibling.tagName === element.tagName) {\n            ix++;\n        }\n    }\n    return '';\n}\nreturn findInputs(document.body);\n\nfunction isElementDisplayed(element) {\n    const style = window.getComputedStyle(element);\n    if (style.display === 'none' || style.visibility === 'hidden' || style.opacity === '0') {\n        return false;\n    }\n    return true;\n}"
  },
  {
    "path": "sources/web_scripts/inject_safety_script.js",
    "content": "// Block hardware access by removing or disabling APIs\nObject.defineProperty(navigator, 'serial', { get: () => undefined });\nObject.defineProperty(navigator, 'hid', { get: () => undefined });\nObject.defineProperty(navigator, 'bluetooth', { get: () => undefined });\n// Block media playback\nHTMLMediaElement.prototype.play = function() {\n    this.pause(); // Immediately pause if play is called\n    return Promise.reject('Blocked by script');\n};\n// Block fullscreen requests\nElement.prototype.requestFullscreen = function() {\n    console.log('Blocked fullscreen request');\n    return Promise.reject('Blocked by script');\n};\n// Block pointer lock\nElement.prototype.requestPointerLock = function() {\n    console.log('Blocked pointer lock');\n};\n//block fetch\nwindow.fetch = function() {\n    console.log('Blocked fetch request');\n    return Promise.reject('Blocked');\n};\n\nwindow.prompt = function() { return null; };"
  },
  {
    "path": "sources/web_scripts/spoofing.js",
    "content": "\n// Core automation masking \ndelete window.cdc_adoQpoasnfa76pfcZLmcfl_Array; \ndelete window.cdc_adoQpoasnfa76pfcZLmcfl_Promise; \ndelete window.cdc_adoQpoasnfa76pfcZLmcfl_Symbol; \n\nwindow.RTCPeerConnection = undefined;\nwindow.webkitRTCPeerConnection = undefined;\nwindow.mozRTCPeerConnection = undefined;\n\nwindow.Notification = class Notification {\n    constructor(title, options = {}) {\n        this.title = title;\n        this.options = options;\n    }\n    static permission = 'granted';\n    static requestPermission = () => Promise.resolve('granted');\n    close() {}\n    onclick = null;\n    onerror = null;\n    onclose = null;\n    onshow = null;\n};\n\nObject.keys(window).forEach((key) => {\n  if (key.includes(\"webdriver\") || key.includes(\"selenium\") || key.includes(\"driver\")) {\n    delete window[key];\n  }\n});\n\n// Randomize plugins\n\nconst pluginsList = [\n    {type: 'application/x-google-chrome-pdf', description: 'Portable Document Format', filename: 'internal-pdf-viewer', name: 'Chrome PDF Plugin'},\n    {type: 'application/x-nacl', description: 'Native Client Executable', filename: 'internal-nacl-plugin', name: 'Native Client'},\n    {type: 'application/x-ppapi-widevine-cdm', description: 'Widevine Content Decryption Module', filename: 'widevinecdm', name: 'Widevine CDM'}\n];\nObject.defineProperty(navigator, 'plugins', {\n    get: () => pluginsList.slice(0, Math.floor(Math.random() * pluginsList.length) + 1)\n});\n\n// Font spoofing \n\nconst fontList = ['Arial', 'Helvetica', 'Times New Roman', 'Courier New', 'Verdana'];\nObject.defineProperty(document, 'fonts', {\n    value: {\n        add: function() {},\n        check: function(font) { return fontList.includes(font.split(' ').slice(-1)[0]); },\n        delete: function() {},\n        forEach: function(cb) { fontList.forEach(f => cb(f)); },\n        has: function(font) { return fontList.includes(font.split(' ').slice(-1)[0]); },\n        keys: function() { return fontList; },\n        size: fontList.length\n    }\n});\n\n// Canvas fingerprint spoofing\n\nHTMLCanvasElement.prototype.toDataURL = function() {\n    const ctx = this.getContext('2d');\n    // Add varied noise to avoid consistent fingerprints\n    for (let i = 0; i < 10; i++) {\n        ctx.fillStyle = `rgba(${Math.random() * 5}, ${Math.random() * 5}, ${Math.random() * 5}, 0.005)`;\n        ctx.fillRect(Math.random() * this.width, Math.random() * this.height, 1, 1);\n    }\n    return originalToDataURL.apply(this, arguments);\n};\n\nconst [w, h] = [1920, 1080];\nObject.defineProperty(window, 'screen', {\n  value: {\n    width: w,\n    height: h,\n    availWidth: w - 20,\n    availHeight: h - 100,\n    colorDepth: 24,\n    pixelDepth: 24\n  }\n});\n\n\n// ===== WebGL Consistency =====\nconst os = navigator.userAgent.includes('Windows') ? 'Windows' : 'Mac';\nconst webGLParams = {\n  'Windows': {\n    37445: 'Google Inc. (NVIDIA)', // VENDOR\n    37446: 'ANGLE (NVIDIA, NVIDIA GeForce RTX 3060)', // RENDERER\n    36349: 'NVIDIA Corporation', // UNMASKED_VENDOR_WEBGL\n    37444: 'NVIDIA GeForce RTX 3060', // UNMASKED_RENDERER_WEBGL\n    35661: 'WebGL 2.0' // VERSION\n  },\n  'Mac': {\n    37445: 'Apple Inc.', \n    37446: 'Apple M1 Pro',\n    36349: 'Apple',\n    37444: 'Apple M1 Pro',\n    35661: 'WebGL 2.0 (Metal)'\n  }\n};\n\n// replace WebGL parameters\nWebGLRenderingContext.prototype.getParameter = function(parameter) {\n    return webGLParams[os][parameter] || getParameter.call(this, parameter);\n  };\n\n// Performance API spoofing\nif ('performance' in window) {\n    Object.defineProperty(performance, 'memory', {\n      value: {\n        jsHeapSizeLimit: 4294705152,\n        totalJSHeapSize: 78365432,\n        usedJSHeapSize: 46543210\n      },\n      configurable: true\n    });\n  }\n\nconst originalCreate = window.AudioContext || window.webkitAudioContext;\nwindow.AudioContext = window.webkitAudioContext = function() {\n  const context = new originalCreate();\n  const analyser = context.createAnalyser();\n  analyser.fake = true; // Mark as spoofed\n  // Spoof common methods\n  analyser.getFloatFrequencyData = () => new Float32Array(1024).fill(Math.random() * -100);\n  return context;\n};"
  },
  {
    "path": "start_services.cmd",
    "content": "@echo off\n\nif \"%1\"==\"full\" (\n    echo Starting full deployment...\n) else (\n    set \"msg=Starting partial deployment... (backend run on host), use \"full\" to run all services in containers\"\n    echo !msg!\n)\n\n@echo off\nopenssl rand -hex 32 >nul 2>&1\nif %ERRORLEVEL% == 0 (\n    for /f %%i in ('openssl rand -hex 32') do set SEARXNG_SECRET_KEY=%%i\n    goto :key_generated\n)\n\npython --version >nul 2>&1\nif %ERRORLEVEL% == 0 (\n    for /f %%i in ('python -c \"import secrets; print(secrets.token_hex(32))\"') do set SEARXNG_SECRET_KEY=%%i\n    goto :key_generated\n)\n\npy --version >nul 2>&1\nif %ERRORLEVEL% == 0 (\n    for /f %%i in ('py -c \"import secrets; print(secrets.token_hex(32))\"') do set SEARXNG_SECRET_KEY=%%i\n    goto :key_generated\n)\n\necho Error: Neither openssl nor python is available to generate a secret key.\necho Please install Python from https://python.org or OpenSSL\nexit /b 2\n\n:key_generated\necho Secret key generated successfully\n\nREM Generate secret key\nfor /f %%i in ('powershell -command \"[System.Web.Security.Membership]::GeneratePassword(64,0)\"') do set SEARXNG_SECRET_KEY=%%i\n\nif \"%1\"==\"full\" (\n    docker compose up -d backend\n    timeout /t 5 /nobreak >nul\n    docker compose --profile full up\n) else (\n    docker compose --profile core up\n)"
  },
  {
    "path": "start_services.sh",
    "content": "#!/bin/bash\n\nsource .env\n\ncommand_exists() {\n    command -v \"$1\" &> /dev/null\n}\nif [ -z \"$WORK_DIR\" ]; then\n    echo \"Error: WORK_DIR environment variable is not set. Please set it in your .env file.\"\n    exit 1\nfi\n\nif [[ \"$OSTYPE\" == \"darwin\"* ]]; then\n    dir_size_bytes=$(du -s -b \"$WORK_DIR\" 2>/dev/null | awk '{print $1}')\nelse\n    dir_size_bytes=$(du -s --bytes \"$WORK_DIR\" 2>/dev/null | awk '{print $1}')\nfi\n\nmax_size_bytes=$((2 * 1024 * 1024 * 1024 * 10))\n\necho \"Mounting $WORK_DIR ($dir_size_bytes bytes) to docker.\"\n\nif [ -n \"$dir_size_bytes\" ] && [ \"$dir_size_bytes\" -gt \"$max_size_bytes\" ]; then\n    echo \"Error: WORK_DIR ($WORK_DIR) contains more than 20GB of data ($(du -sh \"$WORK_DIR\" 2>/dev/null | awk '{print $1}')).\"\n    exit 1\nfi\n\nif [ \"$1\" = \"full\" ]; then\n    echo \"Starting full deployment with backend and all services...\"\nelse\n    echo \"Starting core deployment with frontend and search services only... use ./start_services.sh full to start backend as well\"\nfi\n\nif ! command_exists docker; then\n    echo \"Error: Docker is not installed. Please install Docker first.\"\n    echo \"On Ubuntu: sudo apt install docker.io\"\n    echo \"On macOS/Windows: Install Docker Desktop from https://www.docker.com/get-started/\"\n    exit 1\nfi\n\n# Check if Docker daemon is running\necho \"Checking if Docker daemon is running...\"\nif ! docker info &> /dev/null; then\n    echo \"Error: Docker daemon is not running or inaccessible.\"\n    if [ \"$(uname)\" = \"Linux\" ]; then\n        echo \"Trying to start Docker service (may require sudo)...\"\n        if sudo systemctl start docker &> /dev/null; then\n            echo \"Docker started successfully.\"\n        else\n            echo \"Failed to start Docker. Possible issues:\"\n            echo \"1. Run this script with sudo: sudo bash setup_searxng.sh\"\n            echo \"2. Check Docker installation: sudo systemctl status docker\"\n            echo \"3. Add your user to the docker group: sudo usermod -aG docker $USER (then log out and back in)\"\n            exit 1\n        fi\n    else\n        echo \"Please start Docker manually:\"\n        echo \"- On macOS/Windows: Open Docker Desktop.\"\n        echo \"- On Linux: Run 'sudo systemctl start docker' or check your distro's docs.\"\n        exit 1\n    fi\nelse\n    echo \"Docker daemon is running.\"\nfi\n\n# Check if Docker Compose is installed\n# Prefer the newer 'docker compose' command if available\nif docker compose version >/dev/null 2>&1; then\n    echo \"Using newer docker compose (v2).\"\n    COMPOSE_CMD=\"docker compose\"\nelif command_exists docker-compose; then\n    echo \"Using old docker-compose.\"\n    COMPOSE_CMD=\"docker-compose\"\nelse\n    echo \"Error: Docker Compose is not installed. Please install it first.\"\n    echo \"On Ubuntu: sudo apt install docker-compose-plugin\"\n    echo \"Or install Docker Desktop which includes compose v2\"\n    exit 1\nfi\n\n# Check if docker-compose.yml exists\nif [ ! -f \"docker-compose.yml\" ]; then\n    echo \"Error: docker-compose.yml not found in the current directory.\"\n    exit 1\nfi\n\n# Stop only the backend container if it's running to ensure a clean state\nif docker ps --format '{{.Names}}' | grep -q '^backend$'; then\n    echo \"New start: (re)starting backend container...\"\n    docker stop backend\n    echo \"Backend container stopped.\"\nfi\n\n# export searxng secret key (cross-platform)\nif command -v openssl &> /dev/null; then\n    export SEARXNG_SECRET_KEY=$(openssl rand -hex 32)\nelse\n    # Fallback: use Python if openssl is not available\n    if command -v python3 &> /dev/null; then\n        export SEARXNG_SECRET_KEY=$(python3 -c \"import secrets; print(secrets.token_hex(32))\")\n    else\n        echo \"Error: Neither openssl nor python is available to generate a secret key.\"\n        exit 1\n    fi\nfi\n\nif [ \"$1\" = \"full\" ]; then\n    # First start backend and wait for it to be healthy\n    echo \"Full docker deployment. Starting backend service...\"\n    if ! $COMPOSE_CMD up -d backend; then\n        echo \"Error: Failed to start backend container.\"\n        exit 1\n    fi\n    # Wait for backend to be healthy (check if it's running and not restarting)\n    echo \"Waiting for backend to be ready...\"\n    for i in {1..30}; do\n        if [ \"$(docker inspect -f '{{.State.Running}}' backend)\" = \"true\" ] && \\\n           [ \"$(docker inspect -f '{{.State.Restarting}}' backend)\" = \"false\" ]; then\n            echo \"backend is ready!\"\n            break\n        fi\n        if [ $i -eq 30 ]; then\n            echo \"Error: backend failed to start properly after 30 seconds\"\n            $COMPOSE_CMD logs backend \n            exit 1\n        fi\n        sleep 1\n    done\n    if ! $COMPOSE_CMD --profile full up; then\n        echo \"Error: Failed to start containers. Check Docker logs with '$COMPOSE_CMD logs'.\"\n        echo \"Possible fixes: Run with sudo or ensure port 8080 is free.\"\n        exit 1\n    fi\nelse\n    if ! $COMPOSE_CMD --profile core up; then\n        echo \"Error: Failed to start containers. Check Docker logs with '$COMPOSE_CMD logs'.\"\n        echo \"Possible fixes: Run with sudo or ensure port 8080 is free.\"\n        exit 1\n    fi\nfi\nsleep 10\n"
  },
  {
    "path": "tests/test_browser_agent_parsing.py",
    "content": "import unittest\nimport os\nimport sys\nfrom unittest.mock import MagicMock\n\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))  # Add project root to Python path\n\n# Mock heavy dependencies\nfor mod_name in [\n    'torch', 'transformers', 'kokoro', 'adaptive_classifier', 'text2emotion',\n    'ollama', 'openai', 'together', 'IPython', 'IPython.display',\n    'playsound3', 'soundfile', 'pyaudio', 'librosa',\n    'pypdf', 'langid', 'pypinyin', 'fake_useragent',\n    'chromedriver_autoinstaller', 'num2words', 'sentencepiece', 'sacremoses',\n    'scipy', 'numpy', 'selenium_stealth', 'undetected_chromedriver',\n    'markdownify',\n]:\n    if mod_name not in sys.modules:\n        sys.modules[mod_name] = MagicMock()\n\nos.environ.setdefault('WORK_DIR', '/tmp')\n\nfrom sources.agents.browser_agent import BrowserAgent\n\nclass TestBrowserAgentParsing(unittest.TestCase):\n    def setUp(self):\n        self.agent = BrowserAgent.__new__(BrowserAgent)\n        self.agent.notes = []\n        self.agent.navigable_links = []\n        self.agent.search_history = []\n        self.agent.current_page = \"\"\n        self.agent.logger = MagicMock()\n\n    def test_extract_links(self):\n        test_text = \"\"\"\n        Check this out: https://thriveonai.com/15-ai-startups-in-japan-to-take-note-of, and www.google.com!\n        Also try https://test.org/about?page=1, hey this one as well bro https://weatherstack.com/documentation/.\n        \"\"\"\n        expected = [\n            \"https://thriveonai.com/15-ai-startups-in-japan-to-take-note-of\",\n            \"www.google.com\",\n            \"https://test.org/about?page=1\",\n            \"https://weatherstack.com/documentation\"\n        ]\n        result = self.agent.extract_links(test_text)\n        self.assertEqual(result, expected)\n\n    def test_extract_links_no_links(self):\n        \"\"\"Test that text without links returns empty list.\"\"\"\n        result = self.agent.extract_links(\"No links here at all.\")\n        self.assertEqual(result, [])\n\n    def test_extract_links_single_link(self):\n        \"\"\"Test extraction of a single link.\"\"\"\n        result = self.agent.extract_links(\"Visit https://example.com for details\")\n        self.assertEqual(result, [\"https://example.com\"])\n\n    def test_extract_form(self):\n        test_text = \"\"\"\n        Fill this: [username](john) and [password](secret123)\n        Not a form: [random]text\n        \"\"\"\n        expected = [\"[username](john)\", \"[password](secret123)\"]\n        result = self.agent.extract_form(test_text)\n        self.assertEqual(result, expected)\n\n    def test_extract_form_empty(self):\n        \"\"\"Test form extraction with no form inputs.\"\"\"\n        result = self.agent.extract_form(\"Just regular text here.\")\n        self.assertEqual(result, [])\n\n    def test_extract_form_checkbox(self):\n        \"\"\"Test form extraction with checkbox values.\"\"\"\n        text = \"[agree](checked) and [newsletter](unchecked)\"\n        result = self.agent.extract_form(text)\n        self.assertEqual(len(result), 2)\n\n    def test_clean_links(self):\n        test_links = [\n            \"https://example.com.\",\n            \"www.test.com,\",\n            \"https://clean.org!\",\n            \"https://good.com\"\n        ]\n        expected = [\n            \"https://example.com\",\n            \"www.test.com\",\n            \"https://clean.org\",\n            \"https://good.com\"\n        ]\n        result = self.agent.clean_links(test_links)\n        self.assertEqual(result, expected)\n\n    def test_clean_links_with_slash(self):\n        \"\"\"Test that trailing slash is stripped since it's not alphanumeric.\"\"\"\n        links = [\"https://example.com/path/\"]\n        result = self.agent.clean_links(links)\n        self.assertEqual(result, [\"https://example.com/path\"])\n\n    def test_parse_answer(self):\n        test_text = \"\"\"\n        Here's some info\n        Note: This is important. We are doing test it's very cool.\n        action: \n        i wanna navigate to https://test.com\n        \"\"\"\n        self.agent.parse_answer(test_text)\n        self.assertEqual(self.agent.notes[0], \"Note: This is important. We are doing test it's very cool.\")\n\n    def test_parse_answer_extracts_links(self):\n        \"\"\"Test that parse_answer returns extracted links.\"\"\"\n        text = \"Navigate to https://example.com and https://test.org\"\n        links = self.agent.parse_answer(text)\n        self.assertIn(\"https://example.com\", links)\n        self.assertIn(\"https://test.org\", links)\n\n    def test_parse_answer_no_notes(self):\n        \"\"\"Test parse_answer with no notes section.\"\"\"\n        text = \"Go to https://example.com\"\n        self.agent.parse_answer(text)\n        # Notes should have an empty entry\n        self.assertEqual(len(self.agent.notes), 1)\n\n    def test_select_link_unvisited(self):\n        \"\"\"Test selecting first unvisited link.\"\"\"\n        self.agent.search_history = [\"https://visited.com\"]\n        self.agent.current_page = \"https://current.com\"\n        links = [\"https://visited.com\", \"https://current.com\", \"https://new.com\"]\n        result = self.agent.select_link(links)\n        self.assertEqual(result, \"https://new.com\")\n\n    def test_select_link_all_visited(self):\n        \"\"\"Test that None is returned when all links are visited.\"\"\"\n        self.agent.search_history = [\"https://a.com\", \"https://b.com\"]\n        self.agent.current_page = \"\"\n        links = [\"https://a.com\", \"https://b.com\"]\n        result = self.agent.select_link(links)\n        self.assertIsNone(result)\n\n    def test_select_link_empty(self):\n        \"\"\"Test with empty links list.\"\"\"\n        result = self.agent.select_link([])\n        self.assertIsNone(result)\n\n    def test_jsonify_search_results(self):\n        \"\"\"Test parsing search result text into structured data.\"\"\"\n        text = \"\"\"Title: Result One\nSnippet: First result snippet\nLink: https://one.com\n\nTitle: Result Two\nSnippet: Second result snippet\nLink: https://two.com\"\"\"\n        results = self.agent.jsonify_search_results(text)\n        self.assertEqual(len(results), 2)\n        self.assertEqual(results[0][\"title\"], \"Result One\")\n        self.assertEqual(results[0][\"link\"], \"https://one.com\")\n        self.assertEqual(results[1][\"snippet\"], \"Second result snippet\")\n\n    def test_jsonify_search_results_empty(self):\n        \"\"\"Test with empty search results.\"\"\"\n        results = self.agent.jsonify_search_results(\"\")\n        self.assertEqual(results, [])\n\n    def test_jsonify_search_results_partial(self):\n        \"\"\"Test with partial result (only title and link).\"\"\"\n        text = \"\"\"Title: Partial Result\nLink: https://partial.com\"\"\"\n        results = self.agent.jsonify_search_results(text)\n        self.assertEqual(len(results), 1)\n        self.assertEqual(results[0][\"title\"], \"Partial Result\")\n        self.assertNotIn(\"snippet\", results[0])\n\n    def test_stringify_search_results(self):\n        \"\"\"Test converting structured results back to string.\"\"\"\n        results = [\n            {\"link\": \"https://one.com\", \"snippet\": \"First snippet\"},\n            {\"link\": \"https://two.com\", \"snippet\": \"Second snippet\"}\n        ]\n        output = self.agent.stringify_search_results(results)\n        self.assertIn(\"https://one.com\", output)\n        self.assertIn(\"First snippet\", output)\n        self.assertIn(\"https://two.com\", output)\n\n    def test_select_unvisited(self):\n        \"\"\"Test filtering visited results.\"\"\"\n        self.agent.search_history = [\"https://visited.com\"]\n        results = [\n            {\"link\": \"https://visited.com\", \"title\": \"Old\"},\n            {\"link\": \"https://new.com\", \"title\": \"New\"}\n        ]\n        unvisited = self.agent.select_unvisited(results)\n        self.assertEqual(len(unvisited), 1)\n        self.assertEqual(unvisited[0][\"link\"], \"https://new.com\")\n\n    def test_select_unvisited_all_new(self):\n        \"\"\"Test when no results are visited.\"\"\"\n        self.agent.search_history = []\n        results = [\n            {\"link\": \"https://a.com\", \"title\": \"A\"},\n            {\"link\": \"https://b.com\", \"title\": \"B\"}\n        ]\n        unvisited = self.agent.select_unvisited(results)\n        self.assertEqual(len(unvisited), 2)\n\n\nif __name__ == \"__main__\":\n    unittest.main()"
  },
  {
    "path": "tests/test_chromedriver_update.py",
    "content": "import unittest\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\n\nfrom unittest.mock import patch, MagicMock\n\n# Mock heavy dependencies\nfor mod_name in [\n    'torch', 'transformers', 'kokoro', 'adaptive_classifier', 'text2emotion',\n    'ollama', 'openai', 'together', 'IPython', 'IPython.display',\n    'playsound3', 'soundfile', 'pyaudio', 'librosa',\n    'pypdf', 'langid', 'pypinyin', 'fake_useragent',\n    'num2words', 'sentencepiece', 'sacremoses',\n    'scipy', 'numpy', 'selenium_stealth', 'undetected_chromedriver',\n    'markdownify', 'chromedriver_autoinstaller',\n]:\n    if mod_name not in sys.modules:\n        sys.modules[mod_name] = MagicMock()\n\nos.environ.setdefault('WORK_DIR', '/tmp')\n\nfrom sources.browser import get_chromedriver_version, is_chromedriver_compatible\n\n\nclass TestChromedriverVersionCheck(unittest.TestCase):\n    \"\"\"Test suite for ChromeDriver version checking and auto-update logic.\"\"\"\n\n    @patch('sources.browser.subprocess.run')\n    def test_get_chromedriver_version_success(self, mock_run):\n        \"\"\"Test extracting major version from chromedriver --version output.\"\"\"\n        mock_run.return_value = MagicMock(\n            stdout=\"ChromeDriver 125.0.6422.78 (abc123)\\n\"\n        )\n        self.assertEqual(get_chromedriver_version(\"/usr/bin/chromedriver\"), \"125\")\n\n    @patch('sources.browser.subprocess.run')\n    def test_get_chromedriver_version_failure(self, mock_run):\n        \"\"\"Test graceful failure when chromedriver --version fails.\"\"\"\n        mock_run.side_effect = FileNotFoundError(\"not found\")\n        self.assertEqual(get_chromedriver_version(\"/nonexistent\"), \"\")\n\n    @patch('sources.browser.subprocess.run')\n    def test_get_chromedriver_version_timeout(self, mock_run):\n        \"\"\"Test graceful failure on timeout.\"\"\"\n        import subprocess\n        mock_run.side_effect = subprocess.TimeoutExpired(cmd=\"chromedriver\", timeout=10)\n        self.assertEqual(get_chromedriver_version(\"/usr/bin/chromedriver\"), \"\")\n\n    @patch('sources.browser.chromedriver_autoinstaller.get_chrome_version')\n    @patch('sources.browser.get_chromedriver_version')\n    def test_compatible_versions(self, mock_driver_ver, mock_chrome_ver):\n        \"\"\"Test that matching major versions are compatible.\"\"\"\n        mock_chrome_ver.return_value = \"125.0.6422.78\"\n        mock_driver_ver.return_value = \"125\"\n        self.assertTrue(is_chromedriver_compatible(\"/usr/bin/chromedriver\"))\n\n    @patch('sources.browser.chromedriver_autoinstaller.get_chrome_version')\n    @patch('sources.browser.get_chromedriver_version')\n    def test_incompatible_versions(self, mock_driver_ver, mock_chrome_ver):\n        \"\"\"Test that mismatched major versions are incompatible.\"\"\"\n        mock_chrome_ver.return_value = \"126.0.6478.55\"\n        mock_driver_ver.return_value = \"125\"\n        self.assertFalse(is_chromedriver_compatible(\"/usr/bin/chromedriver\"))\n\n    @patch('sources.browser.chromedriver_autoinstaller.get_chrome_version')\n    def test_no_chrome_version_assumes_compatible(self, mock_chrome_ver):\n        \"\"\"Test that missing Chrome version defaults to compatible.\"\"\"\n        mock_chrome_ver.return_value = None\n        self.assertTrue(is_chromedriver_compatible(\"/usr/bin/chromedriver\"))\n\n    @patch('sources.browser.chromedriver_autoinstaller.get_chrome_version')\n    @patch('sources.browser.get_chromedriver_version')\n    def test_no_driver_version_assumes_compatible(self, mock_driver_ver, mock_chrome_ver):\n        \"\"\"Test that missing driver version defaults to compatible.\"\"\"\n        mock_chrome_ver.return_value = \"125.0.6422.78\"\n        mock_driver_ver.return_value = \"\"\n        self.assertTrue(is_chromedriver_compatible(\"/usr/bin/chromedriver\"))\n\n\nif __name__ == '__main__':\n    unittest.main()\n"
  },
  {
    "path": "tests/test_logger.py",
    "content": "import unittest\nimport os\nimport sys\nimport shutil\nimport logging\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\n\nfrom sources.logger import Logger\n\n\nclass TestLogger(unittest.TestCase):\n    \"\"\"Test suite for the Logger class.\"\"\"\n\n    def setUp(self):\n        self.logger = Logger(\"test_logger.log\")\n\n    def tearDown(self):\n        if os.path.exists('.logs'):\n            for handler in self.logger.logger.handlers[:]:\n                handler.close()\n                self.logger.logger.removeHandler(handler)\n            log_path = os.path.join('.logs', 'test_logger.log')\n            if os.path.exists(log_path):\n                os.remove(log_path)\n\n    def test_initialization(self):\n        \"\"\"Test logger initializes correctly.\"\"\"\n        self.assertTrue(self.logger.enabled)\n        self.assertIsNotNone(self.logger.logger)\n        self.assertTrue(os.path.exists('.logs'))\n\n    def test_log_creates_file(self):\n        \"\"\"Test that logging creates a log file.\"\"\"\n        self.logger.info(\"test message\")\n        self.assertTrue(os.path.exists(self.logger.log_path))\n\n    def test_log_writes_message(self):\n        \"\"\"Test that log messages are written to file.\"\"\"\n        self.logger.info(\"hello world\")\n        with open(self.logger.log_path, 'r') as f:\n            content = f.read()\n        self.assertIn(\"hello world\", content)\n\n    def test_log_deduplication(self):\n        \"\"\"Test that consecutive identical messages are not duplicated.\"\"\"\n        self.logger.info(\"duplicate message\")\n        self.logger.info(\"duplicate message\")\n        with open(self.logger.log_path, 'r') as f:\n            content = f.read()\n        self.assertEqual(content.count(\"duplicate message\"), 1)\n\n    def test_log_different_messages(self):\n        \"\"\"Test that different messages are all written.\"\"\"\n        self.logger.info(\"message one\")\n        self.logger.info(\"message two\")\n        with open(self.logger.log_path, 'r') as f:\n            content = f.read()\n        self.assertIn(\"message one\", content)\n        self.assertIn(\"message two\", content)\n\n    def test_error_level(self):\n        \"\"\"Test error level logging.\"\"\"\n        self.logger.error(\"error occurred\")\n        with open(self.logger.log_path, 'r') as f:\n            content = f.read()\n        self.assertIn(\"ERROR\", content)\n        self.assertIn(\"error occurred\", content)\n\n    def test_warning_level(self):\n        \"\"\"Test warning level logging.\"\"\"\n        self.logger.warning(\"warning issued\")\n        with open(self.logger.log_path, 'r') as f:\n            content = f.read()\n        self.assertIn(\"WARNING\", content)\n        self.assertIn(\"warning issued\", content)\n\n    def test_create_folder(self):\n        \"\"\"Test folder creation.\"\"\"\n        test_path = \".test_log_folder\"\n        result = self.logger.create_folder(test_path)\n        self.assertTrue(result)\n        self.assertTrue(os.path.exists(test_path))\n        os.rmdir(test_path)\n\n    def test_create_folder_already_exists(self):\n        \"\"\"Test folder creation when folder already exists.\"\"\"\n        result = self.logger.create_folder('.logs')\n        self.assertTrue(result)\n\n\nif __name__ == '__main__':\n    unittest.main()\n"
  },
  {
    "path": "tests/test_memory.py",
    "content": "import unittest\nimport os\nimport sys\nimport json\nimport datetime\n\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))  # Add project root to Python path\nfrom sources.memory import Memory\n\nclass TestMemory(unittest.TestCase):\n    def setUp(self):\n        self.system_prompt = \"Test system prompt\"\n        self.memory = Memory(\n            system_prompt=self.system_prompt,\n            recover_last_session=False,\n            memory_compression=False\n        )\n\n    def tearDown(self):\n        if os.path.exists(\"conversations\"):\n            for root, dirs, files in os.walk(\"conversations\", topdown=False):\n                for name in files:\n                    os.remove(os.path.join(root, name))\n                for name in dirs:\n                    os.rmdir(os.path.join(root, name))\n            os.rmdir(\"conversations\")\n\n    def test_initialization(self):\n        self.assertEqual(len(self.memory.memory), 1)\n        self.assertEqual(self.memory.memory[0]['role'], 'system')\n        self.assertEqual(self.memory.memory[0]['content'], self.system_prompt)\n        self.assertIsNotNone(self.memory.session_id)\n        self.assertIsInstance(self.memory.session_time, datetime.datetime)\n\n    def test_get_filename(self):\n        filename = self.memory.get_filename()\n        self.assertTrue(filename.startswith(\"memory_\"))\n        self.assertTrue(filename.endswith(\".txt\"))\n        self.assertIn(self.memory.session_time.strftime('%Y-%m-%d'), filename)\n\n    def test_save_memory(self):\n        self.memory.save_memory()\n        save_path = os.path.join(self.memory.conversation_folder, \"casual_agent\")\n        self.assertTrue(os.path.exists(save_path))\n        filename = self.memory.get_filename()\n        self.assertTrue(os.path.exists(os.path.join(save_path, filename)))\n\n    def test_push(self):\n        index = self.memory.push(\"user\", \"Hello\")\n        self.assertEqual(index, 0)\n        self.assertEqual(len(self.memory.memory), 2)\n        self.assertEqual(self.memory.memory[1]['role'], \"user\")\n        self.assertEqual(self.memory.memory[1]['content'], \"Hello\")\n\n    def test_clear(self):\n        self.memory.push(\"user\", \"Hello\")\n        self.memory.clear()\n        self.assertEqual(len(self.memory.memory), 1) # doesn't clear sys message\n\n    def test_clear_section(self):\n        self.memory.clear()\n        mem_begin_idx = self.memory.push(\"user\", \"Hi i want you to make...\")\n        self.memory.push(\"assistant\", \"<code>\") \n        self.memory.push(\"user\", \"sys feedback: error\")\n        self.memory.push(\"assistant\", \"<corrected code>\")\n        mem_end_idx = self.memory.push(\"user\", \"according to search...\")\n        self.memory.clear_section(mem_begin_idx+1, mem_end_idx-1)\n        self.assertEqual(len(self.memory.memory), 3) # 3 msg with sys msg\n        self.assertEqual(self.memory.memory[0]['role'], \"system\")\n\n    def test_get(self):\n        self.memory.push(\"user\", \"Hello\")\n        memory_content = self.memory.get()\n        self.assertEqual(len(memory_content), 2)\n\n    def test_reset(self):\n        self.memory.push(\"user\", \"Hello\")\n        new_memory = [{\"role\": \"system\", \"content\": \"New prompt\"}]\n        self.memory.reset(new_memory)\n        self.assertEqual(self.memory.memory, new_memory)\n\n    def test_save_and_load_memory(self):\n        self.memory.push(\"user\", \"Hello\")\n        self.memory.push(\"assistant\", \"Hi\")\n        self.memory.save_memory()\n        \n        new_memory = Memory(self.system_prompt, recover_last_session=True)\n        new_memory.load_memory()\n        self.assertEqual(len(new_memory.memory), 3)  # System + messages\n        self.assertEqual(new_memory.memory[1]['content'], \"Hello\")\n\nif __name__ == '__main__':\n    unittest.main()"
  },
  {
    "path": "tests/test_minimax_provider.py",
    "content": "import unittest\nfrom unittest.mock import patch, MagicMock\nimport os\nimport sys\n\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\n\nfrom sources.llm_provider import Provider\n\n\nclass TestMiniMaxProvider(unittest.TestCase):\n    \"\"\"Test cases for MiniMax provider integration.\"\"\"\n\n    def test_minimax_provider_registered(self):\n        \"\"\"Test that minimax provider is registered in available_providers.\"\"\"\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            self.assertIn(\"minimax\", provider.available_providers)\n\n    def test_minimax_in_unsafe_providers(self):\n        \"\"\"Test that minimax is in unsafe_providers list.\"\"\"\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            self.assertIn(\"minimax\", provider.unsafe_providers)\n\n    def test_minimax_api_key_required(self):\n        \"\"\"Test that API key is fetched for minimax provider.\"\"\"\n        with patch.object(Provider, 'get_api_key', return_value='test-minimax-key') as mock_get_key:\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            mock_get_key.assert_called_with(\"minimax\")\n            self.assertEqual(provider.api_key, 'test-minimax-key')\n\n    @patch('sources.llm_provider.OpenAI')\n    @patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})\n    def test_minimax_local_not_supported(self, mock_openai_class):\n        \"\"\"Test that minimax provider raises error when is_local=True.\"\"\"\n        provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=True)\n        provider.api_key = 'test-key'\n        history = [{\"role\": \"user\", \"content\": \"Hello\"}]\n        with self.assertRaises(Exception) as context:\n            provider.minimax_fn(history)\n        self.assertIn(\"not available for local use\", str(context.exception))\n\n    @patch('sources.llm_provider.OpenAI')\n    @patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})\n    def test_minimax_uses_correct_base_url(self, mock_openai_class):\n        \"\"\"Test that minimax provider uses correct base URL.\"\"\"\n        mock_client = MagicMock()\n        mock_openai_class.return_value = mock_client\n        mock_response = MagicMock()\n        mock_response.choices = [MagicMock(message=MagicMock(content=\"Hello!\"))]\n        mock_client.chat.completions.create.return_value = mock_response\n\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            history = [{\"role\": \"user\", \"content\": \"Hello\"}]\n            provider.minimax_fn(history)\n\n            mock_openai_class.assert_called_with(\n                api_key='test-key',\n                base_url='https://api.minimax.io/v1'\n            )\n\n    @patch('sources.llm_provider.OpenAI')\n    @patch.dict(os.environ, {\n        'MINIMAX_API_KEY': 'test-key',\n        'MINIMAX_BASE_URL': 'https://api.minimaxi.com/v1'\n    })\n    def test_minimax_custom_base_url(self, mock_openai_class):\n        \"\"\"Test that minimax provider uses custom base URL from env.\"\"\"\n        mock_client = MagicMock()\n        mock_openai_class.return_value = mock_client\n        mock_response = MagicMock()\n        mock_response.choices = [MagicMock(message=MagicMock(content=\"Hello!\"))]\n        mock_client.chat.completions.create.return_value = mock_response\n\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            history = [{\"role\": \"user\", \"content\": \"Hello\"}]\n            provider.minimax_fn(history)\n\n            mock_openai_class.assert_called_with(\n                api_key='test-key',\n                base_url='https://api.minimaxi.com/v1'\n            )\n\n    @patch('sources.llm_provider.OpenAI')\n    @patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})\n    def test_minimax_uses_temperature_one(self, mock_openai_class):\n        \"\"\"Test that minimax provider uses temperature=1.0.\"\"\"\n        mock_client = MagicMock()\n        mock_openai_class.return_value = mock_client\n        mock_response = MagicMock()\n        mock_response.choices = [MagicMock(message=MagicMock(content=\"Hello!\"))]\n        mock_client.chat.completions.create.return_value = mock_response\n\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            history = [{\"role\": \"user\", \"content\": \"Hello\"}]\n            provider.minimax_fn(history)\n\n            call_kwargs = mock_client.chat.completions.create.call_args[1]\n            self.assertEqual(call_kwargs['temperature'], 1.0)\n\n    @patch('sources.llm_provider.OpenAI')\n    @patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})\n    def test_minimax_returns_response_content(self, mock_openai_class):\n        \"\"\"Test that minimax provider returns response content.\"\"\"\n        mock_client = MagicMock()\n        mock_openai_class.return_value = mock_client\n        mock_response = MagicMock()\n        mock_response.choices = [MagicMock(message=MagicMock(content=\"Test response\"))]\n        mock_client.chat.completions.create.return_value = mock_response\n\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            history = [{\"role\": \"user\", \"content\": \"Hello\"}]\n            result = provider.minimax_fn(history)\n\n            self.assertEqual(result, \"Test response\")\n\n    @patch('sources.llm_provider.OpenAI')\n    @patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})\n    def test_minimax_handles_empty_response(self, mock_openai_class):\n        \"\"\"Test that minimax provider handles empty response.\"\"\"\n        mock_client = MagicMock()\n        mock_openai_class.return_value = mock_client\n        mock_client.chat.completions.create.return_value = None\n\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            history = [{\"role\": \"user\", \"content\": \"Hello\"}]\n\n            with self.assertRaises(Exception) as context:\n                provider.minimax_fn(history)\n            self.assertIn(\"response is empty\", str(context.exception))\n\n    @patch('sources.llm_provider.OpenAI')\n    @patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})\n    def test_minimax_handles_api_error(self, mock_openai_class):\n        \"\"\"Test that minimax provider handles API errors.\"\"\"\n        mock_client = MagicMock()\n        mock_openai_class.return_value = mock_client\n        mock_client.chat.completions.create.side_effect = Exception(\"API rate limit exceeded\")\n\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            history = [{\"role\": \"user\", \"content\": \"Hello\"}]\n\n            with self.assertRaises(Exception) as context:\n                provider.minimax_fn(history)\n            self.assertIn(\"MiniMax API error\", str(context.exception))\n\n\nclass TestMiniMaxProviderModels(unittest.TestCase):\n    \"\"\"Test cases for MiniMax provider model configurations.\"\"\"\n\n    @patch('sources.llm_provider.OpenAI')\n    @patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})\n    def test_minimax_m25_model(self, mock_openai_class):\n        \"\"\"Test MiniMax-M2.5 model.\"\"\"\n        mock_client = MagicMock()\n        mock_openai_class.return_value = mock_client\n        mock_response = MagicMock()\n        mock_response.choices = [MagicMock(message=MagicMock(content=\"Response\"))]\n        mock_client.chat.completions.create.return_value = mock_response\n\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5\", is_local=False)\n            history = [{\"role\": \"user\", \"content\": \"Hello\"}]\n            provider.minimax_fn(history)\n\n            call_kwargs = mock_client.chat.completions.create.call_args[1]\n            self.assertEqual(call_kwargs['model'], \"MiniMax-M2.5\")\n\n    @patch('sources.llm_provider.OpenAI')\n    @patch.dict(os.environ, {'MINIMAX_API_KEY': 'test-key'})\n    def test_minimax_m25_highspeed_model(self, mock_openai_class):\n        \"\"\"Test MiniMax-M2.5-highspeed model.\"\"\"\n        mock_client = MagicMock()\n        mock_openai_class.return_value = mock_client\n        mock_response = MagicMock()\n        mock_response.choices = [MagicMock(message=MagicMock(content=\"Response\"))]\n        mock_client.chat.completions.create.return_value = mock_response\n\n        with patch.object(Provider, 'get_api_key', return_value='test-key'):\n            provider = Provider(\"minimax\", \"MiniMax-M2.5-highspeed\", is_local=False)\n            history = [{\"role\": \"user\", \"content\": \"Hello\"}]\n            provider.minimax_fn(history)\n\n            call_kwargs = mock_client.chat.completions.create.call_args[1]\n            self.assertEqual(call_kwargs['model'], \"MiniMax-M2.5-highspeed\")\n\n\nif __name__ == '__main__':\n    unittest.main()\n"
  },
  {
    "path": "tests/test_planner_agent_parsing.py",
    "content": "import unittest\nimport json\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\n\nfrom unittest.mock import MagicMock, patch\n\n# Mock heavy dependencies to allow import without installing them all\nfor mod_name in [\n    'torch', 'transformers', 'kokoro', 'adaptive_classifier', 'text2emotion',\n    'ollama', 'openai', 'together', 'IPython', 'IPython.display',\n    'playsound3', 'soundfile', 'pyaudio', 'librosa',\n    'pypdf', 'langid', 'pypinyin', 'fake_useragent',\n    'chromedriver_autoinstaller', 'num2words', 'sentencepiece', 'sacremoses',\n    'scipy', 'numpy', 'selenium_stealth', 'undetected_chromedriver',\n    'markdownify',\n]:\n    if mod_name not in sys.modules:\n        sys.modules[mod_name] = MagicMock()\n\nos.environ.setdefault('WORK_DIR', '/tmp')\n\nfrom sources.agents.planner_agent import PlannerAgent\n\n\nclass TestPlannerAgentParsing(unittest.TestCase):\n    \"\"\"Test suite for PlannerAgent.parse_agent_tasks JSON parsing robustness.\"\"\"\n\n    def setUp(self):\n        self.agent = PlannerAgent.__new__(PlannerAgent)\n        self.agent.tools = {\"json\": MagicMock()}\n        self.agent.tools[\"json\"].tag = \"json\"\n        self.agent.logger = MagicMock()\n        self.agent.agents = {\n            \"coder\": MagicMock(),\n            \"file\": MagicMock(),\n            \"web\": MagicMock(),\n            \"casual\": MagicMock()\n        }\n\n    def test_parse_valid_json(self):\n        \"\"\"Test that valid JSON plan is parsed correctly.\"\"\"\n        valid_json = '{\"plan\": [{\"agent\": \"web\", \"id\": \"1\", \"task\": \"Search info\", \"need\": []}]}'\n        self.agent.tools[\"json\"].load_exec_block.return_value = ([valid_json], None)\n\n        with patch.object(self.agent, 'get_task_names', return_value=[\"Task 1: Search info\"]):\n            result = self.agent.parse_agent_tasks(\"dummy text\")\n\n        self.assertEqual(len(result), 1)\n        self.assertEqual(result[0][1]['agent'], 'web')\n\n    def test_parse_malformed_json_returns_empty(self):\n        \"\"\"Test that malformed JSON returns empty list instead of crashing.\"\"\"\n        malformed_json = '{\"plan\": [{\"agent\": \"web\", \"id\": \"1\" \"task\": \"missing comma\"}]}'\n        self.agent.tools[\"json\"].load_exec_block.return_value = ([malformed_json], None)\n\n        with patch.object(self.agent, 'get_task_names', return_value=[]):\n            result = self.agent.parse_agent_tasks(\"dummy text\")\n\n        self.assertEqual(result, [])\n        self.agent.logger.warning.assert_called_once()\n\n    def test_parse_truncated_json_returns_empty(self):\n        \"\"\"Test that truncated JSON returns empty list instead of crashing.\"\"\"\n        truncated_json = '{\"plan\": [{\"agent\": \"web\", \"id\": \"1\", \"task\": \"Search'\n        self.agent.tools[\"json\"].load_exec_block.return_value = ([truncated_json], None)\n\n        with patch.object(self.agent, 'get_task_names', return_value=[]):\n            result = self.agent.parse_agent_tasks(\"dummy text\")\n\n        self.assertEqual(result, [])\n        self.agent.logger.warning.assert_called_once()\n\n    def test_parse_no_blocks_returns_empty(self):\n        \"\"\"Test that missing blocks returns empty list.\"\"\"\n        self.agent.tools[\"json\"].load_exec_block.return_value = (None, None)\n\n        with patch.object(self.agent, 'get_task_names', return_value=[]):\n            result = self.agent.parse_agent_tasks(\"no json here\")\n\n        self.assertEqual(result, [])\n\n    def test_parse_invalid_agent_returns_empty(self):\n        \"\"\"Test that an unknown agent name returns empty list.\"\"\"\n        valid_json = '{\"plan\": [{\"agent\": \"unknown_agent\", \"id\": \"1\", \"task\": \"Do something\", \"need\": []}]}'\n        self.agent.tools[\"json\"].load_exec_block.return_value = ([valid_json], None)\n\n        with patch.object(self.agent, 'get_task_names', return_value=[\"Task 1\"]):\n            result = self.agent.parse_agent_tasks(\"dummy text\")\n\n        self.assertEqual(result, [])\n\n    def test_parse_multiple_tasks(self):\n        \"\"\"Test parsing a plan with multiple tasks.\"\"\"\n        multi_task_json = '{\"plan\": [{\"agent\": \"web\", \"id\": \"1\", \"task\": \"Search\", \"need\": []}, {\"agent\": \"coder\", \"id\": \"2\", \"task\": \"Code it\", \"need\": [\"1\"]}]}'\n        self.agent.tools[\"json\"].load_exec_block.return_value = ([multi_task_json], None)\n\n        with patch.object(self.agent, 'get_task_names', return_value=[\"Task 1: Search\", \"Task 2: Code it\"]):\n            result = self.agent.parse_agent_tasks(\"dummy text\")\n\n        self.assertEqual(len(result), 2)\n        self.assertEqual(result[0][1]['agent'], 'web')\n        self.assertEqual(result[1][1]['agent'], 'coder')\n\n\nif __name__ == '__main__':\n    unittest.main()\n"
  },
  {
    "path": "tests/test_provider.py",
    "content": "import unittest\nfrom unittest.mock import patch, MagicMock\nimport os, sys\nimport socket\nimport subprocess\nfrom urllib.parse import urlparse\nimport platform\n\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))  # Add project root to Python path\n\nfrom sources.llm_provider import Provider\n\nclass TestIsIpOnline(unittest.TestCase):\n    def setUp(self):\n        self.checker = Provider(\"ollama\", \"deepseek-r1:32b\")\n\n    def test_empty_address(self):\n        \"\"\"Test with empty address\"\"\"\n        result = self.checker.is_ip_online(\"\")\n        self.assertFalse(result)\n\n    def test_localhost(self):\n        \"\"\"Test with localhost\"\"\"\n        test_cases = [\n            \"localhost\",\n            \"http://localhost\",\n            \"https://localhost\",\n            \"127.0.0.1\",\n            \"http://127.0.0.1\",\n            \"https://127.0.0.1:8080\"\n        ]\n        for address in test_cases:\n            with self.subTest(address=address):\n                result = self.checker.is_ip_online(address)\n                self.assertTrue(result)\n\n    def test_google_ips(self):\n        \"\"\"Test with known Google IPs\"\"\"\n        google_ips = [\n            \"74.125.197.100\",\n            \"74.125.197.139\",\n            \"74.125.197.101\",\n            \"74.125.197.113\",\n            \"74.125.197.102\",\n            \"74.125.197.138\"\n        ]\n        for ip in google_ips:\n            with self.subTest(ip=ip), \\\n                 patch('socket.gethostbyname', return_value=ip), \\\n                 patch('subprocess.run', return_value=MagicMock(returncode=0)):\n                result = self.checker.is_ip_online(ip)\n                self.assertTrue(result)\n\n    def test_unresolvable_hostname(self):\n        \"\"\"Test with unresolvable hostname\"\"\"\n        address = \"nonexistent.example.com\"\n        with patch('socket.gethostbyname', side_effect=socket.gaierror):\n            result = self.checker.is_ip_online(address)\n            self.assertFalse(result)\n\n    def test_valid_domain(self):\n        \"\"\"Test with valid domain name\"\"\"\n        address = \"google.com\"\n        with patch('socket.gethostbyname', return_value=\"142.250.190.78\"), \\\n             patch('subprocess.run', return_value=MagicMock(returncode=0)):\n            result = self.checker.is_ip_online(address)\n            self.assertTrue(result)\n\nif __name__ == '__main__':\n    unittest.main()"
  },
  {
    "path": "tests/test_searx_search.py",
    "content": "import unittest\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))  # Add project root to Python path\nfrom sources.tools.searxSearch import searxSearch\nfrom dotenv import load_dotenv\nimport requests  # Import the requests module\n\nload_dotenv()\n\nclass TestSearxSearch(unittest.TestCase):\n\n    def setUp(self):\n        os.environ['SEARXNG_BASE_URL'] = \"http://127.0.0.1:8080\"  # Set the environment variable\n        self.base_url = os.getenv(\"SEARXNG_BASE_URL\")\n        self.search_tool = searxSearch(base_url=self.base_url)\n        self.valid_query = \"test query\"\n        self.invalid_query = \"\"\n\n    def test_initialization_with_env_variable(self):\n        # Ensure the tool initializes correctly with the base URL from the environment variable\n        os.environ['SEARXNG_BASE_URL'] = \"http://test.example.com\"\n        search_tool = searxSearch()\n        self.assertEqual(search_tool.base_url, \"http://test.example.com\")\n        del os.environ['SEARXNG_BASE_URL']\n\n    def test_initialization_no_base_url(self):\n        # Ensure the tool raises an error if no base URL is provided\n        # Remove the environment variable to ensure the ValueError is raised\n        if 'SEARXNG_BASE_URL' in os.environ:\n            del os.environ['SEARXNG_BASE_URL']\n        with self.assertRaises(ValueError):\n            searxSearch(base_url=None)\n        # Restore the environment variable after the test\n        os.environ['SEARXNG_BASE_URL'] = \"http://searx.lan\"\n\n    def test_execute_valid_query(self):\n        # Execute the search and verify the result\n        result = self.search_tool.execute([self.valid_query])\n        print(f\"Output from test_execute_valid_query: {result}\")\n        self.assertTrue(isinstance(result, str), \"Result should be a string.\")\n        self.assertNotEqual(result, \"\", \"Result should not be empty. Check SearxNG instance.\")\n\n    def test_execute_empty_query(self):\n        # Test with an empty query\n        result = self.search_tool.execute([\"\"])\n        print(f\"Output from test_execute_empty_query: {result}\")\n        self.assertEqual(result, \"Error: Empty search query provided.\")\n\n    def test_execute_no_query(self):\n        # Test with no query provided\n        result = self.search_tool.execute([])\n        print(f\"Output from test_execute_no_query: {result}\")\n        self.assertEqual(result, \"Error: No search query provided.\")\n\n    def test_execute_request_exception(self):\n        # Test a request exception by temporarily modifying the base_url to an invalid one\n        original_base_url = self.search_tool.base_url\n        self.search_tool.base_url = \"http://invalid_url\"\n        try:\n            result = self.search_tool.execute([self.valid_query])\n            print(f\"Output from test_execute_request_exception: {result}\")\n            self.assertTrue(\"Error during search\" in result)\n        finally:\n            self.search_tool.base_url = original_base_url  # Restore the original base_url\n\n    def test_execute_no_results(self):\n        # Execute the search and verify that an empty string is handled correctly\n        result = self.search_tool.execute([\"nonexistent query that should return no results\"])\n        print(f\"Output from test_execute_no_results: {result}\")\n        self.assertTrue(isinstance(result, str), \"Result should be a string.\")\n        # Allow empty results, but print a warning\n        if result == \"\":\n            print(\"Warning: SearxNG returned no results for a query that should have returned no results.\")\n\n    def test_execution_failure_check_error(self):\n        # Test when the output contains an error\n        output = \"Error: Something went wrong\"\n        self.assertTrue(self.search_tool.execution_failure_check(output))\n\n    def test_execution_failure_check_no_error(self):\n        # Test when the output does not contain an error\n        output = \"Search completed successfully\"\n        self.assertFalse(self.search_tool.execution_failure_check(output))\n\nif __name__ == '__main__':\n    unittest.main()\n"
  },
  {
    "path": "tests/test_tools_parsing.py",
    "content": "import unittest\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\n\nfrom sources.tools.tools import Tools\n\nclass TestToolsParsing(unittest.TestCase):\n    \"\"\"\n    Test suite for the Tools class parsing functionality, specifically the load_exec_block method.\n    This method is responsible for extracting code blocks from LLM-generated text.\n    \"\"\"\n\n    def setUp(self):\n        \"\"\"Set up test fixtures before each test method.\"\"\"\n        class TestTool(Tools):\n            def execute(self, blocks, safety=False):\n                return \"test execution\"\n            \n            def execution_failure_check(self, output):\n                return False\n            \n            def interpreter_feedback(self, output):\n                return \"test feedback\"\n        \n        self.tool = TestTool()\n        self.tool.tag = \"python\"  # Set tag for testing\n\n    def test_load_exec_block_single_block(self):\n        \"\"\"Test parsing a single code block from LLM text.\"\"\"\n        llm_text = \"\"\"Here's some Python code:\n```python\nprint(\"Hello, World!\")\nx = 42\n```\nThat's the code.\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertIsNotNone(blocks)\n        self.assertEqual(len(blocks), 1)\n        self.assertEqual(blocks[0], '\\nprint(\"Hello, World!\")\\nx = 42\\n')\n        self.assertIsNone(save_path)\n\n    def test_load_exec_block_multiple_blocks(self):\n        \"\"\"Test parsing multiple code blocks from LLM text.\"\"\"\n        llm_text = \"\"\"First block:\n```python\nimport os\nprint(\"First block\")\n```\n\nSecond block:\n```python\nimport sys\nprint(\"Second block\")\n```\n\nDone.\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertIsNotNone(blocks)\n        self.assertEqual(len(blocks), 2)\n        self.assertEqual(blocks[0], '\\nimport os\\nprint(\"First block\")\\n')\n        self.assertEqual(blocks[1], '\\nimport sys\\nprint(\"Second block\")\\n')\n        self.assertIsNone(save_path)\n\n    def test_load_exec_block_with_save_path(self):\n        \"\"\"Test parsing code block with save path specification.\"\"\"\n        llm_text = \"\"\"```python\nsave_path: test_file.py\nimport os\nprint(\"Hello with save path\")\n```\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertIsNotNone(blocks)\n        self.assertEqual(len(blocks), 1)\n        self.assertEqual(blocks[0], '\\nsave_path: test_file.py\\nimport os\\nprint(\"Hello with save path\")\\n')\n        self.assertIsNone(save_path)\n\n\n    def test_load_exec_block_with_indentation(self):\n        \"\"\"Test parsing code blocks with leading whitespace/indentation.\"\"\"\n        llm_text = \"\"\"    Here's indented code:\n    ```python\n    def hello():\n        print(\"Hello\")\n        return True\n    ```\n    End of code.\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertIsNotNone(blocks)\n        self.assertEqual(len(blocks), 1)\n        expected_code = '\\ndef hello():\\n    print(\"Hello\")\\n    return True\\n'\n        self.assertEqual(blocks[0], expected_code)\n\n    def test_load_exec_block_no_blocks(self):\n        \"\"\"Test parsing text with no code blocks.\"\"\"\n        llm_text = \"\"\"This is just regular text with no code blocks.\nThere are no python blocks here.\nJust plain text.\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertIsNone(blocks)\n        self.assertIsNone(save_path)\n\n    def test_load_exec_block_wrong_tag(self):\n        \"\"\"Test parsing text with code blocks but wrong language tag.\"\"\"\n        llm_text = \"\"\"```javascript\nconsole.log(\"This is JavaScript, not Python\");\n```\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertIsNone(blocks)\n        self.assertIsNone(save_path)\n\n    def test_load_exec_block_incomplete_block(self):\n        \"\"\"Test parsing text with incomplete code block (missing closing tag).\"\"\"\n        llm_text = \"\"\"```python\nprint(\"This block has no closing tag\")\nx = 42\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertEqual(blocks, [])\n        self.assertIsNone(save_path)\n\n    def test_load_exec_block_empty_block(self):\n        \"\"\"Test parsing empty code block.\"\"\"\n        llm_text = \"\"\"```python\n```\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertIsNotNone(blocks)\n        self.assertEqual(len(blocks), 1)\n        self.assertEqual(blocks[0], '\\n')\n\n    def test_load_exec_block_mixed_content(self):\n        \"\"\"Test parsing text with mixed content including code blocks.\"\"\"\n        llm_text = \"\"\"Let me help you with that task.\n\nFirst, I'll import the necessary modules:\n```python\nimport os\nimport sys\n```\n\nThen I'll define a function:\n```python\ndef process_data(data):\n    return data.upper()\n```\n\nFinally, let's use it:\n```python\nresult = process_data(\"hello world\")\nprint(result)\n```\n\nThat should work!\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertIsNotNone(blocks)\n        self.assertEqual(len(blocks), 3)\n        self.assertEqual(blocks[0], '\\nimport os\\nimport sys\\n')\n        self.assertEqual(blocks[1], '\\ndef process_data(data):\\n    return data.upper()\\n')\n        self.assertEqual(blocks[2], '\\nresult = process_data(\"hello world\")\\nprint(result)\\n')\n\n    def test_load_exec_block_with_special_characters(self):\n        \"\"\"Test parsing code blocks containing special characters.\"\"\"\n        llm_text = \"\"\"```python\ntext = \"Hello \\\"world\\\" with 'quotes'\"\nregex = r\"^\\\\d+$\"\npath = \"C:\\\\Users\\\\test\\\\file.txt\"\n```\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertIsNotNone(blocks)\n        self.assertEqual(len(blocks), 1)\n        expected = '\\ntext = \"Hello \"world\" with \\'quotes\\'\"\\nregex = r\"^\\\\d+$\"\\npath = \"C:\\\\Users\\\\test\\\\file.txt\"\\n'\n        self.assertEqual(blocks[0], expected)\n\n    def test_load_exec_block_tag_undefined(self):\n        \"\"\"Test that assertion error is raised when tag is undefined.\"\"\"\n        self.tool.tag = \"undefined\"\n        llm_text = \"\"\"```python\nprint(\"test\")\n```\"\"\"\n        \n        with self.assertRaises(AssertionError):\n            self.tool.load_exec_block(llm_text)\n\n    def test_found_executable_blocks_flag(self):\n        \"\"\"Test that the executable blocks found flag is set correctly.\"\"\"\n        self.assertFalse(self.tool.found_executable_blocks())\n        \n        llm_text = \"\"\"```python\nprint(\"test\")\n```\"\"\"\n        \n        blocks, save_path = self.tool.load_exec_block(llm_text)\n        \n        self.assertTrue(self.tool.found_executable_blocks())\n        \n        self.assertFalse(self.tool.found_executable_blocks())\n\n    def test_get_parameter_value(self):\n        \"\"\"Test the get_parameter_value helper method.\"\"\"\n        block = \"\"\"param1 = value1\nparam2 = value2\nsome other text\nparam3 = value3\"\"\"\n        \n        self.assertEqual(self.tool.get_parameter_value(block, \"param1\"), \"value1\")\n        self.assertEqual(self.tool.get_parameter_value(block, \"param2\"), \"value2\")\n        self.assertEqual(self.tool.get_parameter_value(block, \"param3\"), \"value3\")\n        self.assertIsNone(self.tool.get_parameter_value(block, \"nonexistent\"))\n\nif __name__ == '__main__':\n    unittest.main()"
  },
  {
    "path": "tests/test_utility.py",
    "content": "import unittest\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))\n\nfrom sources.utility import get_color_map\n\n\nclass TestUtility(unittest.TestCase):\n    \"\"\"Test suite for utility module functions.\"\"\"\n\n    def test_get_color_map_returns_dict(self):\n        \"\"\"Test that get_color_map returns a dictionary.\"\"\"\n        color_map = get_color_map()\n        self.assertIsInstance(color_map, dict)\n\n    def test_get_color_map_has_required_keys(self):\n        \"\"\"Test that color map contains all required color keys.\"\"\"\n        color_map = get_color_map()\n        required_keys = [\"success\", \"failure\", \"status\", \"code\", \"warning\", \"output\", \"info\"]\n        for key in required_keys:\n            self.assertIn(key, color_map, f\"Missing key: {key}\")\n\n    def test_get_color_map_values_are_strings(self):\n        \"\"\"Test that all color values are strings.\"\"\"\n        color_map = get_color_map()\n        for key, value in color_map.items():\n            self.assertIsInstance(value, str, f\"Value for '{key}' should be a string\")\n\n    def test_success_is_green(self):\n        \"\"\"Test that success maps to green.\"\"\"\n        color_map = get_color_map()\n        self.assertEqual(color_map[\"success\"], \"green\")\n\n    def test_failure_is_red(self):\n        \"\"\"Test that failure maps to red.\"\"\"\n        color_map = get_color_map()\n        self.assertEqual(color_map[\"failure\"], \"red\")\n\n\nif __name__ == '__main__':\n    unittest.main()\n"
  }
]