erajasekar
erajasekar
Explore posts from servers
RRailway
Created by erajasekar on 9/21/2024 in #✋|help
Getting CancelledError Python FastAPI application using openai chat completion
I have Python FastAPI application that uses openai's chat completion api with stream. I am getting CancelledError very frequently. I also added timeout middleware with 2 mins timeout and is still same error. The same prompts works fine on my local machine. It's happening only in Railway. I guess may have to tweak some timeout out setting in Railway. I will provide full stack trace below. Please let me know how to resolve it.
CancelledError('Cancelled by cancel scope 7fa0af45f910')Traceback (most recent call last):\n\n\n File \"/usr/local/lib/python3.10/site-packages/langchain_core/language_models/chat_models.py\", line 472, in astream\n async for chunk in self._astream(\n\n\n File \"/usr/local/lib/python3.10/site-packages/langchain_openai/chat_models/base.py\", line 1989, in astream\n async for chunk in super().astream(*args, **kwargs):\n\n\n File \"/usr/local/lib/python3.10/site-packages/langchain_openai/chat_models/base.py\", line 779, in astream\n async for chunk in response:\n\n\n File \"/usr/local/lib/python3.10/site-packages/openai/streaming.py\", line 147, in aiter\n async for item in self._iterator:\n\n\n File \"/usr/local/lib/python3.10/site-packages/openai/_streaming.py\", line 160, in stream\n async for sse in iterator:\n\n\n File \"/usr/local/lib/python3.10/site-packages/openai/_streaming.py\", line 151, in iterevents\n async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()):\n\n\n File \"/usr/local/lib/python3.10/site-packages/openai/_streaming.py
CancelledError('Cancelled by cancel scope 7fa0af45f910')Traceback (most recent call last):\n\n\n File \"/usr/local/lib/python3.10/site-packages/langchain_core/language_models/chat_models.py\", line 472, in astream\n async for chunk in self._astream(\n\n\n File \"/usr/local/lib/python3.10/site-packages/langchain_openai/chat_models/base.py\", line 1989, in astream\n async for chunk in super().astream(*args, **kwargs):\n\n\n File \"/usr/local/lib/python3.10/site-packages/langchain_openai/chat_models/base.py\", line 779, in astream\n async for chunk in response:\n\n\n File \"/usr/local/lib/python3.10/site-packages/openai/streaming.py\", line 147, in aiter\n async for item in self._iterator:\n\n\n File \"/usr/local/lib/python3.10/site-packages/openai/_streaming.py\", line 160, in stream\n async for sse in iterator:\n\n\n File \"/usr/local/lib/python3.10/site-packages/openai/_streaming.py\", line 151, in iterevents\n async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()):\n\n\n File \"/usr/local/lib/python3.10/site-packages/openai/_streaming.py
38 replies
RRailway
Created by erajasekar on 4/6/2023 in #✋|help
Using JSON File as Environment variable in Railway for Firebase
Railway only allows defining environment variables with values inline. But to authenticate with firebase, I need to use a json file like firebase-service-account.json and provide path to this file as value of env variable GOOGLE_APPLICATION_CREDENTIALS . How do I do this in build setup?
37 replies