diff --git a/.gitignore b/.gitignore index 922c02725..044df5024 100644 --- a/.gitignore +++ b/.gitignore @@ -159,3 +159,4 @@ cython_debug/ # and can be added to the global gitignore or merged into this file. For a more nuclear # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +examples/citation_with_extraction/fly.toml diff --git a/examples/citation_with_extraction/Dockerfile b/examples/citation_with_extraction/Dockerfile new file mode 100644 index 000000000..afc18e1da --- /dev/null +++ b/examples/citation_with_extraction/Dockerfile @@ -0,0 +1,14 @@ +# https://hub.docker.com/_/python +FROM python:3.10-slim-bullseye + +ENV PYTHONUNBUFFERED True +ENV APP_HOME /app +WORKDIR $APP_HOME +COPY requirements.txt ./ +RUN pip install -r requirements.txt + + +COPY . ./ + + +CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"] \ No newline at end of file diff --git a/examples/citation_with_extraction/main.py b/examples/citation_with_extraction/main.py index 1c8b6d1a9..711ac10e9 100644 --- a/examples/citation_with_extraction/main.py +++ b/examples/citation_with_extraction/main.py @@ -8,7 +8,9 @@ import os import openai +import logging +logger = logging.getLogger(__name__) # FastAPI app app = FastAPI( @@ -116,6 +118,7 @@ async def extract(question: Question, openai_key=Depends(get_api_key)): async def generate(): for fact in facts: + logger.info(f"Fact: {fact}") spans = list(fact.get_spans(question.context)) resp = { "body": fact.body, diff --git a/examples/citation_with_extraction/requirements.txt b/examples/citation_with_extraction/requirements.txt index e62c77e40..b8b085404 100644 --- a/examples/citation_with_extraction/requirements.txt +++ b/examples/citation_with_extraction/requirements.txt @@ -2,4 +2,5 @@ fastapi uvicorn openai pydantic -openai_function_call \ No newline at end of file +openai_function_call +regex \ No newline at end of file