Exception Handling and HTTP Responses in the case of Exception #433
Unanswered
mesutgurlek
asked this question in
Q&A
Replies: 1 comment 4 replies
-
Hi @mesutgurlek, It's not important whether the code is in different files or the same. What information do you need to return? If it's just a more detailed error message, take a look at Fast API documentation here: You can raise that exception to provide an error message to the client. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I am trying to build a langchain api using the langserve and I have followed the tutorial: https://github.com/langchain-ai/langserve/blob/main/examples/chat_with_persistence/server.py
I have modified the example, and reorganized the project structure with langchain project structure using langchain-cli.
Below is the project structure:
In this case when I have an exception in the llm_chain.py, than I want to return an HTTP Response with an Error code. However, in the initial tutorial, it is a single file that contains both the chain object and FastAPI endpoint. In my case, modules are separated, and I could not find any example about how to return a HTTP Response when I got an exception in the custom package which provides the chain object.
Could you provide any kind of use case / tutorial / example ?
Beta Was this translation helpful? Give feedback.
All reactions