From 95936798d15c415d1dab5e660dfbd5584401bcbc Mon Sep 17 00:00:00 2001 From: Tyler Perkins Date: Mon, 12 Jun 2023 17:32:47 -0400 Subject: [PATCH] Base project --- src/__init__.py | 0 src/main.py | 8 ++++++++ src/requirements.txt | 37 +++++++++++++++++++++++++++++++++++++ src/routers/__init__.py | 0 src/routers/question.py | 25 +++++++++++++++++++++++++ 5 files changed, 70 insertions(+) create mode 100644 src/__init__.py create mode 100644 src/main.py create mode 100644 src/requirements.txt create mode 100644 src/routers/__init__.py create mode 100644 src/routers/question.py diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/main.py b/src/main.py new file mode 100644 index 0000000..73f7a4a --- /dev/null +++ b/src/main.py @@ -0,0 +1,8 @@ +from fastapi import FastAPI + +from routers import question + +app = FastAPI() + +app.include_router(question.router) + diff --git a/src/requirements.txt b/src/requirements.txt new file mode 100644 index 0000000..39dd496 --- /dev/null +++ b/src/requirements.txt @@ -0,0 +1,37 @@ +aiohttp==3.8.4 +aiosignal==1.3.1 +anyio==3.7.0 +async-timeout==4.0.2 +attrs==23.1.0 +certifi==2023.5.7 +charset-normalizer==3.1.0 +click==8.1.3 +dataclasses-json==0.5.8 +exceptiongroup==1.1.1 +fastapi==0.97.0 +frozenlist==1.3.3 +greenlet==2.0.2 +h11==0.14.0 +idna==3.4 +langchain==0.0.198 +langchainplus-sdk==0.0.8 +marshmallow==3.19.0 +marshmallow-enum==1.5.1 +multidict==6.0.4 +mypy-extensions==1.0.0 +numexpr==2.8.4 +numpy==1.24.3 +openapi-schema-pydantic==1.2.4 +packaging==23.1 +pydantic==1.10.9 +PyYAML==6.0 +requests==2.31.0 +sniffio==1.3.0 +SQLAlchemy==2.0.16 +starlette==0.27.0 +tenacity==8.2.2 +typing-inspect==0.9.0 +typing_extensions==4.6.3 +urllib3==2.0.3 +uvicorn==0.22.0 +yarl==1.9.2 diff --git a/src/routers/__init__.py b/src/routers/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/routers/question.py b/src/routers/question.py new file mode 100644 index 0000000..e506754 --- /dev/null +++ b/src/routers/question.py @@ -0,0 +1,25 @@ +from fastapi import APIRouter +from pydantic import BaseModel + +router = APIRouter( + prefix="/question", + tags=["question"], + responses={404: {"description": "Not found"}} + ) + +class Question(BaseModel): + question: str + max_response: int = 128 + +@router.post("/") +async def ask_question(question: Question): + return {"message": f"Hello question! {question.question}"} + +@router.post("/{conversation_id}}") +async def ask_question(question: Question, conversation_id: str): + return {"message": f"Hello question {conversation_id}!"} + +@router.get("/{conversation_id}}") +async def get_question_history(conversation_id: str): + return {"message": f"Hello question {conversation_id}!"} +