diff --git a/Readme.md b/Readme.md index 29ee7d6..a8f4ec1 100644 --- a/Readme.md +++ b/Readme.md @@ -52,9 +52,12 @@ Run your LangCorn FastAPI server: langcorn server examples.ex1:chain -[INFO] 2023-04-14 23:28:57.52 | api:create_service:81 | Endpoint: /docs -[INFO] 2023-04-14 23:28:57.52 | api:create_service:81 | Endpoint: /examples.ex1/run -INFO: Started server process [87033] +[INFO] 2023-04-18 14:34:56.32 | api:create_service:75 | Creating service +[INFO] 2023-04-18 14:34:57.51 | api:create_service:85 | lang_app='examples.ex1:chain':LLMChain(['product']) +[INFO] 2023-04-18 14:34:57.51 | api:create_service:104 | Serving +[INFO] 2023-04-18 14:34:57.51 | api:create_service:106 | Endpoint: /docs +[INFO] 2023-04-18 14:34:57.51 | api:create_service:106 | Endpoint: /examples.ex1/run +INFO: Started server process [27843] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:8718 (Press CTRL+C to quit) @@ -73,11 +76,14 @@ Run multiple chains python -m langcorn server examples.ex1:chain examples.ex2:chain - -[INFO] 2023-04-14 23:28:57.52 | api:create_service:81 | Endpoint: /docs -[INFO] 2023-04-14 23:28:57.52 | api:create_service:81 | Endpoint: /examples.ex1/run -[INFO] 2023-04-14 23:28:57.52 | api:create_service:81 | Endpoint: /examples.ex2/run -INFO: Started server process [87033] +[INFO] 2023-04-18 14:35:21.11 | api:create_service:75 | Creating service +[INFO] 2023-04-18 14:35:21.82 | api:create_service:85 | lang_app='examples.ex1:chain':LLMChain(['product']) +[INFO] 2023-04-18 14:35:21.82 | api:create_service:85 | lang_app='examples.ex2:chain':SimpleSequentialChain(['input']) +[INFO] 2023-04-18 14:35:21.82 | api:create_service:104 | Serving +[INFO] 2023-04-18 14:35:21.82 | api:create_service:106 | Endpoint: /docs +[INFO] 2023-04-18 14:35:21.82 | api:create_service:106 | Endpoint: /examples.ex1/run +[INFO] 2023-04-18 14:35:21.82 | api:create_service:106 | Endpoint: /examples.ex2/run +INFO: Started server process [27863] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://127.0.0.1:8718 (Press CTRL+C to quit) @@ -112,6 +118,11 @@ uvicorn main:app --host 0.0.0.0 --port 8000 Now, your LangChain models and pipelines are accessible via the LangCorn API server. +## Docs + +Automatically served FastAPI doc +![](https://res.cloudinary.com/dq0w2rtm9/image/upload/c_pad,b_auto:predominant,fl_preserve_transparency/v1681817836/Screen_Shot_2023-04-18_at_14.36.00_ms2thb.jpg?_s=public-apps) + ## Auth It possible to add a static api token auth by specifying `auth_token` diff --git a/langcorn/server/api.py b/langcorn/server/api.py index ddeb3bc..08938f7 100644 --- a/langcorn/server/api.py +++ b/langcorn/server/api.py @@ -80,14 +80,13 @@ def create_service(*lc_apps, auth_token: str = ""): for lang_app in lc_apps: chain = import_from_string(lang_app) - logger.info(f"{lang_app=}") - logger.info(f"{chain=}") inn, out = derive_fields(chain) - logger.info(f"{inn=}") + logger.debug(f"inputs:{inn=}") + logger.info(f"{lang_app=}:{chain.__class__.__name__}({inn})") endpoint_prefix = lang_app.split(":")[0] cls_name = "".join([c.capitalize() for c in endpoint_prefix.split(".")]) request_cls = derive_class(cls_name, inn) - logger.info(f"{request_cls=}") + logger.debug(f"{request_cls=}") endpoints.append(f"/{endpoint_prefix}/run") # avoid hoisting issues with handler(request) diff --git a/pyproject.toml b/pyproject.toml index c2e1325..b90c9ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "langcorn" -version = "0.0.4" +version = "0.0.5" description = "A Python package creating rest api interface for LangChain" authors = ["Alexander Miasoiedov "] maintainers = [