Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
biobootloader committed Mar 8, 2024
1 parent a53ceff commit 4ae3272
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions spice.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from dotenv import load_dotenv
from openai import OpenAI

load_dotenv()


class SpiceClient:
Expand All @@ -17,7 +18,6 @@ def __init__(self, model):

self.model = model

load_dotenv()
if self._provider == "openai":
self._client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
elif self._provider == "anthropic":
Expand Down Expand Up @@ -64,5 +64,6 @@ def _stream_generator(self, stream):
content = chunk.delta.text
else:
content = chunk.choices[0].delta.content
if content is not None:
yield content
if content is None:
content = ""
yield content

0 comments on commit 4ae3272

Please sign in to comment.