Base project
This commit is contained in:
parent
7bc2a04597
commit
95936798d1
0
src/__init__.py
Normal file
0
src/__init__.py
Normal file
8
src/main.py
Normal file
8
src/main.py
Normal file
@ -0,0 +1,8 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
from routers import question
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.include_router(question.router)
|
||||
|
37
src/requirements.txt
Normal file
37
src/requirements.txt
Normal file
@ -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
|
0
src/routers/__init__.py
Normal file
0
src/routers/__init__.py
Normal file
25
src/routers/question.py
Normal file
25
src/routers/question.py
Normal file
@ -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}!"}
|
||||
|
Loading…
Reference in New Issue
Block a user