Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
semio committed Jan 20, 2025
1 parent dc3a233 commit f7926fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
9 changes: 7 additions & 2 deletions automation-api/lib/llm/alibaba_batch_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
logger = AppSingleton().get_logger()
logger.setLevel(logging.DEBUG)

read_config() # FIXME: maybe I should read config in application code, not lib code.
client = OpenAI(base_url="https://dashscope.aliyuncs.com/compatible-mode/v1")
config = (
read_config()
) # FIXME: maybe I should read config in application code, not lib code.
api_key = config["DASHSCOPE_API_KEY"]
client = OpenAI(
api_key=api_key, base_url="https://dashscope.aliyuncs.com/compatible-mode/v1"
)

# Statuses that indicate the batch is still processing
PROCESSING_STATUSES = {"validating", "in_progress", "finalizing"}
Expand Down
2 changes: 1 addition & 1 deletion automation-api/lib/pilot/generate_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
EVALUATORS: List[str] = [
"vertex_ai/gemini-1.5-pro-002",
"gpt-4o-2024-11-20",
"anthropic/claude-3-5-sonnet-202401022",
"anthropic/claude-3-5-sonnet-20241022",
]


Expand Down
8 changes: 4 additions & 4 deletions automation-api/lib/pilot/generate_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ def convert_to_jsonl_openai(
request_body = {
"model": model,
"messages": [
{"role": "user", "content": row["question_prompt_text"]},
{"role": "user", "content": row["prompt_text"]},
],
"max_tokens": max_tokens,
"temperature": temperature,
}

request_obj = {
"custom_id": f"{id_prefix}{row['question_prompt_id']}",
"custom_id": f"{id_prefix}{row['prompt_id']}",
"method": "POST",
"url": "/v1/chat/completions",
"body": request_body,
Expand Down Expand Up @@ -228,7 +228,7 @@ def convert_to_jsonl_vertex(
"contents": [
{
"role": "user",
"parts": [{"text": row["question_prompt_text"]}],
"parts": [{"text": row["prompt_text"]}],
}
],
"generationConfig": {
Expand Down Expand Up @@ -303,7 +303,7 @@ def convert_to_jsonl_vertex(
# Generate question-prompt combinations
question_prompts = generate_question_prompt_combinations(
combined_questions, prompt_template_variations
).rename({"question_prompt_id": "prompt_id", "question_prompt_text": "prompt_text"})
)

# Find and validate model configuration
model_config = model_configurations.filter(
Expand Down

0 comments on commit f7926fc

Please sign in to comment.