FastApiAssistant #2
| @@ -14,6 +14,8 @@ RUN poetry install  --no-interaction --no-ansi --no-root | |||||||
|  |  | ||||||
| COPY ./app ./app | COPY ./app ./app | ||||||
|  |  | ||||||
|  | RUN pip3 install -r ./app/requirements.txt | ||||||
|  |  | ||||||
| RUN poetry install --no-interaction --no-ansi | RUN poetry install --no-interaction --no-ansi | ||||||
|  |  | ||||||
| EXPOSE 8080 | EXPOSE 8080 | ||||||
|   | |||||||
| @@ -1,9 +1,13 @@ | |||||||
| from fastapi import FastAPI | from fastapi import FastAPI | ||||||
| from fastapi.responses import RedirectResponse | from fastapi.responses import RedirectResponse | ||||||
|  | from langchain.chat_models import ChatOpenAI | ||||||
| from langserve import add_routes | from langserve import add_routes | ||||||
|  |  | ||||||
| app = FastAPI() | app = FastAPI() | ||||||
|  | llm = ChatOpenAI( | ||||||
|  |     model="gpt-4o-mini", | ||||||
|  |     temperature=0.9 | ||||||
|  | ) | ||||||
|  |  | ||||||
| @app.get("/") | @app.get("/") | ||||||
| async def redirect_root_to_docs(): | async def redirect_root_to_docs(): | ||||||
| @@ -11,7 +15,11 @@ async def redirect_root_to_docs(): | |||||||
|  |  | ||||||
|  |  | ||||||
| # Edit this to add the chain you want to add | # Edit this to add the chain you want to add | ||||||
| add_routes(app, NotImplemented) | add_routes( | ||||||
|  |     app, | ||||||
|  |     llm, | ||||||
|  |     path="/openai" | ||||||
|  | ) | ||||||
|  |  | ||||||
| if __name__ == "__main__": | if __name__ == "__main__": | ||||||
|     import uvicorn |     import uvicorn | ||||||
|   | |||||||
							
								
								
									
										1159
									
								
								poetry.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										1159
									
								
								poetry.lock
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user