Spaces:
Runtime error
Runtime error
Annikaijak
commited on
Commit
•
08bea6b
1
Parent(s):
787c18f
Upload 4 files
Browse files- .gitignore +1 -0
- Dockerfile +21 -0
- README.md +79 -10
- pyproject.toml +25 -0
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
__pycache__
|
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
CHANGED
@@ -1,10 +1,79 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# bds-pirate-app
|
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 |
+
```
|
pyproject.toml
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[tool.poetry]
|
2 |
+
name = "bds-pirate-app"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = ""
|
5 |
+
authors = ["Your Name <you@example.com>"]
|
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.6.0"
|
16 |
+
pirate-speak = {path = "packages/pirate-speak", develop = true}
|
17 |
+
python-dotenv = "1"
|
18 |
+
langchain-together = "0.0.2"
|
19 |
+
|
20 |
+
[tool.poetry.group.dev.dependencies]
|
21 |
+
langchain-cli = ">=0.0.15"
|
22 |
+
|
23 |
+
[build-system]
|
24 |
+
requires = ["poetry-core"]
|
25 |
+
build-backend = "poetry.core.masonry.api"
|