From 8fb350354df9d17ca331fffed53f30976fe3892b Mon Sep 17 00:00:00 2001 From: antonkulaga Date: Thu, 28 Nov 2024 00:32:30 +0100 Subject: [PATCH] fix notebook one --- .github/workflows/run_tests.yaml | 13 ++++++-- coding/pyproject.toml | 4 +-- config/agent_profiles.yaml | 30 +++++++++++++++++++ core/pyproject.toml | 2 +- examples/just_agents/mock/__init__.py | 0 examples/notebooks/01_just_agents_colab.ipynb | 15 +++++----- examples/notebooks/02_sqlite_example.ipynb | 6 ++-- examples/notebooks/03_coding_agent.ipynb | 6 ++-- examples/pyproject.toml | 16 ++++++---- poetry.lock | 26 ++++++++-------- pyproject.toml | 12 ++++---- router/pyproject.toml | 8 +++-- tools/pyproject.toml | 8 +++-- web/pyproject.toml | 4 +-- 14 files changed, 99 insertions(+), 51 deletions(-) create mode 100644 config/agent_profiles.yaml create mode 100644 examples/just_agents/mock/__init__.py diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index ccde847..3ee28a7 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -35,8 +35,15 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} GROQ_API_KEY: ${{ secrets.GROQ_API_KEY }} run: | - # Install root project dependencies which will include subprojects - poetry install --with dev + # Explicitly install base dependencies + poetry add pytest python-dotenv --group dev - # Run tests + # Install dependencies for each subpackage + cd core && poetry install --with dev && cd .. + cd coding && poetry install --with dev && cd .. + cd router && poetry install --with dev && cd .. + cd tools && poetry install --with dev && cd .. + cd web && poetry install --with dev && cd .. + + # Run tests from project root poetry run pytest diff --git a/coding/pyproject.toml b/coding/pyproject.toml index 1434c98..455c5cf 100644 --- a/coding/pyproject.toml +++ b/coding/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "just-agents-coding" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Coding Components" authors = [ "Alex Karmazin ", @@ -19,7 +19,7 @@ license = "MIT" [tool.poetry.dependencies] python = ">=3.10,<4.0" -just-agents-core = ">=0.4.1" +just-agents-core = ">=0.4.2" llm-sandbox = ">=0.1.4" [build-system] diff --git a/config/agent_profiles.yaml b/config/agent_profiles.yaml new file mode 100644 index 0000000..e2c3df7 --- /dev/null +++ b/config/agent_profiles.yaml @@ -0,0 +1,30 @@ +agent_profiles: + SecretaryAgent: + autoload_from_yaml: false + backstory: Developed to assist in the understanding and documentation of AI agents. + class_qualname: just_agents.router.secretary_agent.SecretaryAgent + description: Generates concise and detail-rich profiles for AI agents. + expertise_domain: AI agent analysis and profiling + extra_dict: + personality_traits: Agent's personality traits go here + goal: To provide accurate and informative profiles based on available attributes. + knowledge_sources: [] + limitations: Limited to the information available up to October 2023; cannot access + external databases or APIs. + llm_options: + model: gpt-4o-mini + temperature: 0.0 + model_name: gpt-4o-mini + personality_traits: Skilled, detail-oriented, concise, informative + role: AI assistant specializing in analysis and description of AI agents + system_prompt: "\n You are a skilled AI assistant specializing in analysis\ + \ and description of AI agents. \n You are tasked with generation of a minimalistic\ + \ and concise yet detail-rich profile for an AI agent, based on the AVAILABLE_ATTRIBUTES,\ + \ \n including 'system_prompt', 'llm_options' and any other. Your task is\ + \ to fill in values of a JSON-formatted profile \n that matches the PROFILE_UPDATE_TEMPLATE\ + \ provided below. Values of the template describe what output is expected for\ + \ each field. \n Only populate fields based on the well-established information,\ + \ don't make up anything. \n Double-check that the output contains only a\ + \ valid JSON with all the fields specified in PROFILE_UPDATE_TEMPLATE. \n \ + \ Never include any additional text or explanations in your reply.\n " + task: Profile generation for AI agents based on specified attributes. diff --git a/core/pyproject.toml b/core/pyproject.toml index 55f78af..d4b5fed 100644 --- a/core/pyproject.toml +++ b/core/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "just-agents-core" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Base Package" authors = [ "Alex Karmazin ", diff --git a/examples/just_agents/mock/__init__.py b/examples/just_agents/mock/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/examples/notebooks/01_just_agents_colab.ipynb b/examples/notebooks/01_just_agents_colab.ipynb index 894762d..fcd498c 100644 --- a/examples/notebooks/01_just_agents_colab.ipynb +++ b/examples/notebooks/01_just_agents_colab.ipynb @@ -104,7 +104,7 @@ "Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (3.7.1)\n", "Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.9.0)\n", "Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.27.2)\n", - "Requirement already satisfied: jiter<1,>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.0)\n", + "Requirement already satisfied: jiter<1,>=0.4.2 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.0)\n", "Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.3.1)\n", "Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (4.66.6)\n", "Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.10/dist-packages (from pydantic<3.0.0,>=2.0.0->litellm>=1.51.0->just-agents) (0.7.0)\n", @@ -154,8 +154,7 @@ } ], "source": [ - "!pip install just-agents-core==0.4.1\n", - "!pip install just-agents-examples==0.4.1" + "!pip install just-agents-core==0.4.2" ] }, { @@ -733,7 +732,7 @@ "from just_agents import llm_options\n", "\n", "session: BaseAgent = BaseAgent(\n", - " llm_options=llm_options.LLAMA3_2,\n", + " llm_options=llm_options.LLAMA3_2_VISION,\n", " tools=[get_weather_by_city]\n", " #if you rename the function, then do not forget to change here\n", ")\n", @@ -800,7 +799,7 @@ } ], "source": [ - "!wget https://raw.githubusercontent.com/longevity-genie/just-agents/refs/heads/main/just_agents_examples/basic/agents_profiles.yaml -O agent_profiles.yaml" + "!wget https://raw.githubusercontent.com/longevity-genie/just-agents/refs/heads/main/examples/just_agents/examples/basic/agent_profiles.yaml -O agent_profiles.yaml\n" ] }, { @@ -876,7 +875,7 @@ "source": [ "\n", "from just_agents.patterns.chain_of_throught import ChainOfThoughtAgent\n", - "agent = ChainOfThoughtAgent.from_yaml(\"ChainOfThoughtAgent\")\n", + "agent = ChainOfThoughtAgent.from_yaml(\"ChainOfThoughtAgent\", file_path=\"agent_profiles.yaml\")\n", "# Add a callback to print all messages that the agent processes\n", "agent.memory.add_on_message(lambda message: print(message))\n", "\n", @@ -1013,7 +1012,7 @@ " task=\"Make America great again! Use Trump style of communication\")\n", "\n", "\n", - "exchanges = 3\n", + "exchanges = 2\n", "\n", "\n", "Harris_reply = \"Hi.\"\n", @@ -1055,7 +1054,7 @@ " task=\"Make America great again! Use Trump style of communication\")\n", "Moderator: ChatAgent = #YOUR CODE HERE\n", "\n", - "exchanges = 3\n", + "exchanges = 2\n", "\n", "Moderator.memory.add_on_message(\n", " lambda m: display(Markdown(f\"**Trump:** {m['content']}\")) if m[\"role\"] == \"user\" else display(Markdown(f\"**Harris:** {m['content']}\"))\n", diff --git a/examples/notebooks/02_sqlite_example.ipynb b/examples/notebooks/02_sqlite_example.ipynb index 52047e5..e233c4b 100644 --- a/examples/notebooks/02_sqlite_example.ipynb +++ b/examples/notebooks/02_sqlite_example.ipynb @@ -262,7 +262,7 @@ "Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (3.7.1)\n", "Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.9.0)\n", "Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.27.2)\n", - "Requirement already satisfied: jiter<1,>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.0)\n", + "Requirement already satisfied: jiter<1,>=0.4.2 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.0)\n", "Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.3.1)\n", "Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (4.66.6)\n", "Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.10/dist-packages (from pydantic<3.0.0,>=2.0.0->litellm>=1.51.0->just-agents) (0.7.0)\n", @@ -312,8 +312,8 @@ } ], "source": [ - "!pip install just-agents-core==0.4.1\n", - "!pip install just-agents-examples==0.4.1" + "!pip install just-agents-core==0.4.2\n", + "!pip install just-agents-examples==0.4.2" ] }, { diff --git a/examples/notebooks/03_coding_agent.ipynb b/examples/notebooks/03_coding_agent.ipynb index a6ada4b..66c1a0b 100644 --- a/examples/notebooks/03_coding_agent.ipynb +++ b/examples/notebooks/03_coding_agent.ipynb @@ -106,7 +106,7 @@ "Requirement already satisfied: anyio<5,>=3.5.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (3.7.1)\n", "Requirement already satisfied: distro<2,>=1.7.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.9.0)\n", "Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.27.2)\n", - "Requirement already satisfied: jiter<1,>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.1)\n", + "Requirement already satisfied: jiter<1,>=0.4.2 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (0.7.1)\n", "Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (1.3.1)\n", "Requirement already satisfied: tqdm>4 in /usr/local/lib/python3.10/dist-packages (from openai>=1.54.0->litellm>=1.51.0->just-agents) (4.66.6)\n", "Requirement already satisfied: annotated-types>=0.6.0 in /usr/local/lib/python3.10/dist-packages (from pydantic<3.0.0,>=2.0.0->litellm>=1.51.0->just-agents) (0.7.0)\n", @@ -156,8 +156,8 @@ } ], "source": [ - "!pip install just-agents-core==0.4.1\n", - "!pip install just-agents-examples==0.4.1" + "!pip install just-agents-core==0.4.2\n", + "!pip install just-agents-examples==0.4.2" ] }, { diff --git a/examples/pyproject.toml b/examples/pyproject.toml index d48da00..d7edd87 100644 --- a/examples/pyproject.toml +++ b/examples/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "just-agents-examples" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Examples code" authors = ["Alex Karmazin "] maintainers = ["Anton Kulaga "] @@ -12,11 +12,15 @@ license = "MIT" [tool.poetry.dependencies] python = ">=3.10,<4.0" -just-agents-core = ">=0.4.1" -just-agents-tools = ">=0.4.1" -just-agents-coding = ">=0.4.1" -just-agents-web = ">=0.4.1" -just-agents-router = ">=0.4.1" +just-agents-core = ">=0.4.2" +just-agents-tools = ">=0.4.2" +just-agents-coding = ">=0.4.2" +just-agents-web = ">=0.4.2" +just-agents-router = ">=0.4.2" + +[tool.poetry.group.dev.dependencies] +pytest = "^7.4.4" +python-dotenv = "*" [build-system] requires = ["poetry-core"] diff --git a/poetry.lock b/poetry.lock index 04f9e41..e250947 100644 --- a/poetry.lock +++ b/poetry.lock @@ -934,7 +934,7 @@ referencing = ">=0.31.0" [[package]] name = "just-agents-coding" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Coding Components" optional = false python-versions = ">=3.10,<4.0" @@ -942,7 +942,7 @@ files = [] develop = true [package.dependencies] -just-agents-core = ">=0.4.1" +just-agents-core = ">=0.4.2" llm-sandbox = ">=0.1.4" [package.source] @@ -951,7 +951,7 @@ url = "coding" [[package]] name = "just-agents-core" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Base Package" optional = false python-versions = ">=3.10,<4.0" @@ -971,7 +971,7 @@ url = "core" [[package]] name = "just-agents-router" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Router Components" optional = false python-versions = ">=3.10,<4.0" @@ -979,7 +979,7 @@ files = [] develop = true [package.dependencies] -just-agents-core = ">=0.4.1" +just-agents-core = ">=0.4.2" [package.source] type = "directory" @@ -987,7 +987,7 @@ url = "router" [[package]] name = "just-agents-tools" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Tools Components" optional = false python-versions = ">=3.10,<4.0" @@ -995,7 +995,7 @@ files = [] develop = true [package.dependencies] -just-agents-core = ">=0.4.1" +just-agents-core = ">=0.4.2" semanticscholar = ">=0.8.4" typer = ">=0.13.0" @@ -1005,7 +1005,7 @@ url = "tools" [[package]] name = "just-agents-web" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Web. It allows runing openai API for the agent in the browser." optional = false python-versions = ">=3.10,<4.0" @@ -1014,7 +1014,7 @@ develop = true [package.dependencies] fastapi = "^0.115.5" -just-agents-core = ">=0.4.1" +just-agents-core = ">=0.4.2" loguru = "^0.7.2" starlette = "^0.41.3" @@ -1536,13 +1536,13 @@ files = [ [[package]] name = "pyasn1-modules" -version = "0.4.1" +version = "0.4.2" description = "A collection of ASN.1-based protocols modules" optional = false python-versions = ">=3.8" files = [ - {file = "pyasn1_modules-0.4.1-py3-none-any.whl", hash = "sha256:49bfa96b45a292b711e986f222502c1c9a5e1f4e568fc30e2574a6c7d07838fd"}, - {file = "pyasn1_modules-0.4.1.tar.gz", hash = "sha256:c28e2dbf9c06ad61c71a075c7e0f9fd0f1b0bb2d2ad4377f240d33ac2ab60a7c"}, + {file = "pyasn1_modules-0.4.2-py3-none-any.whl", hash = "sha256:49bfa96b45a292b711e986f222502c1c9a5e1f4e568fc30e2574a6c7d07838fd"}, + {file = "pyasn1_modules-0.4.2.tar.gz", hash = "sha256:c28e2dbf9c06ad61c71a075c7e0f9fd0f1b0bb2d2ad4377f240d33ac2ab60a7c"}, ] [package.dependencies] @@ -2214,7 +2214,7 @@ tomli = {version = ">=2", markers = "python_version < \"3.11\""} [package.extras] docs = ["sphinxcontrib-websupport"] -lint = ["flake8 (>=6.0)", "mypy (==1.11.1)", "pyright (==1.1.384)", "pytest (>=6.0)", "ruff (==0.6.9)", "sphinx-lint (>=0.9)", "tomli (>=2)", "types-Pillow (==10.2.0.20240822)", "types-Pygments (==2.18.0.20240506)", "types-colorama (==0.4.15.20240311)", "types-defusedxml (==0.7.0.20240218)", "types-docutils (==0.21.0.20241005)", "types-requests (==2.32.0.20240914)", "types-urllib3 (==1.26.25.14)"] +lint = ["flake8 (>=6.0)", "mypy (==1.11.1)", "pyright (==1.1.384)", "pytest (>=6.0)", "ruff (==0.6.9)", "sphinx-lint (>=0.9)", "tomli (>=2)", "types-Pillow (==10.2.0.20240822)", "types-Pygments (==2.18.0.20240506)", "types-colorama (==0.4.25.20240311)", "types-defusedxml (==0.7.0.20240218)", "types-docutils (==0.21.0.20241005)", "types-requests (==2.32.0.20240914)", "types-urllib3 (==1.26.25.14)"] test = ["cython (>=3.0)", "defusedxml (>=0.7.1)", "pytest (>=8.0)", "setuptools (>=70.0)", "typing_extensions (>=4.9)"] [[package]] diff --git a/pyproject.toml b/pyproject.toml index 27be2a9..e794150 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "just-agents" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - A lightweight, straightforward library for LLM agents that focuses on simplicity over unnecessary abstractions." authors = [ "Alex Karmazin ", @@ -26,11 +26,11 @@ just-agents-web = { path = "web", develop = true } just-agents-router = { path = "router", develop = true } [tool.poetry.group.publish.dependencies] -just-agents-core = "0.4.1" -just-agents-tools = "0.4.1" -just-agents-coding = "0.4.1" -just-agents-web = "0.4.1" -just-agents-router = "0.4.1" +just-agents-core = "0.4.2" +just-agents-tools = "0.4.2" +just-agents-coding = "0.4.2" +just-agents-web = "0.4.2" +just-agents-router = "0.4.2" [tool.poetry.group.dev.dependencies] pytest = "^7.4.4" diff --git a/router/pyproject.toml b/router/pyproject.toml index 0ae1f16..a8e4125 100644 --- a/router/pyproject.toml +++ b/router/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "just-agents-router" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Router Components" authors = [ "Newton Winter ", @@ -18,7 +18,11 @@ license = "MIT" [tool.poetry.dependencies] python = ">=3.10,<4.0" -just-agents-core = ">=0.4.1" +just-agents-core = ">=0.4.2" + +[tool.poetry.group.dev.dependencies] +pytest = "^7.4.4" +python-dotenv = "*" [build-system] requires = ["poetry-core"] diff --git a/tools/pyproject.toml b/tools/pyproject.toml index a94b676..af0d836 100644 --- a/tools/pyproject.toml +++ b/tools/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "just-agents-tools" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Tools Components" authors = ["Alex Karmazin "] maintainers = ["Anton Kulaga "] @@ -12,10 +12,14 @@ license = "MIT" [tool.poetry.dependencies] python = ">=3.10,<4.0" -just-agents-core = ">=0.4.1" +just-agents-core = ">=0.4.2" semanticscholar = ">=0.8.4" typer = ">=0.13.0" +[tool.poetry.group.dev.dependencies] +pytest = "^7.4.4" +python-dotenv = "*" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" \ No newline at end of file diff --git a/web/pyproject.toml b/web/pyproject.toml index 5645dd9..5df2e38 100644 --- a/web/pyproject.toml +++ b/web/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "just_agents_web" -version = "0.4.1" +version = "0.4.2" description = "Just Agents - Web. It allows runing openai API for the agent in the browser." authors = [ "Alex Karmazin ", @@ -29,7 +29,7 @@ classifiers = [ ] [tool.poetry.dependencies] python = ">=3.10,<4.0" -"just-agents-core" = ">=0.4.1" +"just-agents-core" = ">=0.4.2" loguru = "^0.7.2" fastapi = "^0.115.5" starlette = "^0.41.3"