@@ -529,26 +529,58 @@ All operations return a response object or raise an exception:
529529### Example
530530
531531``` python
532- from glean import Glean, errors
532+ from glean import Glean, errors, models
533533import os
534534
535535
536536with Glean(
537537 bearer_auth = os.getenv(" GLEAN_BEARER_AUTH" , " " ),
538- server_url = os.getenv(" GLEAN_SERVER_URL" , " https://customer-be.glean.com" )
539- ) as glean:
538+ ) as g_client:
540539 try :
541- res = glean.chat.ask()
540+ res = g_client.client.search.execute(search_request = models.SearchRequest(
541+ tracking_token = " trackingToken" ,
542+ page_size = 10 ,
543+ query = " vacation policy" ,
544+ request_options = models.SearchRequestOptions(
545+ facet_filters = [
546+ models.FacetFilter(
547+ field_name = " type" ,
548+ values = [
549+ models.FacetFilterValue(
550+ value = " article" ,
551+ relation_type = models.RelationType.EQUALS ,
552+ ),
553+ models.FacetFilterValue(
554+ value = " document" ,
555+ relation_type = models.RelationType.EQUALS ,
556+ ),
557+ ],
558+ ),
559+ models.FacetFilter(
560+ field_name = " department" ,
561+ values = [
562+ models.FacetFilterValue(
563+ value = " engineering" ,
564+ relation_type = models.RelationType.EQUALS ,
565+ ),
566+ ],
567+ ),
568+ ],
569+ facet_bucket_size = 246815 ,
570+ ),
571+ ))
572+
573+ # Handle response
542574 print (res)
543- # If the server returned structured data
544- except errors.GleanDataError as e:
545- print (e.data)
546- print (e.data.errorMessage)
547575 except errors.GleanError as e:
548576 print (e.message)
549577 print (e.status_code)
550578 print (e.raw_response)
551579 print (e.body)
580+ # If the server returned structured data
581+ except errors.GleanDataError as e:
582+ print (e.data)
583+ print (e.data.errorMessage)
552584```
553585
554586By default, an API error will raise a errors.GleanError exception, which has the following properties:
0 commit comments