Skip to content

Commit

Permalink
Add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
nik committed Feb 20, 2024
1 parent cdbca09 commit 161c624
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 6 additions & 1 deletion adala/runtimes/_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,14 +439,19 @@ async def batch_to_batch(
)

# parse responses, optionally match it with options
for response in responses:
for prompt, response in zip(prompts, responses):

# check for errors - if any, append to outputs and continue
if response.get("error"):
outputs.append(response)
if self.verbose:
print_error(f"Prompt: {prompt}\nOpenAI API error: {response}")
continue

# otherwise, append the response to outputs
completion_text = response["text"]
if self.verbose:
print(f"Prompt: {prompt}\nOpenAI API response: {completion_text}")
if name in options:
completion_text = match_options(completion_text, options[name])
outputs.append({name: completion_text, "index": response["index"]})
Expand Down
5 changes: 3 additions & 2 deletions adala/server/ui/src/adala.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ export class Adala {
type: "AsyncOpenAIChatRuntime",
model: req.model,
api_key: req.apiKey,
max_tokens: 50,
max_tokens: 10,
temperature: 0,
concurrent_clients: 100,
batch_size: 100,
timeout: 1
timeout: 10,
verbose: false
}
}
},
Expand Down

0 comments on commit 161c624

Please sign in to comment.