You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -119,4 +119,56 @@ for business in client.businesses.iter_search(
119
119
):
120
120
# business is a Business dataclass instance
121
121
print(business)
122
+
123
+
```
124
+
125
+
---
126
+
127
+
## 🚀 AI-Powered Natural Language Search
128
+
129
+
> [!IMPORTANT]
130
+
> **Use plain English to search businesses.**
131
+
>
132
+
> You can now pass a `query` string, and AI will automatically convert it into structured `filters`, `fields`, and other search parameters.
133
+
134
+
### AI-Powered Search (Plain Text)
135
+
136
+
```python
137
+
# Describe your request in plain English using the query parameter.
138
+
result = client.businesses.search(
139
+
query=(
140
+
'Find restaurants and cafes in California and Illinois with rating 4.2+ and status operational. Return fields name, address, rating and reviews. Limit results to 15.'
141
+
)
142
+
)
143
+
144
+
for business in result.items:
145
+
print(business.name, business.rating)
146
+
```
147
+
148
+
### Combine JSON + Plain Text (Merge Rules)
149
+
150
+
When you pass both `filters`/`fields` and `query`:
151
+
152
+
-`filters` are merged
153
+
-`fields` are merged
154
+
-`limit`, `cursor`, and `include_total` come from plain text first (if present)
155
+
156
+
```python
157
+
result = client.businesses.search(
158
+
filters={
159
+
'country_code': 'US',
160
+
'states': ['CA'],
161
+
'types': ['restaurant']
162
+
},
163
+
fields=['name', 'phone'],
164
+
limit=15,
165
+
query=(
166
+
'Add cafes too. Return address and reviews. Limit 20. Include total.'
167
+
),
168
+
)
169
+
170
+
# Result behavior:
171
+
# - filters merged (types include restaurant + cafe, plus other JSON filters)
0 commit comments