This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into prompt-engine-api
- Loading branch information
Showing
18 changed files
with
122 additions
and
195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,6 @@ | |
}, | ||
"vectordb": { | ||
"name": "chromadb", | ||
"class_name": "llm_stack" | ||
"class_name": "genai_stack" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
"""Top-level package for genai_stack.""" | ||
|
||
__author__ = """AIM by DPhi""" | ||
__author__ = """AI Planet Tech Team""" | ||
__email__ = "[email protected]" | ||
__version__ = "0.2.2" | ||
__version__ = "0.2.3" | ||
|
||
import os | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
VECTORDB = "/vectordb" | ||
ETL = "/etl" | ||
PROMPT_ENGINE = "/prompt-engine" | ||
MODEL = "/model" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class ModelBaseModel(BaseModel): | ||
pass | ||
|
||
|
||
class ModelRequestModel(ModelBaseModel): | ||
prompt: str | ||
|
||
|
||
class ModelResponseModel(ModelBaseModel): | ||
output: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from fastapi import APIRouter | ||
|
||
from genai_stack.constant import API, MODEL | ||
from genai_stack.genai_server.settings.settings import settings | ||
from genai_stack.genai_server.services.model_service import ModelService | ||
from genai_stack.genai_server.models.model_models import ModelResponseModel, ModelRequestModel | ||
|
||
service = ModelService(store=settings.STORE) | ||
|
||
router = APIRouter(prefix=API + MODEL, tags=["model"]) | ||
|
||
|
||
@router.post("/predict") | ||
def predict(data: ModelRequestModel) -> ModelResponseModel: | ||
return service.predict(data=data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from genai_stack.genai_platform.services.base_service import BaseService | ||
from genai_stack.genai_server.models.model_models import ModelRequestModel, ModelResponseModel | ||
from genai_stack.genai_server.utils import get_current_stack | ||
from genai_stack.genai_server.settings.config import stack_config | ||
|
||
|
||
class ModelService(BaseService): | ||
def predict(self, data: ModelRequestModel) -> ModelResponseModel: | ||
stack = get_current_stack(config=stack_config) | ||
response = stack.model.predict(data.prompt) | ||
return ModelResponseModel( | ||
output=response["output"], | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.