Skip to content

Commit

Permalink
Basic repo structure (#19)
Browse files Browse the repository at this point in the history
* Add application and _common

* put src in application and add requirements file

* relative import -> absolute import

* Changed repo structure
  • Loading branch information
yonishelach authored Sep 12, 2024
1 parent 53a0183 commit 004acf5
Show file tree
Hide file tree
Showing 48 changed files with 1,676 additions and 104 deletions.
1 change: 1 addition & 0 deletions controller/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ SQLAlchemy~=2.0.23
uvicorn
python-dotenv
pyyaml
click
requests
tabulate
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from fastapi import APIRouter, FastAPI
from fastapi.middleware.cors import CORSMiddleware

from controller.src.api.endpoints import (
from controller.api.endpoints import (
data_sources,
datasets,
documents,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

from fastapi import APIRouter, Depends

from controller.src.api.utils import (
from controller.api.utils import (
AuthInfo,
_send_to_application,
get_auth_user,
get_db,
)
from controller.src.db import client
from controller.src.schemas import (
from controller.db import client
from genai_factory.schemas import (
APIResponse,
DataSource,
DataSourceType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

from fastapi import APIRouter, Depends

from controller.src.api.utils import AuthInfo, get_auth_user, get_db
from controller.src.db import client
from controller.src.schemas import APIResponse, Dataset, OutputMode
from controller.api.utils import AuthInfo, get_auth_user, get_db
from controller.db import client
from genai_factory.schemas import APIResponse, Dataset, OutputMode

router = APIRouter(prefix="/projects/{project_name}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

from fastapi import APIRouter, Depends

from controller.src.api.utils import AuthInfo, get_auth_user, get_db
from controller.src.db import client
from controller.src.schemas import APIResponse, Document, OutputMode
from controller.api.utils import AuthInfo, get_auth_user, get_db
from controller.db import client
from genai_factory.schemas import APIResponse, Document, OutputMode

router = APIRouter(prefix="/projects/{project_name}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

from fastapi import APIRouter, Depends

from controller.src.api.utils import AuthInfo, get_auth_user, get_db
from controller.src.db import client
from controller.src.schemas import APIResponse, Model, OutputMode
from controller.api.utils import AuthInfo, get_auth_user, get_db
from controller.db import client
from genai_factory.schemas import APIResponse, Model, OutputMode

router = APIRouter(prefix="/projects/{project_name}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

from fastapi import APIRouter, Depends

from controller.src.api.utils import get_db
from controller.src.db import client
from controller.src.schemas import APIResponse, OutputMode, Project
from controller.api.utils import get_db
from controller.db import client
from genai_factory.schemas import APIResponse, OutputMode, Project

router = APIRouter()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

from fastapi import APIRouter, Depends

from controller.src.api.utils import AuthInfo, get_auth_user, get_db
from controller.src.db import client
from controller.src.schemas import APIResponse, OutputMode, PromptTemplate
from controller.api.utils import AuthInfo, get_auth_user, get_db
from controller.db import client
from genai_factory.schemas import APIResponse, OutputMode, PromptTemplate

router = APIRouter(prefix="/projects/{project_name}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

from fastapi import APIRouter, Depends

from controller.src.api.utils import get_db
from controller.src.db import client
from controller.src.schemas import APIResponse, ChatSession, OutputMode
from controller.api.utils import get_db
from controller.db import client
from genai_factory.schemas import APIResponse, ChatSession, OutputMode

router = APIRouter(prefix="/users/{user_name}")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

from fastapi import APIRouter, Depends

from controller.src.api.utils import get_db
from controller.src.db import client
from controller.src.schemas import APIResponse, OutputMode, User
from controller.api.utils import get_db
from controller.db import client
from genai_factory.schemas import APIResponse, OutputMode, User

router = APIRouter()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

from fastapi import APIRouter, Depends

from controller.src.api.utils import (
from controller.api.utils import (
AuthInfo,
_send_to_application,
get_auth_user,
get_db,
)
from controller.src.db import client
from controller.src.schemas import (
from controller.db import client
from genai_factory.schemas import (
APIResponse,
ChatSession,
OutputMode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from fastapi import Header, Request
from pydantic import BaseModel

from controller.src.config import config
from controller.src.db import client
from controller.config import config
from controller.db import client


def get_db():
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from controller.src.config import config

from .sqlclient import SqlClient
from controller.config import config
from controller.db.sqlclient import SqlClient

client = None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import sqlalchemy
from sqlalchemy.orm import sessionmaker

import controller.src.db.sqldb as db
import controller.src.schemas as api_models
from controller.src.config import logger
import controller.db.sqldb as db
import genai_factory.schemas as api_models
from controller.config import logger


class SqlClient:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class DataSource(VersionedOwnerBaseSchema):
:arg project_id: The project's id.
:arg data_source_type: The type of the data source.
Can be one of the values in controller.src.schemas.data_source.DataSourceType.
Can be one of the values in genai_factory.schemas.data_source.DataSourceType.
"""

# Columns:
Expand Down Expand Up @@ -386,7 +386,7 @@ class Model(VersionedOwnerBaseSchema):
The Model table which is used to define models for the project.
:arg project_id: The project's id.
:arg model_type: The type of the model. Can be one of the values in controller.src.schemas.model.ModelType.
:arg model_type: The type of the model. Can be one of the values in genai_factory.schemas.model.ModelType.
:arg task: The task of the model. For example, "classification", "text-generation", etc.
"""

Expand Down Expand Up @@ -570,7 +570,7 @@ class Workflow(VersionedOwnerBaseSchema):
:arg project_id: The project's id.
:arg workflow_type: The type of the workflow.
Can be one of the values in controller.src.schemas.workflow.WorkflowType.
Can be one of the values in genai_factory.schemas.workflow.WorkflowType.
"""

# Columns:
Expand Down
8 changes: 4 additions & 4 deletions controller/src/main.py → controller/src/controller/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import yaml
from tabulate import tabulate

from controller.src.api.utils import _send_to_application
from controller.src.config import config
from controller.src.db import client
from controller.src.schemas import (
from controller.api.utils import _send_to_application
from controller.config import config
from controller.db import client
from genai_factory.schemas import (
DataSource,
Document,
Project,
Expand Down
43 changes: 0 additions & 43 deletions controller/src/schemas/workflow.py

This file was deleted.

7 changes: 7 additions & 0 deletions genai_factory/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
langchain_community
langchain_openai
langchain_huggingface
pymilvus
langchain-milvus
chromadb==0.5.3
mlrun==1.6.0
13 changes: 13 additions & 0 deletions genai_factory/src/genai_factory/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2023 Iguazio
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
Loading

0 comments on commit 004acf5

Please sign in to comment.