Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move swarm_copy to neuroagent and delete old code. #60

Merged
merged 9 commits into from
Dec 20, 2024
Merged
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
10 changes: 5 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ jobs:
pip install bandit[toml]==1.7.4 ruff==0.6.7
- name: Linting check
run: |
bandit -qr -c pyproject.toml src/ swarm_copy/
ruff check src/ tests/ swarm_copy/
ruff format --check src/ tests/ swarm_copy/
bandit -qr -c pyproject.toml src/
ruff check src/ tests/
ruff format --check src/ tests/
unit-tests:
runs-on: ${{ matrix.os }}
services:
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
pip install ".[dev]"
- name: Running mypy and tests
run: |
mypy src/ swarm_copy/
mypy src/
# Include src/ directory in Python path to prioritize local files in pytest
export PYTHONPATH=$(pwd)/src:$PYTHONPATH
pytest --color=yes tests/ swarm_copy_tests/
pytest --color=yes tests/
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repos:
rev: v1.8.0
hooks:
- id: mypy
files: ^src/ ^swarm_copy/
files: ^src/
additional_dependencies: ['pydantic', 'types-requests']

- repo: https://github.com/PyCQA/bandit
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
- Return model dumps of DB schema objects.
- Moved swarm_copy to neuroagent and delete old code.

### Added
- LLM evaluation logic
Expand Down
14 changes: 6 additions & 8 deletions alembic/env.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import os
from logging.config import fileConfig

from sqlalchemy import engine_from_config
from sqlalchemy import pool
import os
from alembic import context
from dotenv import load_dotenv
from sqlalchemy import engine_from_config, pool

from alembic import context

# Load environment variables from .env file
load_dotenv()

# Import your Base class
from swarm_copy.app.database.sql_schemas import Base
from neuroagent.app.database.sql_schemas import Base

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand Down Expand Up @@ -92,9 +92,7 @@ def run_migrations_online() -> None:
)

with connectable.connect() as connection:
context.configure(
connection=connection, target_metadata=target_metadata
)
context.configure(connection=connection, target_metadata=target_metadata)

with context.begin_transaction():
context.run_migrations()
Expand Down
19 changes: 10 additions & 9 deletions alembic/versions/169bed537507_add_entity_to_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,33 @@
Create Date: 2024-11-13 10:27:11.640265

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = '169bed537507'
down_revision: Union[str, None] = 'b57e558cf11f'
revision: str = "169bed537507"
down_revision: Union[str, None] = "b57e558cf11f"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# Create the enum type first
entity_enum = sa.Enum('USER', 'AI_TOOL', 'TOOL', 'AI_MESSAGE', name='entity')
entity_enum = sa.Enum("USER", "AI_TOOL", "TOOL", "AI_MESSAGE", name="entity")
entity_enum.create(op.get_bind())

# Then add the column using the enum
op.add_column('messages', sa.Column('entity', entity_enum, nullable=False))
op.add_column("messages", sa.Column("entity", entity_enum, nullable=False))


def downgrade() -> None:
# Drop the column first
op.drop_column('messages', 'entity')
op.drop_column("messages", "entity")

# Then drop the enum type
entity_enum = sa.Enum(name='entity')
entity_enum = sa.Enum(name="entity")
entity_enum.drop(op.get_bind())
50 changes: 28 additions & 22 deletions alembic/versions/b57e558cf11f_initial_migration.py
Original file line number Diff line number Diff line change
@@ -1,49 +1,55 @@
"""Initial migration

Revision ID: b57e558cf11f
Revises:
Revises:
Create Date: 2024-11-11 14:42:05.624237

"""

from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = 'b57e558cf11f'
revision: str = "b57e558cf11f"
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('threads',
sa.Column('thread_id', sa.String(), nullable=False),
sa.Column('vlab_id', sa.String(), nullable=False),
sa.Column('project_id', sa.String(), nullable=False),
sa.Column('title', sa.String(), nullable=False),
sa.Column('creation_date', sa.DateTime(), nullable=False),
sa.Column('update_date', sa.DateTime(), nullable=False),
sa.Column('user_id', sa.String(), nullable=False),
sa.PrimaryKeyConstraint('thread_id')
op.create_table(
"threads",
sa.Column("thread_id", sa.String(), nullable=False),
sa.Column("vlab_id", sa.String(), nullable=False),
sa.Column("project_id", sa.String(), nullable=False),
sa.Column("title", sa.String(), nullable=False),
sa.Column("creation_date", sa.DateTime(), nullable=False),
sa.Column("update_date", sa.DateTime(), nullable=False),
sa.Column("user_id", sa.String(), nullable=False),
sa.PrimaryKeyConstraint("thread_id"),
)
op.create_table('messages',
sa.Column('message_id', sa.String(), nullable=False),
sa.Column('order', sa.Integer(), nullable=False),
sa.Column('creation_date', sa.DateTime(), nullable=False),
sa.Column('content', sa.String(), nullable=False),
sa.Column('thread_id', sa.String(), nullable=False),
sa.ForeignKeyConstraint(['thread_id'], ['threads.thread_id'], ),
sa.PrimaryKeyConstraint('message_id')
op.create_table(
"messages",
sa.Column("message_id", sa.String(), nullable=False),
sa.Column("order", sa.Integer(), nullable=False),
sa.Column("creation_date", sa.DateTime(), nullable=False),
sa.Column("content", sa.String(), nullable=False),
sa.Column("thread_id", sa.String(), nullable=False),
sa.ForeignKeyConstraint(
["thread_id"],
["threads.thread_id"],
),
sa.PrimaryKeyConstraint("message_id"),
)
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_table('messages')
op.drop_table('threads')
op.drop_table("messages")
op.drop_table("threads")
# ### end Alembic commands ###
11 changes: 3 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ readme = "README.md"
requires-python = ">=3.10"
dynamic = ["version"]
dependencies = [
"aiohttp",
"aiosqlite",
"asgi-correlation-id",
"asyncpg",
"bluepyefe",
"efel",
"fastapi",
"langchain",
"langchain-cohere",
"langchain-openai",
"langgraph",
"langgraph-checkpoint-postgres",
"langgraph-checkpoint-sqlite",
"neurom",
"openai",
"psycopg-binary",
"pydantic-settings",
"python-dotenv",
Expand Down Expand Up @@ -75,7 +71,7 @@ convention = "numpy"

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["D"]
"swarm_copy_tests/*" = ["D"]
"alembic/*" = ["D", "E"]

[tool.mypy]
mypy_path = "src"
Expand Down Expand Up @@ -105,7 +101,6 @@ filterwarnings = [
"ignore:Mean of empty slice:RuntimeWarning",
"ignore:Degrees of freedom:RuntimeWarning",
"ignore:Exception ignored in:pytest.PytestUnraisableExceptionWarning",
"ignore:This API is in beta:langchain_core._api.beta_decorator.LangChainBetaWarning",
"ignore:The configuration option 'asyncio_default_fixture_loop_scope' is unset."
]

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
)
from pydantic import ValidationError

from swarm_copy.new_types import (
from neuroagent.new_types import (
Agent,
Response,
Result,
)
from swarm_copy.tools.base_tool import BaseTool
from swarm_copy.utils import merge_chunk
from neuroagent.tools.base_tool import BaseTool
from neuroagent.utils import merge_chunk


class AgentsRoutine:
Expand Down
13 changes: 0 additions & 13 deletions src/neuroagent/agents/__init__.py

This file was deleted.

105 changes: 0 additions & 105 deletions src/neuroagent/agents/base_agent.py

This file was deleted.

Loading
Loading