Skip to content

Commit

Permalink
refactor: Rename package memory-api to agents-api
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Feb 9, 2024
1 parent 7d0ed4a commit bf2b24b
Show file tree
Hide file tree
Showing 122 changed files with 707 additions and 664 deletions.
2 changes: 1 addition & 1 deletion agents-api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ COPY . ./

RUN pip install -e .

CMD ["python", "memory_api/web.py", "--host", "0.0.0.0", "--port", "8080"]
CMD ["python", "agents_api/web.py", "--host", "0.0.0.0", "--port", "8080"]
4 changes: 2 additions & 2 deletions agents-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
1. Start the temporal dev server
`temporal server start-dev --db-filename temporal.db`
2. Start the worker
`python -m memory_api.worker`
`python -m agents_api.worker`

---

## Rough notes

#### DIRECTORY CONVENTION

- `memory_api/models/{relation_prefix}/`
- `agents_api/models/{relation_prefix}/`

- `__init__.py`
- `schema.py` # DDL
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
from typing import Awaitable, Callable
from textwrap import dedent
from temporalio import activity
from memory_api.clients.cozo import client
from memory_api.models.entry.entries_summarization import (
from agents_api.clients.cozo import client
from agents_api.models.entry.entries_summarization import (
get_toplevel_entries_query,
entries_summarization_query,
)
from memory_api.common.protocol.entries import Entry
from agents_api.common.protocol.entries import Entry


example_previous_memory = """
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from temporalio.client import Client, TLSConfig
from uuid import UUID, uuid4
from memory_api.env import (
from agents_api.env import (
temporal_worker_url,
temporal_namespace,
temporal_client_cert,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import httpx
from memory_api.env import worker_url
from agents_api.env import worker_url
from .types import (
MemoryManagementTaskArgs,
MemoryManagementTask,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from uuid import UUID, uuid4

from pydantic import BaseModel, Field, computed_field
from memory_api.autogen.openapi_model import Role
from agents_api.autogen.openapi_model import Role

EntrySource = Literal["api_request", "api_response", "internal", "summarizer"]
Tokenizer = Literal["character_count"]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from fastapi.security.api_key import APIKeyHeader
from fastapi import Security, HTTPException
from starlette.status import HTTP_403_FORBIDDEN
from memory_api.env import api_key
from agents_api.env import api_key


api_key_header = APIKeyHeader(name="X-Auth-Key", auto_error=False)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,41 @@
from starlette.status import HTTP_201_CREATED, HTTP_202_ACCEPTED
from pydantic import UUID4, BaseModel

from memory_api.clients.cozo import client
from memory_api.clients.embed import embed
from memory_api.models.agent.create_agent import create_agent_query
from memory_api.models.agent.list_agents import list_agents_query
from memory_api.models.agent.delete_agent import delete_agent_query
from memory_api.models.agent.update_agent import update_agent_query
from memory_api.models.agent.get_agent import get_agent_query
from memory_api.models.agent.update_tool import update_tool_by_id_query
from memory_api.models.additional_info.create_additional_info import (
from agents_api.clients.cozo import client
from agents_api.clients.embed import embed
from agents_api.models.agent.create_agent import create_agent_query
from agents_api.models.agent.list_agents import list_agents_query
from agents_api.models.agent.delete_agent import delete_agent_query
from agents_api.models.agent.update_agent import update_agent_query
from agents_api.models.agent.get_agent import get_agent_query
from agents_api.models.agent.update_tool import update_tool_by_id_query
from agents_api.models.additional_info.create_additional_info import (
create_additional_info_query,
)
from memory_api.models.additional_info.list_additional_info import (
from agents_api.models.additional_info.list_additional_info import (
list_additional_info_snippets_by_owner_query,
)
from memory_api.models.additional_info.delete_additional_info import (
from agents_api.models.additional_info.delete_additional_info import (
delete_additional_info_by_id_query,
)
from memory_api.models.additional_info.get_additional_info import (
from agents_api.models.additional_info.get_additional_info import (
get_additional_info_snippets_by_id_query,
)
from memory_api.models.additional_info.embed_additional_info import (
from agents_api.models.additional_info.embed_additional_info import (
embed_additional_info_snippets_query,
)
from memory_api.models.tools.create_tools import create_function_query
from memory_api.models.tools.embed_tools import embed_functions_query
from memory_api.models.tools.list_tools import list_functions_by_agent_query
from memory_api.models.tools.get_tools import get_function_by_id_query
from memory_api.models.tools.delete_tools import delete_function_by_id_query
from memory_api.models.instructions.create_instructions import create_instructions_query
from memory_api.models.instructions.embed_instructions import embed_instructions_query
from memory_api.models.instructions.delete_instructions import (
from agents_api.models.tools.create_tools import create_function_query
from agents_api.models.tools.embed_tools import embed_functions_query
from agents_api.models.tools.list_tools import list_functions_by_agent_query
from agents_api.models.tools.get_tools import get_function_by_id_query
from agents_api.models.tools.delete_tools import delete_function_by_id_query
from agents_api.models.instructions.create_instructions import create_instructions_query
from agents_api.models.instructions.embed_instructions import embed_instructions_query
from agents_api.models.instructions.delete_instructions import (
delete_instructions_by_agent_query,
)
from memory_api.dependencies.developer_id import get_developer_id
from memory_api.autogen.openapi_model import (
from agents_api.dependencies.developer_id import get_developer_id
from agents_api.autogen.openapi_model import (
Agent,
CreateAgentRequest,
UpdateAgentRequest,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from memory_api.clients.cozo import client
from agents_api.clients.cozo import client


logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from fastapi import APIRouter, HTTPException, status
from pydantic import UUID4
from .protocol import UpsertBeliefRequest, Belief, IndexRequest
from memory_api.clients.cozo import client
from agents_api.clients.cozo import client


router = APIRouter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from google.protobuf import json_format
from google.protobuf.struct_pb2 import Value

from memory_api.env import (
from agents_api.env import (
prediction_project,
prediction_endpoint_id,
prediction_location,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from memory_api.clients.cozo import client
from agents_api.clients.cozo import client


logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pydantic import BaseModel
from memory_api.common.protocol.entries import Entry
from agents_api.common.protocol.entries import Entry


class EntriesRequest(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from fastapi import APIRouter
from pydantic import UUID4
from .protocol import EntriesRequest
from memory_api.clients.cozo import client
from memory_api.common.protocol.entries import Entry
from memory_api.models.entry.add_entries import add_entries_query
from memory_api.models.entry.get_entries import get_entries_query
from agents_api.clients.cozo import client
from agents_api.common.protocol.entries import Entry
from agents_api.models.entry.add_entries import add_entries_query
from agents_api.models.entry.get_entries import get_entries_query


router = APIRouter()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from memory_api.clients.cozo import client
from agents_api.clients.cozo import client


logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from memory_api.clients.cozo import client
from agents_api.clients.cozo import client


logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from fastapi import APIRouter, HTTPException, status
from .protocol import Model, ModelRequest
from memory_api.clients.cozo import client
from agents_api.clients.cozo import client


router = APIRouter()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from memory_api.clients.cozo import client
from agents_api.clients.cozo import client
from pydantic import UUID4
from pandas import DataFrame

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import httpx
from async_lru import alru_cache
from memory_api.env import (
from agents_api.env import (
client_id,
client_secret,
endpoint_base,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
get_shortscale_result,
get_full_assesment_result,
)
from memory_api.clients.worker.worker import add_principles_task
from memory_api.clients.worker.types import AddPrinciplesTaskArgs
from agents_api.clients.worker.worker import add_principles_task
from agents_api.clients.worker.types import AddPrinciplesTaskArgs


router = APIRouter()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import logging
from memory_api.clients.cozo import client
from agents_api.clients.cozo import client


logger = logging.getLogger(__name__)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pydantic import BaseModel, Field
from memory_api.autogen.openapi_model import ResponseFormat
from agents_api.autogen.openapi_model import ResponseFormat


class Settings(BaseModel):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
from starlette.status import HTTP_201_CREATED, HTTP_202_ACCEPTED
from fastapi import APIRouter, HTTPException, status, BackgroundTasks, Depends
from pydantic import UUID4
from memory_api.clients.cozo import client
from memory_api.models.session.get_session import get_session_query
from memory_api.models.session.create_session import create_session_query
from memory_api.models.session.list_sessions import list_sessions_query
from memory_api.models.session.delete_session import delete_session_query
from memory_api.dependencies.developer_id import get_developer_id
from memory_api.autogen.openapi_model import (
from agents_api.clients.cozo import client
from agents_api.models.session.get_session import get_session_query
from agents_api.models.session.create_session import create_session_query
from agents_api.models.session.list_sessions import list_sessions_query
from agents_api.models.session.delete_session import delete_session_query
from agents_api.dependencies.developer_id import get_developer_id
from agents_api.autogen.openapi_model import (
CreateSessionRequest,
UpdateSessionRequest,
Session,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import openai
from dataclasses import dataclass
from pydantic import UUID4
from memory_api.clients.cozo import client
from memory_api.clients.embed import embed
from memory_api.env import summarization_tokens_threshold
from memory_api.clients.temporal import run_summarization_task
from memory_api.models.entry.add_entries import add_entries_query
from memory_api.common.protocol.entries import Entry
from memory_api.clients.worker.types import ChatML
from memory_api.models.session.session_data import get_session_data
from memory_api.models.entry.proc_mem_context import proc_mem_context_query
from memory_api.autogen.openapi_model import InputChatMLMessage
from agents_api.clients.cozo import client
from agents_api.clients.embed import embed
from agents_api.env import summarization_tokens_threshold
from agents_api.clients.temporal import run_summarization_task
from agents_api.models.entry.add_entries import add_entries_query
from agents_api.common.protocol.entries import Entry
from agents_api.clients.worker.types import ChatML
from agents_api.models.session.session_data import get_session_data
from agents_api.models.entry.proc_mem_context import proc_mem_context_query
from agents_api.autogen.openapi_model import InputChatMLMessage
from ...common.protocol.sessions import SessionData
from .protocol import Settings

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
from pydantic import UUID4, BaseModel
from fastapi import APIRouter, HTTPException, status, Depends
from starlette.status import HTTP_201_CREATED, HTTP_202_ACCEPTED
from memory_api.clients.cozo import client
from memory_api.clients.embed import embed
from memory_api.models.user.create_user import create_user_query
from memory_api.models.user.list_users import list_users_query
from memory_api.models.user.update_user import update_user_query
from memory_api.models.user.get_user import get_user_query
from memory_api.models.additional_info.create_additional_info import (
from agents_api.clients.cozo import client
from agents_api.clients.embed import embed
from agents_api.models.user.create_user import create_user_query
from agents_api.models.user.list_users import list_users_query
from agents_api.models.user.update_user import update_user_query
from agents_api.models.user.get_user import get_user_query
from agents_api.models.additional_info.create_additional_info import (
create_additional_info_query,
)
from memory_api.models.additional_info.list_additional_info import (
from agents_api.models.additional_info.list_additional_info import (
list_additional_info_snippets_by_owner_query,
)
from memory_api.models.additional_info.delete_additional_info import (
from agents_api.models.additional_info.delete_additional_info import (
delete_additional_info_by_id_query,
)
from memory_api.models.additional_info.get_additional_info import (
from agents_api.models.additional_info.get_additional_info import (
get_additional_info_snippets_by_id_query,
)
from memory_api.models.additional_info.embed_additional_info import (
from agents_api.models.additional_info.embed_additional_info import (
embed_additional_info_snippets_query,
)
from memory_api.dependencies.developer_id import get_developer_id
from memory_api.autogen.openapi_model import (
from agents_api.dependencies.developer_id import get_developer_id
from agents_api.autogen.openapi_model import (
User,
CreateUserRequest,
UpdateUserRequest,
Expand Down
6 changes: 3 additions & 3 deletions agents-api/memory_api/web.py → agents-api/agents_api/web.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
from fastapi.middleware.cors import CORSMiddleware
from fastapi.exceptions import RequestValidationError
from pycozo.client import QueryException
from memory_api.routers import (
from agents_api.routers import (
agents,
sessions,
users,
)
from memory_api.env import sentry_dsn
from memory_api.dependencies.auth import get_api_key
from agents_api.env import sentry_dsn
from agents_api.dependencies.auth import get_api_key


sentry_sdk.init(
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit bf2b24b

Please sign in to comment.