Skip to content

Commit d0d7d11

Browse files
Merge pull request #13 from IBM/dev/add_models
Add additional Model Runs
2 parents 0ef60d0 + 5ac17ef commit d0d7d11

5 files changed

Lines changed: 1076 additions & 8 deletions

File tree

agents/llm.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,30 @@
1717

1818
logger = logging.getLogger(__name__)
1919

20+
REQUEST_TIMEOUT = float(os.getenv("RITS_REQUEST_TIMEOUT_SECONDS", 60.0))
21+
MAX_RETRIES = int(os.getenv("RITS_MAX_RETRIES", 2))
22+
23+
timeout = httpx.Timeout(
24+
connect=10.0,
25+
read=REQUEST_TIMEOUT,
26+
write=30.0,
27+
pool=10.0,
28+
)
2029

2130
class RITSChatModel(BaseChatModel):
2231
"""LangChain-compatible chat model using httpx for internal RITS inference service."""
2332

2433
# Mapping from endpoint name (short) to payload model name (full)
2534
MODEL_NAME_MAPPING: Dict[str, str] = {
26-
"llama-3-3-70b-instruct": "meta-llama/llama-3-3-70b-instruct",
35+
# Open Source Models
36+
"qwen3-5-397b-a17b-fp8": "Qwen/Qwen3.5-397B-A17B-FP8",
37+
"mistral-large-3-675b-2512-fp4": "mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4",
38+
"glm-5-1": "",
39+
"moonshotai-kimi-k2-5":"moonshotai/Kimi-K2.5",
2740
"gpt-oss-120b": "openai/gpt-oss-120b",
28-
"qwen3-5-397b-a17b-fp8": "qwen/qwen3.5-397B-A17B-FP8",
29-
"mistral-large-3-675b-2512-fp4": "mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4"
41+
# smaller models
42+
"llama-3-3-70b-instruct": "meta-llama/llama-3-3-70b-instruct",
43+
"qwen2-5-72b-instruct": "Qwen/Qwen2.5-72B-Instruct",
3044
}
3145

3246
model_name: str
@@ -125,12 +139,35 @@ async def _agenerate(
125139
if self.bound_tools:
126140
payload["tools"] = self.bound_tools
127141

142+
# Add MAX_RETRIES and timeout handling
143+
# async with httpx.AsyncClient(timeout=timeout) as client:
144+
# for attempt in range(MAX_RETRIES + 1):
145+
# try:
146+
# resp = await client.post(
147+
# url,
148+
# json=payload,
149+
# headers=headers,
150+
# )
151+
# resp.raise_for_status()
152+
# break
153+
154+
# except httpx.ReadTimeout:
155+
# if attempt == MAX_RETRIES:
156+
# raise
157+
# await asyncio.sleep(2 ** attempt)
158+
159+
# except httpx.HTTPError:
160+
# if attempt == MAX_RETRIES:
161+
# raise
162+
# await asyncio.sleep(2 ** attempt)
163+
# data = resp.json()
164+
128165
async with httpx.AsyncClient() as client:
129166
resp = await client.post(
130167
url,
131168
headers=headers,
132169
json=payload,
133-
timeout=60.0
170+
timeout=float(os.environ.get("RITS_REQUEST_TIMEOUT_SECONDS", "60"))
134171
)
135172
resp.raise_for_status()
136173
data = resp.json()

benchmark_runner.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
Results saved to: output/capability_{id}_{timestamp}/<domain>.json
5252
e.g. output/capability_2_feb_18_11_21am/hockey.json
5353
"""
54+
import os
5455
import asyncio
5556
from contextlib import AsyncExitStack
5657
import json
@@ -145,7 +146,7 @@ def _setup_phoenix(endpoint: str, project_name: str = "enterprise-benchmark") ->
145146
Path(__file__).parent / "benchmark" / "mcp_connection_config.yaml"
146147
)
147148
# Timeout for agent execution (seconds)
148-
AGENT_TIMEOUT_SECONDS = 300
149+
AGENT_TIMEOUT_SECONDS = float(os.environ.get("AGENT_TIMEOUT_SECONDS", "300"))
149150

150151

151152
async def run_benchmark_for_domain(
@@ -316,7 +317,7 @@ async def run_benchmark_for_domain(
316317
except Exception as e:
317318
import traceback
318319
result.status = "error"
319-
result.error = str(e)
320+
result.error = f"{type(e).__name__} "+str(e)
320321
tlog(f" Status: error | {type(e).__name__}: {str(e)[:200]}")
321322
tlog(f" Traceback: {traceback.format_exc()}")
322323

@@ -357,6 +358,7 @@ async def run_capability(
357358
top_k_tools: int = 0,
358359
max_iterations: Optional[int] = None,
359360
restart: bool = False,
361+
temperature: float = 0.0,
360362
) -> List[BenchmarkResult]:
361363
"""Run benchmark for a given capability_id, iterating over all domain files."""
362364

@@ -397,7 +399,7 @@ async def run_capability(
397399
tlog(f"Restart mode: skipping {len(completed)} already-completed domain(s): {sorted(completed)}")
398400
domain_list = [d for d in domain_list if d not in completed]
399401

400-
llm = create_llm(provider=provider, model=model)
402+
llm = create_llm(provider=provider, model=model, temperature=temperature)
401403

402404
# Process each domain, writing output incrementally
403405
all_results: List[BenchmarkResult] = []
@@ -553,6 +555,12 @@ def main():
553555
default="enterprise-benchmark",
554556
help="Phoenix project name for grouping traces (default: enterprise-benchmark)",
555557
)
558+
parser.add_argument(
559+
"--temperature",
560+
type=float,
561+
default=0.0,
562+
help="LLM temperature (default: 0.0)"
563+
)
556564

557565
args = parser.parse_args()
558566
capability_ids = args.capability_id # list of ints now
@@ -588,6 +596,7 @@ def _make_run_task_coro(tid: int):
588596
top_k_tools=args.top_k_tools,
589597
max_iterations=args.max_iterations,
590598
restart=args.restart,
599+
temperature=args.temperature
591600
)
592601

593602
def _make_list_tools_coro(tid: int):

evaluator/judge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import re
44
import os
55
import json
6-
import deepcopy
6+
from copy import deepcopy
77
from prompt import GroundednessPrompt, CorrectnessPrompt
88
from utils import JudgeInput, JudgeOutput
99
from langchain_openai import ChatOpenAI

0 commit comments

Comments
 (0)