mirror of
https://github.com/NousResearch/atropos.git
synced 2026-04-24 17:04:55 +00:00
Added flag for chat completion, switch in OpenAI client
This commit is contained in:
parent
81534f7c8a
commit
59b08a1aa9
3 changed files with 45 additions and 9 deletions
|
|
@ -24,12 +24,19 @@ class OpenAIServer(APIServer):
|
|||
)
|
||||
super().__init__(config)
|
||||
|
||||
async def check_server_status_task(self):
|
||||
async def check_server_status_task(self, chat_completion: bool = True):
|
||||
while True:
|
||||
try:
|
||||
await self.openai.chat.completions.create(
|
||||
model=self.config.model_name,
|
||||
messages=[{"role": "user", "content": "hi"}],
|
||||
if chat_completion:
|
||||
await self.openai.chat.completions.create(
|
||||
model=self.config.model_name,
|
||||
messages=[{"role": "user", "content": "hi"}],
|
||||
max_tokens=1,
|
||||
)
|
||||
else:
|
||||
await self.openai.completions.create(
|
||||
model=self.config.model_name,
|
||||
prompt="hi",
|
||||
max_tokens=1,
|
||||
)
|
||||
self.server_healthy = True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue