@@ -56,14 +56,114 @@ def trigger_pipeline(self, pipeline_id:str, sync_type:TriggerSyncTypeEnum):
5656 except Exception as e :
5757 print (f"Pipeline trigger failed. Exception - { e } " )
5858
59- def search_pipeline (self , pipeline_id :str , query :str , num_of_results :int = 3 , track :bool = False ):
59+ def search_pipeline (self , pipeline_id :str , query :str , num_of_results :int = 3 , track :bool = False , filter : dict = {}, requested_by : str = None ):
6060 url = f"{ self .endpoint } /pipelines/{ pipeline_id } /search"
6161
6262 payload = {
6363 "number_of_results" : num_of_results ,
6464 "query" : query ,
65- "collect_retrieval" :track
65+ "collect_retrieval" :track ,
66+ "requested_by" :requested_by ,
67+ "filter" :filter
6668 }
69+ headers = {
70+ "accept" : "application/json" ,
71+ "neum-api-key" : self .api_key ,
72+ "content-type" : "application/json"
73+ }
74+ try :
75+ response = requests .post (url , json = payload , headers = headers )
76+ return json .loads (response .text )
77+ except Exception as e :
78+ print (f"Pipeline trigger failed. Exception - { e } " )
79+
80+ def search_file (self , pipeline_id :str , file_id :str , query :str , num_of_results :int = 3 , track :bool = False , requested_by :str = None ):
81+ url = f"{ self .endpoint } /pipelines/{ pipeline_id } /files/search?file_id={ file_id } "
82+
83+ payload = {
84+ "number_of_results" : num_of_results ,
85+ "query" : query ,
86+ "collect_retrieval" :track ,
87+ "requested_by" :requested_by ,
88+ }
89+ headers = {
90+ "accept" : "application/json" ,
91+ "neum-api-key" : self .api_key ,
92+ "content-type" : "application/json"
93+ }
94+ try :
95+ response = requests .post (url , json = payload , headers = headers )
96+ return json .loads (response .text )
97+ except Exception as e :
98+ print (f"Pipeline trigger failed. Exception - { e } " )
99+
100+ def get_files (self , pipeline_id :str ):
101+ url = f"{ self .endpoint } /pipelines/{ pipeline_id } /files"
102+
103+ headers = {
104+ "accept" : "application/json" ,
105+ "neum-api-key" : self .api_key ,
106+ "content-type" : "application/json"
107+ }
108+
109+ try :
110+ response = requests .get (url , headers = headers )
111+ return json .loads (response .text )
112+ except Exception as e :
113+ print (f"Pipeline trigger failed. Exception - { e } " )
114+
115+ def get_file (self , pipeline_id :str , file_id :str ):
116+ url = f"{ self .endpoint } /pipelines/{ pipeline_id } /files?file_id={ file_id } "
117+
118+ headers = {
119+ "accept" : "application/json" ,
120+ "neum-api-key" : self .api_key ,
121+ "content-type" : "application/json"
122+ }
123+
124+ try :
125+ response = requests .get (url , headers = headers )
126+ return json .loads (response .text )
127+ except Exception as e :
128+ print (f"Pipeline trigger failed. Exception - { e } " )
129+
130+ def get_retrievals_by_file_id (self , pipeline_id :str , file_id :str ):
131+ url = f"{ self .endpoint } /retrievals/{ pipeline_id } /files?file_id={ file_id } "
132+
133+ headers = {
134+ "accept" : "application/json" ,
135+ "neum-api-key" : self .api_key ,
136+ "content-type" : "application/json"
137+ }
138+
139+ try :
140+ response = requests .get (url , headers = headers )
141+ return json .loads (response .text )
142+ except Exception as e :
143+ print (f"Pipeline trigger failed. Exception - { e } " )
144+
145+ def get_retrievals_by_pipeline_id (self , pipeline_id :str ):
146+ url = f"{ self .endpoint } /retrievals/{ pipeline_id } "
147+
148+ headers = {
149+ "accept" : "application/json" ,
150+ "neum-api-key" : self .api_key ,
151+ "content-type" : "application/json"
152+ }
153+
154+ try :
155+ response = requests .get (url , headers = headers )
156+ return json .loads (response .text )
157+ except Exception as e :
158+ print (f"Pipeline trigger failed. Exception - { e } " )
159+
160+ def provide_retrieval_feedback (self , pipeline_id :str , retrieval_id :str , status :str ):
161+ url = f"{ self .endpoint } /retrievals/{ pipeline_id } /{ retrieval_id } "
162+
163+ payload = {
164+ "status" :status
165+ }
166+
67167 headers = {
68168 "accept" : "application/json" ,
69169 "neum-api-key" : self .api_key ,
0 commit comments