Skip to content

Commit 9afdadb

Browse files
committed
update
1 parent 21215c6 commit 9afdadb

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

optillm.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ def get_config():
4949
# OpenAI, Azure, or LiteLLM API configuration
5050
if os.environ.get("OPENAI_API_KEY"):
5151
API_KEY = os.environ.get("OPENAI_API_KEY")
52-
default_client = OpenAI(api_key=API_KEY)
52+
base_url = server_config['base_url']
53+
if base_url != "":
54+
default_client = OpenAI(api_key=API_KEY, base_url=base_url)
55+
else:
56+
default_client = OpenAI(api_key=API_KEY)
5357
elif os.environ.get("AZURE_OPENAI_API_KEY"):
5458
API_KEY = os.environ.get("AZURE_OPENAI_API_KEY")
5559
API_VERSION = os.environ.get("AZURE_API_VERSION")

optillm/plugins/router_plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def preprocess_input(tokenizer, system_prompt, initial_query):
7474
)
7575
return encoding['input_ids'], encoding['attention_mask']
7676

77-
def predict_approach(model, input_ids, attention_mask, device, effort=0.8):
77+
def predict_approach(model, input_ids, attention_mask, device, effort=0.7):
7878
model.eval()
7979
with torch.no_grad():
8080
input_ids = input_ids.to(device)
@@ -151,4 +151,4 @@ def run(system_prompt, initial_query, client, model, **kwargs):
151151
{"role": "user", "content": initial_query}
152152
]
153153
)
154-
return response.choices[0].message.content, response.usage.completion_tokens()
154+
return response.choices[0].message.content, response.usage.completion_tokens

0 commit comments

Comments
 (0)