Skip to content

Commit

Permalink
Upgrades packages and makde import changes. Initial docker file for l…
Browse files Browse the repository at this point in the history
…angchain.

Ref #25
  • Loading branch information
shant01 committed Nov 14, 2023
1 parent ba0fab5 commit 5384fc4
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ node_modules/
data/

## ignore OS turds
.env
.DS_Store
.vscode
17 changes: 17 additions & 0 deletions langchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Use an official Python runtime as a parent image
FROM python:3.9-slim

# Set the working directory in the container
WORKDIR /app

# Copy the current directory contents into the container at /app
COPY . /app

# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Make port 80 available to the world outside this container
EXPOSE 80

# Run main.py when the container launches
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "80"]
Empty file added langchain/__init__.py
Empty file.
4 changes: 3 additions & 1 deletion langchain/app/langchain_agent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#Logic for langchain
#Import requirements
from langchain import OpenAI, ConversationChain, LLMChain, PromptTemplate
from langchain.llms import OpenAI
from langchain.chains import LLMChain
from langchain.prompts import PromptTemplate

#Load in the enviroment variables
from dotenv import load_dotenv
Expand Down
4 changes: 3 additions & 1 deletion langchain/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class Output(BaseModel):

#origins for localhost
origins = [
"http://localhost:3000",
"localhost:3000"
"<http://localhost>",
"<http://localhost:5050>"
]
Expand All @@ -33,4 +35,4 @@ class Output(BaseModel):
@app.post("/process-lang")
async def input(input: InputData): #Take in the Inputdata string as param
output = Output(output=conversation(input.human_input)) #calls conversation function from langchain_agent
return output #returns output
return output #returns outpu

0 comments on commit 5384fc4

Please sign in to comment.