I am trying to use the tool lanchain and langserver, and create a api from a template. Steps I took:
- create server template
langchain app new my-app --package rag-conversation
- copy in the code provided in the cmd after the installation is ready
@app.get("/")
async def redirect_root_to_docs():
return RedirectResponse("/docs")
add_routes(app, rag_conversation_chain, path="/rag-conversation")
- cd into my-app folder and run
langchain servein the cmd.
After which the server cant seem to start and throws this error
INFO: Will watch for changes in these directories:
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [10212] using WatchFiles
ERROR: Error loading ASGI app. Could not import module "app.server".
Does anyone know how to aproach this issue. There is no -v command option so this is all the information I have to go by.
The project structure is the following:
this shows that app does contain the server file.
and the server file has the follwing information inside:
from fastapi import FastAPI
from fastapi.responses import RedirectResponse
from langserve import add_routes
from rag_conversation import chain as rag_conversation_chain
app = FastAPI()
@app.get("/")
async def redirect_root_to_docs():
return RedirectResponse("/docs")
add_routes(app, rag_conversation_chain, path="/rag-conversation")
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
If you know a solution for this issue please be descriptive, I have found some people encountering something similar a few months ago,https://github.com/langchain-ai/opengpts/issues/61, but there they were talking about some dependency issue and requirements.txt of which I can't even find in my app structure.
