Skip to content

Commit

Permalink
[AIC-py][editor] server v2
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanlastmileai committed Dec 30, 2023
1 parent 8137a6c commit f1bf5d1
Show file tree
Hide file tree
Showing 5 changed files with 577 additions and 15 deletions.
1 change: 1 addition & 0 deletions python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ black
flake8
flask-cors
flask[async]
fastapi
google-generativeai
huggingface_hub
hypothesis==6.91.0
Expand Down
8 changes: 4 additions & 4 deletions python/src/aiconfig/editor/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

import lastmile_utils.lib.core.api as core_utils
import result
from flask import Flask, request
from flask_cors import CORS
from result import Err, Ok, Result

from aiconfig.Config import AIConfigRuntime
from aiconfig.editor.server.server_utils import (
EditServerConfig,
Expand All @@ -25,10 +29,6 @@
)
from aiconfig.model_parser import InferenceOptions
from aiconfig.registry import ModelParserRegistry
from flask import Flask, request
from flask_cors import CORS
from result import Err, Ok, Result

from aiconfig.schema import Prompt

logging.getLogger("werkzeug").disabled = True
Expand Down
6 changes: 4 additions & 2 deletions python/src/aiconfig/editor/server/server_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@

import lastmile_utils.lib.core.api as core_utils
import result
from aiconfig.Config import AIConfigRuntime
from flask import Flask
from pydantic import field_validator
from result import Err, Ok, Result

from aiconfig.Config import AIConfigRuntime

MethodName = NewType("MethodName", str)

logging.getLogger("werkzeug").disabled = True
Expand Down Expand Up @@ -56,8 +57,9 @@ class EditServerConfig(core_utils.Record):
server_port: int = 8080
aiconfig_path: Optional[str] = None
log_level: str | int = "INFO"
server_mode: ServerMode
server_mode: ServerMode = ServerMode.PROD
parsers_module_path: str = "aiconfig_model_registry.py"
server_version: str = "v1"

@field_validator("server_mode", mode="before")
def convert_to_mode(cls, value: Any) -> ServerMode: # pylint: disable=no-self-argument
Expand Down
Loading

0 comments on commit f1bf5d1

Please sign in to comment.