diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index fd2d50ecce..4664109842 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -132,7 +132,6 @@ jobs: release: name: Release runs-on: ubuntu-latest - if: "startsWith(github.ref, 'refs/tags/')" needs: [linux, windows, macos, sdist] permissions: contents: write diff --git a/server/continuedev/libs/llm/google_palm_api.py b/server/continuedev/libs/llm/google_palm_api.py index 0249e8f17f..71f15e156e 100644 --- a/server/continuedev/libs/llm/google_palm_api.py +++ b/server/continuedev/libs/llm/google_palm_api.py @@ -31,7 +31,9 @@ async def _stream_complete(self, prompt, options): api_url = f"https://generativelanguage.googleapis.com/v1beta2/models/{self.model}:generateMessage?key={self.api_key}" body = {"prompt": {"messages": [{"content": prompt}]}} response = requests.post(api_url, json=body) - yield response.json()["candidates"][0]["content"] + data = response.json() + if "candidates" in data: + yield data["candidates"][0]["content"] async def _stream_chat(self, messages: List[ChatMessage], options): msg_lst = [] @@ -41,6 +43,8 @@ async def _stream_chat(self, messages: List[ChatMessage], options): api_url = f"https://generativelanguage.googleapis.com/v1beta2/models/{self.model}:generateMessage?key={self.api_key}" body = {"prompt": {"messages": msg_lst}} response = requests.post(api_url, json=body) - yield ChatMessage( - role="assistant", content=response.json()["candidates"][0]["content"] - ) + data = response.json() + if "candidates" in data: + yield ChatMessage( + role="assistant", content=data["candidates"][0]["content"] + ) \ No newline at end of file