austinbv commited on
Commit
59bc1bb
·
0 Parent(s):

Initial Commit

Browse files
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ __pycache__
.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
.idea/inspectionProfiles/Project_Default.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ </profile>
6
+ </component>
.idea/inspectionProfiles/profiles_settings.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <component name="InspectionProjectProfileManager">
2
+ <settings>
3
+ <option name="USE_PROJECT_PROFILE" value="false" />
4
+ <version value="1.0" />
5
+ </settings>
6
+ </component>
.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="Poetry (pdf_rag)" project-jdk-type="Python SDK" />
4
+ </project>
.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/pdf_rag.iml" filepath="$PROJECT_DIR$/.idea/pdf_rag.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
.idea/pdf_rag.iml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="PYTHON_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
+ </component>
6
+ </project>
Dockerfile ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ RUN pip install poetry==1.6.1
4
+
5
+ RUN poetry config virtualenvs.create false
6
+
7
+ WORKDIR /code
8
+
9
+ COPY ./pyproject.toml ./README.md ./poetry.lock* ./
10
+
11
+ COPY ./package[s] ./packages
12
+
13
+ RUN poetry install --no-interaction --no-ansi --no-root
14
+
15
+ COPY ./app ./app
16
+
17
+ RUN poetry install --no-interaction --no-ansi
18
+
19
+ EXPOSE 8080
20
+
21
+ CMD exec uvicorn app.server:app --host 0.0.0.0 --port 8080
README.md ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # pdf_rag
2
+
3
+ ## Installation
4
+
5
+ Install the LangChain CLI if you haven't yet
6
+
7
+ ```bash
8
+ pip install -U langchain-cli
9
+ ```
10
+
11
+ ## Adding packages
12
+
13
+ ```bash
14
+ # adding packages from
15
+ # https://github.com/langchain-ai/langchain/tree/master/templates
16
+ langchain app add $PROJECT_NAME
17
+
18
+ # adding custom GitHub repo packages
19
+ langchain app add --repo $OWNER/$REPO
20
+ # or with whole git string (supports other git providers):
21
+ # langchain app add git+https://github.com/hwchase17/chain-of-verification
22
+
23
+ # with a custom api mount point (defaults to `/{package_name}`)
24
+ langchain app add $PROJECT_NAME --api_path=/my/custom/path/rag
25
+ ```
26
+
27
+ Note: you remove packages by their api path
28
+
29
+ ```bash
30
+ langchain app remove my/custom/path/rag
31
+ ```
32
+
33
+ ## Setup LangSmith (Optional)
34
+ LangSmith will help us trace, monitor and debug LangChain applications.
35
+ LangSmith is currently in private beta, you can sign up [here](https://smith.langchain.com/).
36
+ If you don't have access, you can skip this section
37
+
38
+
39
+ ```shell
40
+ export LANGCHAIN_TRACING_V2=true
41
+ export LANGCHAIN_API_KEY=<your-api-key>
42
+ export LANGCHAIN_PROJECT=<your-project> # if not specified, defaults to "default"
43
+ ```
44
+
45
+ ## Launch LangServe
46
+
47
+ ```bash
48
+ langchain serve
49
+ ```
50
+
51
+ ## Running in Docker
52
+
53
+ This project folder includes a Dockerfile that allows you to easily build and host your LangServe app.
54
+
55
+ ### Building the Image
56
+
57
+ To build the image, you simply:
58
+
59
+ ```shell
60
+ docker build . -t my-langserve-app
61
+ ```
62
+
63
+ If you tag your image with something other than `my-langserve-app`,
64
+ note it for use in the next step.
65
+
66
+ ### Running the Image Locally
67
+
68
+ To run the image, you'll need to include any environment variables
69
+ necessary for your application.
70
+
71
+ In the below example, we inject the `OPENAI_API_KEY` environment
72
+ variable with the value set in my local environment
73
+ (`$OPENAI_API_KEY`)
74
+
75
+ We also expose port 8080 with the `-p 8080:8080` option.
76
+
77
+ ```shell
78
+ docker run -e OPENAI_API_KEY=$OPENAI_API_KEY -p 8080:8080 my-langserve-app
79
+ ```
app/__init__.py ADDED
File without changes
app/server.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from fastapi.responses import RedirectResponse
3
+ from langserve import add_routes
4
+
5
+ app = FastAPI()
6
+
7
+
8
+ @app.get("/")
9
+ async def redirect_root_to_docs():
10
+ return RedirectResponse("/docs")
11
+
12
+
13
+ # Edit this to add the chain you want to add
14
+ add_routes(app, NotImplemented)
15
+
16
+ if __name__ == "__main__":
17
+ import uvicorn
18
+
19
+ uvicorn.run(app, host="0.0.0.0", port=8000)
packages/README.md ADDED
File without changes
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "pdf_rag"
3
+ version = "0.1.0"
4
+ description = ""
5
+ authors = ["Your Name <[email protected]>"]
6
+ readme = "README.md"
7
+ packages = [
8
+ { include = "app" },
9
+ ]
10
+
11
+ [tool.poetry.dependencies]
12
+ python = "^3.11"
13
+ uvicorn = "^0.23.2"
14
+ langserve = {extras = ["server"], version = ">=0.0.30"}
15
+ pydantic = "<2"
16
+
17
+
18
+ [tool.poetry.group.dev.dependencies]
19
+ langchain-cli = ">=0.0.15"
20
+
21
+ [build-system]
22
+ requires = ["poetry-core"]
23
+ build-backend = "poetry.core.masonry.api"