Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_conditional_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/conditional
run: make lint

- name: Run tests
working-directory: agents/conditional
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_external_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/external
run: make lint

- name: Run tests
working-directory: agents/external
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_generate_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/generate
run: make lint

- name: Run tests
working-directory: agents/generate
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_google_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/google
run: make lint

- name: Run tests
working-directory: agents/google
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_historical_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/historical
run: make lint

- name: Run tests
working-directory: agents/historical
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_http_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/http
run: make lint

- name: Run tests
working-directory: agents/http
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_mcp_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/mcp
run: make lint

- name: Run tests
working-directory: agents/mcp
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_nucliadb_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/nucliadb
run: make lint

- name: Run tests
working-directory: agents/nucliadb
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_passthrough_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/passthrough
run: make lint

- name: Run tests
working-directory: agents/passthrough
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_perplexity_search_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/perplexity_search
run: make lint

- name: Run tests
working-directory: agents/perplexity_search
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_perplexity_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/perplexity
run: make lint

- name: Run tests
working-directory: agents/perplexity
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_related_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/related
run: make lint

- name: Run tests
working-directory: agents/related
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_remi_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/remi
run: make lint

- name: Run tests
working-directory: agents/remi
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_rephrase_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/rephrase
run: make lint

- name: Run tests
working-directory: agents/rephrase
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_restart_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/restart
run: make lint

- name: Run tests
working-directory: agents/restart
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_restricted_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/restricted
run: make lint

- name: Run tests
working-directory: agents/restricted
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_smart_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/smart
run: make lint

- name: Run tests
working-directory: agents/smart
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_static_string_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/static_string
run: make lint

- name: Run tests
working-directory: agents/static_string
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_static_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/static
run: make lint

- name: Run tests
working-directory: agents/static
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_summarize_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: agents/summarize
run: make lint

- name: Run tests
working-directory: agents/summarize
run: make test
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/hyperforge_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ jobs:
- name: Install package dependencies with uv
run: uv sync --group dev

- name: Lint
working-directory: hyperforge
run: make lint

- name: Run tests
working-directory: hyperforge
run: make test
Expand Down
47 changes: 27 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
COMPONENTS := \
hyperforge \
agents/conditional \
agents/external \
agents/generate \
agents/google \
agents/historical \
agents/http \
agents/mcp \
agents/nucliadb \
agents/passthrough \
agents/perplexity \
agents/perplexity_search \
agents/related \
agents/remi \
agents/rephrase \
agents/restart \
agents/restricted \
agents/smart \
agents/static \
agents/static_string \
agents/summarize

install:
uv sync

install-test:
uv sync --group dev

fmt:
uv run ruff format hyperforge agents
uv run ruff check hyperforge agents --select I --fix
format fmt:
@for dir in $(COMPONENTS); do $(MAKE) -C $$dir format || exit 1; done

extract-openai:
uv run arag-extract-openapi $(DOCS_FILE) $(API_VERSION) $(HASH)

lint:
uv run ruff check hyperforge agents
uv run ruff format --check hyperforge agents
uv run mypy hyperforge agents
@for dir in $(COMPONENTS); do $(MAKE) -C $$dir lint || exit 1; done

start_local_db:
brew services start postgresql
Expand Down Expand Up @@ -47,17 +67,4 @@ dockers:
docker build -t arag . -f HYPERFORGE.Dockerfile

all-tests:
make -C hyperforge test
make -C agents/smart test
make -C agents/perplexity test
make -C agents/perplexity_search test
make -C agents/google test
make -C agents/conditional test
make -C agents/external test
make -C agents/generate test
make -C agents/nucliadb test
make -C agents/passthrough test
make -C agents/remi test
make -C agents/smart test
make -C agents/summarize test
make -C agents/static test
@for dir in $(COMPONENTS); do $(MAKE) -C $$dir test || exit 1; done
5 changes: 4 additions & 1 deletion agents/conditional/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Libraries :: Python Modules",
]
requires-python = ">=3.10, <4"
requires-python = ">=3.12, <4"
dependencies = ["hyperforge"]

