1- from collections .abc import AsyncIterator
1+ from __future__ import annotations
2+
3+ from typing import TYPE_CHECKING
24
35from openai import APIError , AsyncOpenAI
46
57from shelloracle .providers import Provider , ProviderError , Setting , system_prompt
68
9+ if TYPE_CHECKING :
10+ from collections .abc import AsyncIterator
11+
12+ from shelloracle .config import Configuration
13+
714
815class Deepseek (Provider ):
916 name = "Deepseek"
1017
1118 api_key = Setting (default = "" )
1219 model = Setting (default = "deepseek-chat" )
1320
14- def __init__ (self , * args , ** kwargs ) :
15- super (). __init__ ( * args , ** kwargs )
21+ def __init__ (self , config : Configuration ) -> None :
22+ self . config = config
1623 if not self .api_key :
1724 msg = "No API key provided"
1825 raise ProviderError (msg )
@@ -22,7 +29,10 @@ async def generate(self, prompt: str) -> AsyncIterator[str]:
2229 try :
2330 stream = await self .client .chat .completions .create (
2431 model = self .model ,
25- messages = [{"role" : "system" , "content" : system_prompt }, {"role" : "user" , "content" : prompt }],
32+ messages = [
33+ {"role" : "system" , "content" : system_prompt },
34+ {"role" : "user" , "content" : prompt },
35+ ],
2636 stream = True ,
2737 )
2838 async for chunk in stream :
0 commit comments