Skip to content

Commit cd79e94

Browse files
committed
refactor(model): remove redundant model parameter from CommonModel initialization
remove unused model parameter from CommonModel constructor and update overload signatures to use concise syntax this change simplifies the CommonModel initialization by removing the redundant model parameter that was being passed but not properly used in the initialization logic, while also updating the overload signatures to use more concise syntax fixes inconsistencies in model parameter handling and cleans up the API surface Refactor: remove redundant model parameter from CommonModel 移除 CommonModel 初始化中多余的 model 参数 将重载签名更新为使用更简洁的语法 此更改通过删除传递但未在初始化逻辑中正确使用的冗余 model 参数来简化 CommonModel 初始化,同时将重载签名更新为使用更简洁的语法 修复了 model 参数处理中的不一致并清理了 API 表面 重构:从 CommonModel 中移除冗余的模型参数 Change-Id: I18803899a09f96103b413a91bd99355204ac970f Signed-off-by: OhYee <oyohyee@oyohyee.com>
1 parent 34adab5 commit cd79e94

File tree

3 files changed

+1
-6
lines changed

3 files changed

+1
-6
lines changed

agentrun/integration/builtin/model.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,13 @@ def model(
7777

7878
if isinstance(input, ModelProxy):
7979
return CommonModel(
80-
model=model or "",
8180
model_obj=input,
8281
backend_type=BackendType.PROXY,
8382
specific_model=model,
8483
config=config,
8584
)
8685
elif isinstance(input, ModelService):
8786
return CommonModel(
88-
model=model or "",
8987
model_obj=input,
9088
backend_type=BackendType.SERVICE,
9189
specific_model=model,

agentrun/integration/utils/model.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@ class CommonModel:
1919

2020
def __init__(
2121
self,
22-
model: Optional[str],
2322
model_obj: Union[ModelService, ModelProxy],
2423
backend_type: Optional[BackendType] = None,
2524
specific_model: Optional[str] = None,
2625
config: Optional[Config] = None,
2726
):
28-
self.model = model
2927
self.model_obj = model_obj
3028
self.backend_type = backend_type
3129
self.specific_model = specific_model

tests/unittests/integration/test_integration.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def extract_payload(request):
8686
def build_response(request, route):
8787
payload = extract_payload(request)
8888
is_stream = payload.get("stream", False)
89+
assert payload.get("model") == "mock-model-proxy"
8990
response_json = self._build_response(
9091
payload.get("messages") or [], payload.get("tools")
9192
)
@@ -355,8 +356,6 @@ def get_mocked_model(
355356
)
356357
m = model("fake-llm-model")
357358

358-
assert m.model == "fake-llm-model"
359-
360359
return m
361360

362361
def test_langchain(self, monkeypatch, mock_llm_transport):

0 commit comments

Comments
 (0)