[dependency-groups]
Expand Down Expand Up @@ -47,3 +47,6 @@ asyncio_mode = "auto"

# Exclude specific files from being packaged
source-exclude = ["tests/**", "*.pyc"]

[tool.ruff]
extend = "../../ruff.toml"
13 changes: 6 additions & 7 deletions agents/conditional/src/hyperforge_conditional/conditional.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from time import time
from typing import Any, Dict, List, Literal, Optional, cast

from hyperforge import PROMPT_ENVIRONMENT
from hyperforge.agent import Agent, AgentConfig
from hyperforge.configure import get_agent_config_klass, get_agent_klass
from hyperforge.manager import Manager
Expand All @@ -10,8 +11,6 @@
from hyperforge.utils import WidgetType
from pydantic import BaseModel, Field, field_serializer, field_validator

from hyperforge import PROMPT_ENVIRONMENT

CONDITIONAL_AGENT = """
Given a prompt that indicates a condition , assess whether a given text fulfills it or not.
# PROMPT:
Expand Down Expand Up @@ -113,16 +112,16 @@ def serialize_conditional_agent(
def is_conditional_agent(cls, value: list[Dict[str, Any]]) -> list[BaseModel]:
if value is None:
return value
result = []
result: list[BaseModel] = []
for agent_cfg in value:
module = agent_cfg.get("module")
if module is None:
raise ValueError("Invalid agent config: missing 'module' field")

agent_config_klass = get_agent_config_klass(module)
agent_config_instance = agent_config_klass.model_validate(agent_cfg)
result.append(agent_config_instance)
return result # type: ignore
result.append(cast(BaseModel, agent_config_instance))
return result


class Conditional:
Expand Down Expand Up @@ -229,7 +228,7 @@ async def __call__(

if condition and self.then is not None:
for then_agent in self.then:
await then_agent(memory, manager) # type: ignore
await then_agent(memory, manager)
elif condition is False and self.else_ is not None:
for else_agent in self.else_:
await else_agent(memory, manager) # type: ignore
await else_agent(memory, manager)
12 changes: 6 additions & 6 deletions agents/conditional/src/hyperforge_conditional/context_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class ContextConditionalAgentConfig(ConditionalAgentConfig, ContextAgentConfig):
model_config = ConfigDict(title="Condition")
module: Literal["context_conditional"] = "context_conditional"
on: Literal["QUESTION", "CONTEXT"] = Field( # type: ignore
on: Literal["QUESTION", "CONTEXT"] = Field(
default="QUESTION",
title="Evaluate condition on",
description="Source to evaluate the condition on. CONTEXT is only valid when this agent is used as a next agent in a chain.",
Expand Down Expand Up @@ -58,7 +58,7 @@ async def get_question_context(
flow_id: str,
extra_context: Optional[Dict[str, Any]] = None,
):
self.config: ContextConditionalAgentConfig # type: ignore
self.config: ContextConditionalAgentConfig
if extra_context is not None:
question, question_uuid = await self.rephrase(
memory=memory,
Expand Down Expand Up @@ -137,17 +137,17 @@ async def get_question_context(

if self.next_agent is not None:
extra_context = extra_context or {}
for agent in ( # type: ignore
for nagent in (
selected_agents + [self.fallback]
if self.fallback is not None
else selected_agents
):
if agent:
if nagent:
answer_summaries = memory.get_agent_answer_summaries(
flow_id=flow_id, agent_id=agent.agent_id
flow_id=flow_id, agent_id=nagent.agent_id
)
if answer_summaries:
extra_context[agent.agent_id] = "\n".join(answer_summaries)
extra_context[nagent.agent_id] = "\n".join(answer_summaries)

await self.next_agent.get_question_context(
memory,
Expand Down
Empty file.
Loading
Loading