MCPcopy Create free account
hub / github.com/agentscope-ai/Trinity-RFT / get_external_model_wrapper

Function get_external_model_wrapper

trinity/common/models/allocator.py:216–225  ·  view source on GitHub ↗

Get the ModelWrapper for the external model.

(config: InferenceModelConfig)

Source from the content-addressed store, hash-verified

214
215
216async def get_external_model_wrapper(config: InferenceModelConfig) -> ModelWrapper:
217 """Get the ModelWrapper for the external model."""
218 if config.engine_type != "external":
219 raise ValueError("This function is only for creating external model wrapper.")
220 api_address = os.environ.get(config.external_model_config.base_url_env)
221 api_address = api_address.rstrip("/") if api_address else None
222 api_key = os.environ.get(config.external_model_config.api_key_env, "EMPTY")
223 config.api_key = api_key
224 config.enable_openai_api = True
225 return ModelWrapper(models=[], config=config, api_address=api_address)

Callers 2

create_engineMethod · 0.85

Calls 2

ModelWrapperClass · 0.90
getMethod · 0.45

Tested by 1