MCPcopy Index your code
hub / github.com/TaskingAI/TaskingAI / list_model_schemas

Function list_model_schemas

backend/app/services/model/model_schema.py:143–174  ·  view source on GitHub ↗

List model schemas. Only one in `offset`, `after` and `before` can be used at the same time. :param limit: the maximum number of model schemas to return. :param offset: the offset of model schemas to return. :param provider_id: the provider id to filter by. :param type: the

(
    limit: int,
    offset: Optional[int],
    provider_id: Optional[str],
    type: Optional[ModelType],
)

Source from the content-addressed store, hash-verified

141
142
143async def list_model_schemas(
144 limit: int,
145 offset: Optional[int],
146 provider_id: Optional[str],
147 type: Optional[ModelType],
148) -> Tuple[List[ModelSchema], int, bool]:
149 """
150 List model schemas.
151 Only one in `offset`, `after` and `before` can be used at the same time.
152
153 :param limit: the maximum number of model schemas to return.
154 :param offset: the offset of model schemas to return.
155 :param provider_id: the provider id to filter by.
156 :param type: the model type to filter by.
157 :return: a tuple of (model schemas, total count, has more)
158 """
159
160 # Filter by provider_id and type
161 filtered_schemas = [
162 schema
163 for schema in _model_schemas
164 if (provider_id is None or schema.provider_id == provider_id) and (type is None or schema.type == type.value or schema.type == ModelType.WILDCARD.value)
165 ]
166
167 # Paginate
168 end_index = offset + limit
169 page = filtered_schemas[offset:end_index]
170
171 # Check if there's more
172 has_more = end_index < len(filtered_schemas)
173
174 return page, len(filtered_schemas), has_more
175
176
177def get_provider(provider_id: str) -> Optional[Provider]:

Callers 1

api_list_model_schemasFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected