Dataset Viewer
Auto-converted to Parquet Duplicate
repo_id
stringclasses
155 values
entity_id
stringlengths
5
331
uri
stringlengths
27
361
kind
stringclasses
4 values
name
stringlengths
1
295
path
stringlengths
5
130
language
stringclasses
1 value
start_line
int32
1
27k
end_line
int32
1
27k
context_start_line
int32
1
26.9k
context_end_line
int32
1
27k
code
stringlengths
0
20k
source_hash
stringlengths
64
64
truncated
bool
2 classes
AgentLab
py:main
program://AgentLab/module/main#L1-L74
module
main
main.py
python
1
74
1
74
""" Note: This script is a convenience script to launch experiments instead of using the command line. Copy this script and modify at will, but don't push your changes to the repository. """ import logging from agentlab.agents.generic_agent import ( AGENT_LLAMA3_70B, AGENT_LLAMA31_70B, RANDOM_SEARCH_AGEN...
cf52282bd08c6ac5ba93fcfc1ccacc25b04c07ed59f1f8a8ad630906d8499366
false
AgentLab
py:main_workarena_debug
program://AgentLab/module/main_workarena_debug#L1-L77
module
main_workarena_debug
main_workarena_debug.py
python
1
77
1
77
""" Note: This script is a convenience script to launch experiments instead of using the command line. Copy this script and modify at will, but don't push your changes to the repository. """ import logging from copy import deepcopy import bgym from agentlab.agents.tool_use_agent.tool_use_agent import ( DEFAULT_...
92a99e0d2b6b2fb8c18fb1060abf2c17ba8d9a100132f242959c7fb8ac18a4d8
false
AgentLab
py:add_study_to_repro_journal
program://AgentLab/module/add_study_to_repro_journal#L1-L18
module
add_study_to_repro_journal
add_study_to_repro_journal.py
python
1
18
1
18
import os from pathlib import Path from agentlab.experiments.study import Study base_dir = "/home/toolkit/ui_copilot_results" exp_paths = [ "2025-01-31_22-08-34_genericagent-o3-mini-2025-01-31-on-workarena-l1", # '2025-02-02_01-53-45_genericagent-openai-o1-mini-2024-09-12-on-workarena-l1', "2025-02-02_0...
dc9b4b94f8f744a3656b875dd287be370af8551604785b276bd041bd6ba5b408
false
AgentLab
py:tests.test_main
program://AgentLab/module/tests.test_main#L1-L28
module
tests.test_main
tests/test_main.py
python
1
28
1
28
import subprocess import sys from pathlib import Path import pytest @pytest.mark.pricy def test_main_script_execution(): # this should trigger agent_4o_mini on miniwob_tiny_test unless this was # reconfigured differently. path = Path(__file__).parent.parent / "main.py" sys.path.insert(0, str(path.pa...
1c339f46889f59d74a302b20ab4529bc84b49bcb05ef73f1d278f62ac5758348
false
AgentLab
py:tests.test_main.test_main_script_execution
program://AgentLab/function/tests.test_main.test_main_script_execution#L9-L24
function
test_main_script_execution
tests/test_main.py
python
9
24
1
28
import subprocess import sys from pathlib import Path import pytest @pytest.mark.pricy def test_main_script_execution(): # this should trigger agent_4o_mini on miniwob_tiny_test unless this was # reconfigured differently. path = Path(__file__).parent.parent / "main.py" sys.path.insert(0, str(path.pa...
1c339f46889f59d74a302b20ab4529bc84b49bcb05ef73f1d278f62ac5758348
false
AgentLab
py:tests.test_ui_assistant
program://AgentLab/module/tests.test_ui_assistant#L1-L9
module
tests.test_ui_assistant
tests/test_ui_assistant.py
python
1
9
1
9
from agentlab.ui_assistant import make_exp_args from agentlab.agents.generic_agent import AGENT_4o def test_make_exp_args(): """Basic unit test to detect refactoring errors.""" exp_args = make_exp_args(AGENT_4o, "https://www.google.com") assert exp_args.agent_args.flags.action.demo_mode == "default"
3a084bf5c64c372102deec1fae59a53a3c7f99ae7b2bb77735960cb40568a15a
false
AgentLab
py:tests.test_ui_assistant.test_make_exp_args
program://AgentLab/function/tests.test_ui_assistant.test_make_exp_args#L5-L9
function
test_make_exp_args
tests/test_ui_assistant.py
python
5
9
1
9
from agentlab.ui_assistant import make_exp_args from agentlab.agents.generic_agent import AGENT_4o def test_make_exp_args(): """Basic unit test to detect refactoring errors.""" exp_args = make_exp_args(AGENT_4o, "https://www.google.com") assert exp_args.agent_args.flags.action.demo_mode == "default"
3a084bf5c64c372102deec1fae59a53a3c7f99ae7b2bb77735960cb40568a15a
false
AgentLab
py:tests.verify_rate_limit_anthropic
program://AgentLab/module/tests.verify_rate_limit_anthropic#L1-L89
module
tests.verify_rate_limit_anthropic
tests/verify_rate_limit_anthropic.py
python
1
89
1
89
import os import time from concurrent.futures import ThreadPoolExecutor, as_completed import anthropic client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]) def make_request(messages): response = client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=10, messages=messages...
a74fab2ec054dffa24e51f8b972c405769daca2f4af30651e2c9a3b558a387d8
false
AgentLab
py:tests.verify_rate_limit_anthropic.make_request
program://AgentLab/function/tests.verify_rate_limit_anthropic.make_request#L10-L14
function
make_request
tests/verify_rate_limit_anthropic.py
python
10
14
1
34
import os import time from concurrent.futures import ThreadPoolExecutor, as_completed import anthropic client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]) def make_request(messages): response = client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=10, messages=messages...
a74fab2ec054dffa24e51f8b972c405769daca2f4af30651e2c9a3b558a387d8
false
AgentLab
py:tests.verify_rate_limit_anthropic.make_message
program://AgentLab/function/tests.verify_rate_limit_anthropic.make_message#L17-L26
function
make_message
tests/verify_rate_limit_anthropic.py
python
17
26
1
46
import os import time from concurrent.futures import ThreadPoolExecutor, as_completed import anthropic client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"]) def make_request(messages): response = client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=10, messages=messages...
a74fab2ec054dffa24e51f8b972c405769daca2f4af30651e2c9a3b558a387d8
false
AgentLab
py:tests.verify_rate_limit_anthropic.add_cache_control
program://AgentLab/function/tests.verify_rate_limit_anthropic.add_cache_control#L29-L30
function
add_cache_control
tests/verify_rate_limit_anthropic.py
python
29
30
9
50
def make_request(messages): response = client.messages.create( model="claude-3-5-sonnet-20241022", max_tokens=10, messages=messages ) return response.usage def make_message(text): return { "role": "user", "content": [ { "type": "text", ...
a74fab2ec054dffa24e51f8b972c405769daca2f4af30651e2c9a3b558a387d8
false
AgentLab
py:tests.verify_rate_limit_anthropic.remove_cache_control
program://AgentLab/function/tests.verify_rate_limit_anthropic.remove_cache_control#L33-L35
function
remove_cache_control
tests/verify_rate_limit_anthropic.py
python
33
35
13
55
) return response.usage def make_message(text): return { "role": "user", "content": [ { "type": "text", "text": text, } ], } def add_cache_control(message: dict, cache_type="ephemeral"): message["content"][0]["cache_...
a74fab2ec054dffa24e51f8b972c405769daca2f4af30651e2c9a3b558a387d8
false
AgentLab
py:tests.verify_rate_limit_anthropic.test_rate_limit_single
program://AgentLab/function/tests.verify_rate_limit_anthropic.test_rate_limit_single#L38-L63
function
test_rate_limit_single
tests/verify_rate_limit_anthropic.py
python
38
63
18
83
return { "role": "user", "content": [ { "type": "text", "text": text, } ], } def add_cache_control(message: dict, cache_type="ephemeral"): message["content"][0]["cache_control"] = {"type": cache_type} def remove_cache_contro...
a74fab2ec054dffa24e51f8b972c405769daca2f4af30651e2c9a3b558a387d8
false
AgentLab
py:tests.verify_rate_limit_anthropic.test_rate_limit_parallel
program://AgentLab/function/tests.verify_rate_limit_anthropic.test_rate_limit_parallel#L66-L76
function
test_rate_limit_parallel
tests/verify_rate_limit_anthropic.py
python
66
76
46
89
messages = [] # Add all previous conversation turns for i in range(5): if i == 0: messages.append(make_message(big_text)) t0 = time.time() else: messages.append(make_message(medium_text)) add_cache_control(messages[-1]) try: us...
a74fab2ec054dffa24e51f8b972c405769daca2f4af30651e2c9a3b558a387d8
false
AgentLab
py:tests.verify_rate_limit_anthropic.test_rate_limit
program://AgentLab/function/tests.verify_rate_limit_anthropic.test_rate_limit#L79-L81
function
test_rate_limit
tests/verify_rate_limit_anthropic.py
python
79
81
59
89
print(f"{dt:.2f}: Thread {thread_id}: {usage}") except Exception as e: print(f"Thread {thread_id}: Error - {e}") break remove_cache_control(messages[-1]) def test_rate_limit_parallel(num_threads=3): print(f"Starting parallel rate limit test with {num_threads} th...
a74fab2ec054dffa24e51f8b972c405769daca2f4af30651e2c9a3b558a387d8
false
AgentLab
py:tests.analyze.test_overlay_utils
program://AgentLab/module/tests.analyze.test_overlay_utils#L1-L81
module
tests.analyze.test_overlay_utils
tests/analyze/test_overlay_utils.py
python
1
81
1
81
from PIL import Image from agentlab.analyze import overlay_utils def test_parse_function_calls(): test_code = """ mouse_click(34, 59) fill("a234", "test") click('b123', button="right", modifiers=["Shift", "Control"]) select_option("c456", ["option1", "option2"]) """ result = overlay_utils.parse_function_ca...
9cc9b9688d8e5c68972d712ecf778467e597d4632f32b2585c4ee95da238a7e1
false
AgentLab
py:tests.analyze.test_overlay_utils.test_parse_function_calls
program://AgentLab/function/tests.analyze.test_overlay_utils.test_parse_function_calls#L6-L23
function
test_parse_function_calls
tests/analyze/test_overlay_utils.py
python
6
23
1
43
from PIL import Image from agentlab.analyze import overlay_utils def test_parse_function_calls(): test_code = """ mouse_click(34, 59) fill("a234", "test") click('b123', button="right", modifiers=["Shift", "Control"]) select_option("c456", ["option1", "option2"]) """ result = overlay_utils.parse_function_ca...
9cc9b9688d8e5c68972d712ecf778467e597d4632f32b2585c4ee95da238a7e1
false
AgentLab
py:tests.analyze.test_overlay_utils.test_filtering_args
program://AgentLab/function/tests.analyze.test_overlay_utils.test_filtering_args#L26-L45
function
test_filtering_args
tests/analyze/test_overlay_utils.py
python
26
45
6
65
def test_parse_function_calls(): test_code = """ mouse_click(34, 59) fill("a234", "test") click('b123', button="right", modifiers=["Shift", "Control"]) select_option("c456", ["option1", "option2"]) """ result = overlay_utils.parse_function_calls(test_code) assert result[1].function_name == "mouse_click" ...
9cc9b9688d8e5c68972d712ecf778467e597d4632f32b2585c4ee95da238a7e1
false
AgentLab
py:tests.analyze.test_overlay_utils.manual_eval
program://AgentLab/function/tests.analyze.test_overlay_utils.manual_eval#L48-L77
function
manual_eval
tests/analyze/test_overlay_utils.py
python
48
77
28
81
mouse_click(34, 59) fill("a234", "test") mouse_drag_and_drop(34, 59, to_x=100, to_y=200) drag_and_drop("a123", "b456") """ result = overlay_utils.parse_function_calls(test_code) args = overlay_utils.find_bids_and_xy_pairs(result) assert len(args) == 6 # Expecting 4 args: 2 mouse clicks, 1 fill, 1 select_o...
9cc9b9688d8e5c68972d712ecf778467e597d4632f32b2585c4ee95da238a7e1
false
AgentLab
py:tests.analyze.test_inspect_results
program://AgentLab/module/tests.analyze.test_inspect_results#L1-L35
module
tests.analyze.test_inspect_results
tests/analyze/test_inspect_results.py
python
1
35
1
35
from pathlib import Path import shutil import tempfile import pandas as pd from agentlab.analyze.inspect_results import get_study_summary def test_get_study_summary(): with tempfile.TemporaryDirectory() as tmp_dir: study_dir = Path(tmp_dir) / "test_study" study_dir_original = Path(__file__).par...
1b1e25989eb1e81a99bbac77634a76f275aa278a331ac3e97b1ddea85e224bd9
false
AgentLab
py:tests.analyze.test_inspect_results.test_get_study_summary
program://AgentLab/function/tests.analyze.test_inspect_results.test_get_study_summary#L9-L31
function
test_get_study_summary
tests/analyze/test_inspect_results.py
python
9
31
1
35
from pathlib import Path import shutil import tempfile import pandas as pd from agentlab.analyze.inspect_results import get_study_summary def test_get_study_summary(): with tempfile.TemporaryDirectory() as tmp_dir: study_dir = Path(tmp_dir) / "test_study" study_dir_original = Path(__file__).par...
1b1e25989eb1e81a99bbac77634a76f275aa278a331ac3e97b1ddea85e224bd9
false
AgentLab
py:tests.llm.test_huggingface_utils
program://AgentLab/module/tests.llm.test_huggingface_utils#L1-L32
module
tests.llm.test_huggingface_utils
tests/llm/test_huggingface_utils.py
python
1
32
1
32
import pytest from agentlab.llm.chat_api import HuggingFaceURLChatModel, make_system_message, make_user_message from agentlab.llm.llm_utils import download_and_save_model from agentlab.llm.prompt_templates import STARCHAT_PROMPT_TEMPLATE # TODO(optimass): figure out a good model for all tests @pytest.mark.skip(reas...
edea9db32c39d22cd6c155ff848d563256bff43e05e0fc6f3282e583888fe9d3
false
AgentLab
py:tests.llm.test_huggingface_utils.test_CustomLLMChatbot_locally
program://AgentLab/function/tests.llm.test_huggingface_utils.test_CustomLLMChatbot_locally#L11-L24
function
test_CustomLLMChatbot_locally
tests/llm/test_huggingface_utils.py
python
11
24
1
32
import pytest from agentlab.llm.chat_api import HuggingFaceURLChatModel, make_system_message, make_user_message from agentlab.llm.llm_utils import download_and_save_model from agentlab.llm.prompt_templates import STARCHAT_PROMPT_TEMPLATE # TODO(optimass): figure out a good model for all tests @pytest.mark.skip(reas...
edea9db32c39d22cd6c155ff848d563256bff43e05e0fc6f3282e583888fe9d3
false
AgentLab
py:tests.llm.test_huggingface_utils.test_download_and_save_model
program://AgentLab/function/tests.llm.test_huggingface_utils.test_download_and_save_model#L28-L32
function
test_download_and_save_model
tests/llm/test_huggingface_utils.py
python
28
32
8
32
@pytest.mark.skip(reason="Requires a local model checkpoint") def test_CustomLLMChatbot_locally(): # model_path = "google/flan-t5-base" # remote model on HuggingFace Hub model_path = "/mnt/ui_copilot/data_rw/models/starcoderbase-1b-ft" # local model in shared volum chatbot = HuggingFaceURLChatModel(mod...
edea9db32c39d22cd6c155ff848d563256bff43e05e0fc6f3282e583888fe9d3
false
AgentLab
py:tests.llm.test_llm_configs
program://AgentLab/module/tests.llm.test_llm_configs#L1-L8
module
tests.llm.test_llm_configs
tests/llm/test_llm_configs.py
python
1
8
1
8
from agentlab.llm.llm_configs import CHAT_MODEL_ARGS_DICT from agentlab.llm.chat_api import BaseModelArgs def test_llm_configs(): for _, args in CHAT_MODEL_ARGS_DICT.items(): assert isinstance(args, BaseModelArgs)
c905bf93d4a57f7fd18cc7000a71dbf31077cd1603c5b7f5641bd6000502b880
false
AgentLab
py:tests.llm.test_llm_configs.test_llm_configs
program://AgentLab/function/tests.llm.test_llm_configs.test_llm_configs#L5-L8
function
test_llm_configs
tests/llm/test_llm_configs.py
python
5
8
1
8
from agentlab.llm.llm_configs import CHAT_MODEL_ARGS_DICT from agentlab.llm.chat_api import BaseModelArgs def test_llm_configs(): for _, args in CHAT_MODEL_ARGS_DICT.items(): assert isinstance(args, BaseModelArgs)
c905bf93d4a57f7fd18cc7000a71dbf31077cd1603c5b7f5641bd6000502b880
false
AgentLab
py:tests.llm.test_tracking
program://AgentLab/module/tests.llm.test_tracking#L1-L177
module
tests.llm.test_tracking
tests/llm/test_tracking.py
python
1
177
1
177
import os import time from functools import partial import pytest import agentlab.llm.tracking as tracking from agentlab.llm.chat_api import ( AzureChatModel, OpenAIChatModel, OpenRouterChatModel, make_system_message, make_user_message, ) def test_get_action_decorator(): action, agent_info =...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.test_get_action_decorator
program://AgentLab/function/tests.llm.test_tracking.test_get_action_decorator#L17-L24
function
test_get_action_decorator
tests/llm/test_tracking.py
python
17
24
1
44
import os import time from functools import partial import pytest import agentlab.llm.tracking as tracking from agentlab.llm.chat_api import ( AzureChatModel, OpenAIChatModel, OpenRouterChatModel, make_system_message, make_user_message, ) def test_get_action_decorator(): action, agent_info =...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.test_get_pricing_openrouter
program://AgentLab/function/tests.llm.test_tracking.test_get_pricing_openrouter#L39-L46
function
test_get_pricing_openrouter
tests/llm/test_tracking.py
python
39
46
19
66
assert action == "action" assert agent_info["stats"] == { "input_tokens": 1, "output_tokens": 1, "cost": 1.0, } OPENROUTER_API_KEY_AVAILABLE = os.environ.get("OPENROUTER_API_KEY") is not None OPENROUTER_MODELS = ( "anthropic/claude-3.5-sonnet", "meta-llama/llama-3.1-405b-i...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.test_get_pricing_openai
program://AgentLab/function/tests.llm.test_tracking.test_get_pricing_openai#L49-L54
function
test_get_pricing_openai
tests/llm/test_tracking.py
python
49
54
29
74
OPENROUTER_MODELS = ( "anthropic/claude-3.5-sonnet", "meta-llama/llama-3.1-405b-instruct", "meta-llama/llama-3.1-70b-instruct", "meta-llama/llama-3.1-8b-instruct", "google/gemini-pro-1.5", ) @pytest.mark.skipif(not OPENROUTER_API_KEY_AVAILABLE, reason="OpenRouter API key is not available") def tes...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.call_llm
program://AgentLab/function/tests.llm.test_tracking.call_llm#L57-L62
function
call_llm
tests/llm/test_tracking.py
python
57
62
37
82
@pytest.mark.skipif(not OPENROUTER_API_KEY_AVAILABLE, reason="OpenRouter API key is not available") def test_get_pricing_openrouter(): pricing = tracking.get_pricing_openrouter() assert isinstance(pricing, dict) assert all(isinstance(v, dict) for v in pricing.values()) for model in OPENROUTER_MODELS: ...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.test_tracker
program://AgentLab/function/tests.llm.test_tracking.test_tracker#L65-L69
function
test_tracker
tests/llm/test_tracking.py
python
65
69
45
89
assert isinstance(pricing[model], dict) assert all(isinstance(v, float) for v in pricing[model].values()) def test_get_pricing_openai(): pricing = tracking.get_pricing_openai() assert isinstance(pricing, dict) assert all("prompt" in pricing[model] and "completion" in pricing[model] for mod...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.test_imbricate_trackers
program://AgentLab/function/tests.llm.test_tracking.test_imbricate_trackers#L72-L85
function
test_imbricate_trackers
tests/llm/test_tracking.py
python
72
85
52
105
assert all("prompt" in pricing[model] and "completion" in pricing[model] for model in pricing) assert all(isinstance(pricing[model]["prompt"], float) for model in pricing) assert all(isinstance(pricing[model]["completion"], float) for model in pricing) def call_llm(): if hasattr(tracking.TRACKER, "ins...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.test_threaded_trackers
program://AgentLab/function/tests.llm.test_tracking.test_threaded_trackers#L88-L115
function
test_threaded_trackers
tests/llm/test_tracking.py
python
88
115
68
135
assert tracker.stats["cost"] == 1 def test_imbricate_trackers(): with tracking.set_tracker() as tracker4: with tracking.set_tracker() as tracker1: _, _ = call_llm() with tracking.set_tracker() as tracker3: _, _ = call_llm() _, _ = call_llm() wit...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.test_openai_chat_model
program://AgentLab/function/tests.llm.test_tracking.test_openai_chat_model#L123-L135
function
test_openai_chat_model
tests/llm/test_tracking.py
python
123
135
103
155
results[1] = tracker.stats results = [None] * 2 threads = [ threading.Thread(target=partial(thread_1, results=results)), threading.Thread(target=partial(thread_2, results=results)), ] for thread in threads: thread.start() for thread in threads: thread.join() ...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.test_azure_chat_model
program://AgentLab/function/tests.llm.test_tracking.test_azure_chat_model#L148-L160
function
test_azure_chat_model
tests/llm/test_tracking.py
python
148
160
128
177
messages = [ make_system_message("You are an helpful virtual assistant"), make_user_message("Give the third prime number"), ] with tracking.set_tracker() as tracker: answer = chat_model(messages) assert "5" in answer.get("content") assert tracker.stats["cost"] > 0 AZURE_OPE...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.test_openrouter_chat_model
program://AgentLab/function/tests.llm.test_tracking.test_openrouter_chat_model#L165-L177
function
test_openrouter_chat_model
tests/llm/test_tracking.py
python
165
177
145
177
@pytest.mark.skipif( not AZURE_OPENAI_API_KEY_AVAILABLE, reason="Azure OpenAI API key is not available" ) def test_azure_chat_model(): chat_model = AzureChatModel(model_name="gpt-4.1-nano", deployment_name="gpt-4.1-nano") assert chat_model.input_cost > 0 assert chat_model.output_cost > 0 messages =...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.thread_1
program://AgentLab/function/tests.llm.test_tracking.thread_1#L92-L97
function
thread_1
tests/llm/test_tracking.py
python
92
97
72
117
def test_imbricate_trackers(): with tracking.set_tracker() as tracker4: with tracking.set_tracker() as tracker1: _, _ = call_llm() with tracking.set_tracker() as tracker3: _, _ = call_llm() _, _ = call_llm() with tracking.set_tracker() as tracker1bis: ...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_tracking.thread_2
program://AgentLab/function/tests.llm.test_tracking.thread_2#L99-L103
function
thread_2
tests/llm/test_tracking.py
python
99
103
79
123
with tracking.set_tracker() as tracker1bis: _, _ = call_llm() assert tracker1.stats["cost"] == 1 assert tracker1bis.stats["cost"] == 1 assert tracker3.stats["cost"] == 3 assert tracker4.stats["cost"] == 4 def test_threaded_trackers(): """thread_2 occurs in the middle o...
216a1e92d2c1072a6f138def3517be4247855c2c6b9687a0b4c3f597044c5813
false
AgentLab
py:tests.llm.test_litellm_api
program://AgentLab/module/tests.llm.test_litellm_api#L1-L167
module
tests.llm.test_litellm_api
tests/llm/test_litellm_api.py
python
1
167
1
167
import os from functools import partial import pytest from agentlab.llm.litellm_api import LiteLLMModelArgs from agentlab.llm.response_api import APIPayload, LLMOutput chat_api_tools = [ { "type": "function", "name": "get_weather", "description": "Get the current weather in a given locatio...
3d536844800bbc74d0b13ec4b727a271d2cc56690613d4878114cf35d293b527
false
AgentLab
py:tests.llm.test_litellm_api.add_user_messages
program://AgentLab/function/tests.llm.test_litellm_api.add_user_messages#L58-L62
function
add_user_messages
tests/llm/test_litellm_api.py
python
58
62
38
82
"description": "The location to get the time for.", } }, "required": ["location"], }, }, ] # test_config (setting name, BaseModelArgs, model_name, tools) tool_test_configs = [ ("gpt-4.1", LiteLLMModelArgs, "openai/gpt-4.1-2025-04-14", chat_ap...
3d536844800bbc74d0b13ec4b727a271d2cc56690613d4878114cf35d293b527
false
AgentLab
py:tests.llm.test_litellm_api.test_multi_action_tool_calls
program://AgentLab/function/tests.llm.test_litellm_api.test_multi_action_tool_calls#L67-L103
function
test_multi_action_tool_calls
tests/llm/test_litellm_api.py
python
67
103
47
123
# test_config (setting name, BaseModelArgs, model_name, tools) tool_test_configs = [ ("gpt-4.1", LiteLLMModelArgs, "openai/gpt-4.1-2025-04-14", chat_api_tools), # ("claude-3", LiteLLMModelArgs, "anthropic/claude-3-haiku-20240307", anthropic_tools), # fails for parallel tool calls # ("claude-3.7", LiteLLMM...
3d536844800bbc74d0b13ec4b727a271d2cc56690613d4878114cf35d293b527
false
AgentLab
py:tests.llm.test_litellm_api.test_single_tool_call
program://AgentLab/function/tests.llm.test_litellm_api.test_single_tool_call#L110-L137
function
test_single_tool_call
tests/llm/test_litellm_api.py
python
110
137
90
157
APIPayload(messages=messages, tools=tools, tool_choice=tool_choice) ) num_tool_calls = len(response.tool_calls) if response.tool_calls else 0 row = { "model": name, "checkpoint": checkpoint_name, "tool_choice": t...
3d536844800bbc74d0b13ec4b727a271d2cc56690613d4878114cf35d293b527
false
AgentLab
py:tests.llm.test_litellm_api.test_force_tool_call
program://AgentLab/function/tests.llm.test_litellm_api.test_force_tool_call#L142-L161
function
test_force_tool_call
tests/llm/test_litellm_api.py
python
142
161
122
167
llm_class = partial(llm_class, use_only_first_toolcall=True) model_args = llm_class(model_name=checkpoint_name, max_new_tokens=200, temperature=None) llm, msg_builder = model_args.make_model(), model_args.get_message_builder() messages = add_user_messages(msg_builder) ...
3d536844800bbc74d0b13ec4b727a271d2cc56690613d4878114cf35d293b527
false
AgentLab
py:tests.llm.test_response_api
program://AgentLab/module/tests.llm.test_response_api#L1-L803
module
tests.llm.test_response_api
tests/llm/test_response_api.py
python
1
803
1
803
import os from typing import Any, Dict, List, Optional from unittest.mock import MagicMock, patch import anthropic import openai import pytest from agentlab.llm import tracking from agentlab.llm.response_api import ( AnthropicAPIMessageBuilder, APIPayload, ClaudeResponseModelArgs, LLMOutput, OpenA...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
true
AgentLab
py:tests.llm.test_response_api.create_mock_openai_chat_completion
program://AgentLab/function/tests.llm.test_response_api.create_mock_openai_chat_completion#L23-L81
function
create_mock_openai_chat_completion
tests/llm/test_response_api.py
python
23
81
3
101
from unittest.mock import MagicMock, patch import anthropic import openai import pytest from agentlab.llm import tracking from agentlab.llm.response_api import ( AnthropicAPIMessageBuilder, APIPayload, ClaudeResponseModelArgs, LLMOutput, OpenAIChatCompletionAPIMessageBuilder, OpenAIChatModelAr...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.create_mock_anthropic_response
program://AgentLab/function/tests.llm.test_response_api.create_mock_anthropic_response#L148-L173
function
create_mock_anthropic_response
tests/llm/test_response_api.py
python
148
173
128
193
] anthropic_tools = [ { "name": "get_weather", "description": "Get the current weather in a given location.", "input_schema": { "type": "object", "properties": { "location": { "type": "string", "description": "Th...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.create_mock_openai_responses_api_response
program://AgentLab/function/tests.llm.test_response_api.create_mock_openai_responses_api_response#L176-L218
function
create_mock_openai_responses_api_response
tests/llm/test_response_api.py
python
176
218
156
238
if text_content: text_block = MagicMock(spec=anthropic.types.TextBlock) text_block.type = "text" text_block.text = text_content response.content.append(text_block) if tool_use: tool_use_block = MagicMock(spec=anthropic.types.ToolUseBlock) tool_use_block.type = "to...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_response_api_message_builder_text
program://AgentLab/function/tests.llm.test_response_api.test_openai_response_api_message_builder_text#L224-L230
function
test_openai_response_api_message_builder_text
tests/llm/test_response_api.py
python
224
230
204
250
output_item_mock.summary.append(summary_text_mock) response_mock.output.append(output_item_mock) # Token usage for pricing tracking response_mock.usage = MagicMock(spec=openai.types.responses.response.ResponseUsage) response_mock.usage.input_tokens = input_tokens respon...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_response_api_message_builder_image
program://AgentLab/function/tests.llm.test_response_api.test_openai_response_api_message_builder_image#L233-L241
function
test_openai_response_api_message_builder_image
tests/llm/test_response_api.py
python
233
241
213
261
response_mock.usage.completion_tokens = output_tokens input_tokens_details_mock = MagicMock() input_tokens_details_mock.cached_tokens = 0 response_mock.usage.input_tokens_details = input_tokens_details_mock return response_mock # --- Test MessageBuilders --- def test_openai_response_api_message...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_anthropic_api_message_builder_text
program://AgentLab/function/tests.llm.test_response_api.test_anthropic_api_message_builder_text#L244-L250
function
test_anthropic_api_message_builder_text
tests/llm/test_response_api.py
python
244
250
224
270
def test_openai_response_api_message_builder_text(): builder = OpenAIResponseAPIMessageBuilder.user() builder.add_text("Hello, world!") messages = builder.prepare_message() assert len(messages) == 1 assert messages[0]["role"] == "user" assert messages[0]["content"] == [{"type": "input_text", "te...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_anthropic_api_message_builder_image
program://AgentLab/function/tests.llm.test_response_api.test_anthropic_api_message_builder_image#L253-L264
function
test_anthropic_api_message_builder_image
tests/llm/test_response_api.py
python
253
264
233
284
def test_openai_response_api_message_builder_image(): builder = OpenAIResponseAPIMessageBuilder.user() builder.add_image("data:image/png;base64,SIMPLEBASE64STRING") messages = builder.prepare_message() assert len(messages) == 1 assert messages[0]["role"] == "user" assert messages[0]["content"] =...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_chat_completion_api_message_builder_text
program://AgentLab/function/tests.llm.test_response_api.test_openai_chat_completion_api_message_builder_text#L267-L274
function
test_openai_chat_completion_api_message_builder_text
tests/llm/test_response_api.py
python
267
274
247
294
messages = builder.prepare_message() assert len(messages) == 1 assert messages[0]["role"] == "user" assert messages[0]["content"] == [{"type": "text", "text": "Hello, Anthropic!"}] def test_anthropic_api_message_builder_image(): builder = AnthropicAPIMessageBuilder.user() builder.add_image("da...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_chat_completion_api_message_builder_image
program://AgentLab/function/tests.llm.test_response_api.test_openai_chat_completion_api_message_builder_image#L277-L286
function
test_openai_chat_completion_api_message_builder_image
tests/llm/test_response_api.py
python
277
286
257
306
assert len(messages) == 1 assert messages[0]["role"] == "user" assert len(messages[0]["content"]) == 1 image_content = messages[0]["content"][0] assert image_content["type"] == "image" assert image_content["source"]["type"] == "base64" assert image_content["source"]["media_type"] == "image/p...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_chat_completion_model_parse_and_cost
program://AgentLab/function/tests.llm.test_response_api.test_openai_chat_completion_model_parse_and_cost#L289-L328
function
test_openai_chat_completion_model_parse_and_cost
tests/llm/test_response_api.py
python
289
328
269
348
builder.add_text("Hello, ChatCompletion!") messages = builder.prepare_message() assert len(messages) == 1 assert messages[0]["role"] == "user" assert messages[0]["content"] == [{"type": "text", "text": "Hello, ChatCompletion!"}] def test_openai_chat_completion_api_message_builder_image(): bui...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_claude_response_model_parse_and_cost
program://AgentLab/function/tests.llm.test_response_api.test_claude_response_model_parse_and_cost#L331-L357
function
test_claude_response_model_parse_and_cost
tests/llm/test_response_api.py
python
331
357
311
377
) as mock_create: with tracking.set_tracker() as global_tracker: messages = [ OpenAIChatCompletionAPIMessageBuilder.user().add_text( "What's the weather in Paris?" ) ] payload = APIPayload(messages=messages) ...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_response_model_parse_and_cost
program://AgentLab/function/tests.llm.test_response_api.test_openai_response_model_parse_and_cost#L360-L401
function
test_openai_response_model_parse_and_cost
tests/llm/test_response_api.py
python
360
401
340
421
) with patch.object( model.client.messages, "create", return_value=mock_anthropic_api_response ) as mock_create: with tracking.set_tracker() as global_tracker: messages = [AnthropicAPIMessageBuilder.user().add_text("Search for latest news")] payload = APIPayload(mess...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_chat_completion_model_pricy_call
program://AgentLab/function/tests.llm.test_response_api.test_openai_chat_completion_model_pricy_call#L409-L433
function
test_openai_chat_completion_model_pricy_call
tests/llm/test_response_api.py
python
409
433
389
453
parsed_output = model(payload) mock_create_method.assert_called_once() fn_calls = [ content for content in parsed_output.tool_calls.raw_calls.output if content.type == "function_call" ] assert parsed_output.action == "get_current_weather(location='Boston, MA', unit='...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_claude_response_model_pricy_call
program://AgentLab/function/tests.llm.test_response_api.test_claude_response_model_pricy_call#L438-L460
function
test_claude_response_model_pricy_call
tests/llm/test_response_api.py
python
438
460
418
480
model = args.make_model() with tracking.set_tracker() as global_tracker: messages = [ OpenAIChatCompletionAPIMessageBuilder.user().add_text("What is the weather in Paris?") ] payload = APIPayload(messages=messages, tools=tools, tool_choice="required") parsed_output =...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_response_model_pricy_call
program://AgentLab/function/tests.llm.test_response_api.test_openai_response_model_pricy_call#L465-L488
function
test_openai_response_model_pricy_call
tests/llm/test_response_api.py
python
465
488
445
508
) tools = anthropic_tools model = args.make_model() with tracking.set_tracker() as global_tracker: messages = [AnthropicAPIMessageBuilder.user().add_text("What is the weather in Paris?")] payload = APIPayload(messages=messages, tools=tools) parsed_output = model(payload) as...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_response_model_with_multiple_messages_and_cost_tracking
program://AgentLab/function/tests.llm.test_response_api.test_openai_response_model_with_multiple_messages_and_cost_tracking#L493-L542
function
test_openai_response_model_with_multiple_messages_and_cost_tracking
tests/llm/test_response_api.py
python
493
542
473
562
model = args.make_model() with tracking.set_tracker() as global_tracker: messages = [ OpenAIResponseAPIMessageBuilder.user().add_text("What is the weather in Paris?") ] payload = APIPayload(messages=messages, tools=tools) parsed_output = model(payload) assert pa...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_openai_chat_completion_model_with_multiple_messages_and_cost_tracking
program://AgentLab/function/tests.llm.test_response_api.test_openai_chat_completion_model_with_multiple_messages_and_cost_tracking#L547-L617
function
test_openai_chat_completion_model_with_multiple_messages_and_cost_tracking
tests/llm/test_response_api.py
python
547
617
527
637
delta_output = tracker.stats["output_tokens"] - prev_output delta_cost = tracker.stats["cost"] - prev_cost assert prev_input > 0 assert prev_output > 0 assert prev_cost > 0 assert parsed.raw_response is not None assert ( parsed.action == """get_weather(location='Delhi', unit...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_claude_model_with_multiple_messages_pricy_call
program://AgentLab/function/tests.llm.test_response_api.test_claude_model_with_multiple_messages_pricy_call#L622-L684
function
test_claude_model_with_multiple_messages_pricy_call
tests/llm/test_response_api.py
python
622
684
602
704
delta_output = tracker.stats["output_tokens"] - prev_output delta_cost = tracker.stats["cost"] - prev_cost assert prev_input > 0 assert prev_output > 0 assert prev_cost > 0 assert parsed.raw_response is not None assert ( parsed.action == """get_weather(location='Delhi')""" ...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_multi_action_tool_calls
program://AgentLab/function/tests.llm.test_response_api.test_multi_action_tool_calls#L690-L750
function
test_multi_action_tool_calls
tests/llm/test_response_api.py
python
690
750
670
770
delta_cost = global_tracker.stats["cost"] - prev_cost assert prev_input > 0, "Expected previous input tokens to be greater than 0" assert prev_output > 0, "Expected previous output tokens to be greater than 0" assert prev_cost > 0, "Expected previous cost value to be greater than 0" assert llm_...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.test_tool_call_to_python_code
program://AgentLab/function/tests.llm.test_response_api.test_tool_call_to_python_code#L791-L798
function
test_tool_call_to_python_code
tests/llm/test_response_api.py
python
791
798
771
803
{ "infinity": float("inf"), "nan": float("nan"), "negative_zero": -0.0, "scientific": 1.23e-45, }, "complex_call(infinity=inf, nan=nan, negative_zero=-0.0, scientific=1.23e-45)", ), # 4. Deeply nested structures that could stress repr() ...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_response_api.add_user_messages
program://AgentLab/function/tests.llm.test_response_api.add_user_messages#L710-L714
function
add_user_messages
tests/llm/test_response_api.py
python
710
714
690
734
def test_multi_action_tool_calls(): """ Test that the model can produce multiple tool calls in parallel. Uncomment commented lines to see the full behaviour of models and tool choices. """ # test_config (setting name, BaseModelArgs, model_name, tools) tool_test_configs = [ ( ...
81eb847e19766c2021a4c0c2ec8d7a1ab6cee79d8197c44101314fa84848b8f3
false
AgentLab
py:tests.llm.test_chat_api
program://AgentLab/module/tests.llm.test_chat_api#L1-L93
module
tests.llm.test_chat_api
tests/llm/test_chat_api.py
python
1
93
1
93
import os import pytest from agentlab.llm.chat_api import ( AnthropicModelArgs, AzureModelArgs, OpenAIModelArgs, make_system_message, make_user_message, ) # TODO(optimass): figure out a good model for all tests if "AGENTLAB_LOCAL_TEST" in os.environ: skip_tests = os.environ["AGENTLAB_LOCAL_...
1827bbbe5c8ea015a003ddf56dcabfe4f2dadd506ae591ed9bd0a089f03d664b
false
AgentLab
py:tests.llm.test_chat_api.test_api_model_args_azure
program://AgentLab/function/tests.llm.test_chat_api.test_api_model_args_azure#L27-L44
function
test_api_model_args_azure
tests/llm/test_chat_api.py
python
27
44
7
64
AzureModelArgs, OpenAIModelArgs, make_system_message, make_user_message, ) # TODO(optimass): figure out a good model for all tests if "AGENTLAB_LOCAL_TEST" in os.environ: skip_tests = os.environ["AGENTLAB_LOCAL_TEST"] != "1" else: skip_tests = False @pytest.mark.pricy @pytest.mark.skipif(sk...
1827bbbe5c8ea015a003ddf56dcabfe4f2dadd506ae591ed9bd0a089f03d664b
false
End of preview. Expand in Data Studio

Repository Code Snippets

Focused source-code snippets for static repository graph browsing.

Rows are keyed by repo_id and entity_id, matching the public repo graph entity ids. Each row contains a focused source span plus surrounding context, not a complete repository dump.

Columns

  • repo_id
  • entity_id
  • uri
  • kind
  • name
  • path
  • language
  • start_line
  • end_line
  • context_start_line
  • context_end_line
  • code
  • source_hash
  • truncated

Stats

  • snippets: 468,268
  • skipped entities: 437,756
  • repos: 155
  • generated at: 1777152029
Downloads last month
-