1414 ReadmeResourceWithStreamingResponse ,
1515 AsyncReadmeResourceWithStreamingResponse ,
1616)
17- from ...types import model_create_params
17+ from ...types import model_create_params , model_search_params
1818from ..._types import NOT_GIVEN , Body , Query , Headers , NoneType , NotGiven
1919from ..._utils import maybe_transform , async_maybe_transform
2020from .examples import (
@@ -404,6 +404,57 @@ def get(
404404 cast_to = NoneType ,
405405 )
406406
407+ def search (
408+ self ,
409+ * ,
410+ body : str ,
411+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
412+ # The extra values given here take precedence over values defined on the client or passed to this method.
413+ extra_headers : Headers | None = None ,
414+ extra_query : Query | None = None ,
415+ extra_body : Body | None = None ,
416+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
417+ ) -> None :
418+ """
419+ Get a list of public models matching a search query.
420+
421+ Example cURL request:
422+
423+ ```console
424+ curl -s -X QUERY \\
425+ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \\
426+ -H "Content-Type: text/plain" \\
427+ -d "hello" \\
428+ https://api.replicate.com/v1/models
429+ ```
430+
431+ The response will be a paginated JSON object containing an array of model
432+ objects.
433+
434+ See the [`models.get`](#models.get) docs for more details about the model
435+ object.
436+
437+ Args:
438+ body: The search query
439+
440+ extra_headers: Send extra headers
441+
442+ extra_query: Add additional query parameters to the request
443+
444+ extra_body: Add additional JSON properties to the request
445+
446+ timeout: Override the client-level default timeout for this request, in seconds
447+ """
448+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
449+ return self ._query (
450+ "/models" ,
451+ body = maybe_transform (body , model_search_params .ModelSearchParams ),
452+ options = make_request_options (
453+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
454+ ),
455+ cast_to = NoneType ,
456+ )
457+
407458
408459class AsyncModelsResource (AsyncAPIResource ):
409460 @cached_property
@@ -753,6 +804,57 @@ async def get(
753804 cast_to = NoneType ,
754805 )
755806
807+ async def search (
808+ self ,
809+ * ,
810+ body : str ,
811+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
812+ # The extra values given here take precedence over values defined on the client or passed to this method.
813+ extra_headers : Headers | None = None ,
814+ extra_query : Query | None = None ,
815+ extra_body : Body | None = None ,
816+ timeout : float | httpx .Timeout | None | NotGiven = NOT_GIVEN ,
817+ ) -> None :
818+ """
819+ Get a list of public models matching a search query.
820+
821+ Example cURL request:
822+
823+ ```console
824+ curl -s -X QUERY \\
825+ -H "Authorization: Bearer $REPLICATE_API_TOKEN" \\
826+ -H "Content-Type: text/plain" \\
827+ -d "hello" \\
828+ https://api.replicate.com/v1/models
829+ ```
830+
831+ The response will be a paginated JSON object containing an array of model
832+ objects.
833+
834+ See the [`models.get`](#models.get) docs for more details about the model
835+ object.
836+
837+ Args:
838+ body: The search query
839+
840+ extra_headers: Send extra headers
841+
842+ extra_query: Add additional query parameters to the request
843+
844+ extra_body: Add additional JSON properties to the request
845+
846+ timeout: Override the client-level default timeout for this request, in seconds
847+ """
848+ extra_headers = {"Accept" : "*/*" , ** (extra_headers or {})}
849+ return await self ._query (
850+ "/models" ,
851+ body = await async_maybe_transform (body , model_search_params .ModelSearchParams ),
852+ options = make_request_options (
853+ extra_headers = extra_headers , extra_query = extra_query , extra_body = extra_body , timeout = timeout
854+ ),
855+ cast_to = NoneType ,
856+ )
857+
756858
757859class ModelsResourceWithRawResponse :
758860 def __init__ (self , models : ModelsResource ) -> None :
@@ -770,6 +872,9 @@ def __init__(self, models: ModelsResource) -> None:
770872 self .get = to_raw_response_wrapper (
771873 models .get ,
772874 )
875+ self .search = to_raw_response_wrapper (
876+ models .search ,
877+ )
773878
774879 @cached_property
775880 def examples (self ) -> ExamplesResourceWithRawResponse :
@@ -804,6 +909,9 @@ def __init__(self, models: AsyncModelsResource) -> None:
804909 self .get = async_to_raw_response_wrapper (
805910 models .get ,
806911 )
912+ self .search = async_to_raw_response_wrapper (
913+ models .search ,
914+ )
807915
808916 @cached_property
809917 def examples (self ) -> AsyncExamplesResourceWithRawResponse :
@@ -838,6 +946,9 @@ def __init__(self, models: ModelsResource) -> None:
838946 self .get = to_streamed_response_wrapper (
839947 models .get ,
840948 )
949+ self .search = to_streamed_response_wrapper (
950+ models .search ,
951+ )
841952
842953 @cached_property
843954 def examples (self ) -> ExamplesResourceWithStreamingResponse :
@@ -872,6 +983,9 @@ def __init__(self, models: AsyncModelsResource) -> None:
872983 self .get = async_to_streamed_response_wrapper (
873984 models .get ,
874985 )
986+ self .search = async_to_streamed_response_wrapper (
987+ models .search ,
988+ )
875989
876990 @cached_property
877991 def examples (self ) -> AsyncExamplesResourceWithStreamingResponse :
0 commit comments