user
07/24/2025, 7:33 PMbooks
collection with id
, name
, and author
v.s.
a books
collection with id
, name
, author_id
referencing authors
collection.
The NLS doesn't seem to work well when asking give me book from author Joe DoeAllen Yi Hsu
07/24/2025, 7:35 PMJason Bosco
07/24/2025, 10:15 PMJason Bosco
07/24/2025, 10:16 PMJason Bosco
07/24/2025, 10:16 PMAllen Yi Hsu
07/24/2025, 10:18 PMcurl "<https://my.typesense/collections/books/documents/search>" \
-H "X-TYPESENSE-API-KEY: xyz" \
-G \
--data-urlencode "q=show me all books for author Allen with amount more than $10." \
--data-urlencode "nl_query=true" \
--data-urlencode "query_by=author_id" \
--data-urlencode "nl_model_id=my-openai-typesense-model"
Allen Yi Hsu
07/24/2025, 10:20 PMJason Bosco
07/24/2025, 10:20 PMJason Bosco
07/24/2025, 10:22 PMHere are more examples of queries and how you should translate them to Typesense queries:
1) show me all books for author Allen with amount more than $10
"filter_by": "amount:>10 && $authors(first_name:Allen)"
Jason Bosco
07/24/2025, 10:23 PMAllen Yi Hsu
07/24/2025, 10:23 PMauthor_id
, category_id
, group_id
and xyz_id
all referencing other tables. I feel like the best way is to have all the data in just one collection - flatten - for NLS use caseJason Bosco
07/24/2025, 10:24 PMAllen Yi Hsu
07/24/2025, 10:24 PMJason Bosco
07/24/2025, 10:25 PMAllen Yi Hsu
07/24/2025, 10:30 PMAllen Yi Hsu
07/24/2025, 11:41 PMtransactions
with system prompts
"\"amount_cents\" refers to the amount of the transaction in US dollar cents.Here are more examples of queries and how you should translate them to Typesense queries:\n1) show me all transactions for Allen with amount more than $1000\n\"filter_by\": \"amount_cents:>100000 && $users(name: Allen)\"\n2) show me all transactions in category \"Admin\"\n\"filter_by\": \"$categories(name: Admin) || $sub_categories(name: Admin)\"\n3) show me all transactions assigned to property \"4819 Emerald St\"\n\"filter_by\": \"$properties(address: 4819 Emerald St)\"\n4) show me all transactions assigned to \"First\" portfolio\n\"filter_by\": \"$portfolios(name: First)\"\n5) show me all transactions for user Allen with amount more than $1000, and in category related to storage\n\"filter_by\": \"amount_cents:>100000 && $users(name: Allen) && ($categories(name: Storage) || $sub_categories(name: Storage))\""
Allen Yi Hsu
07/24/2025, 11:42 PMAllen Yi Hsu
07/24/2025, 11:44 PMamount_cents
is not able to be parsed properly. is the $
sign throwing things off?🤔Allen Yi Hsu
07/25/2025, 1:04 AMfilter_by
, but only after I specified the column name - not idea. Even then, the expected result is not accurate. 0 results when there should be some records. So far....this NLS is a bit confusing to work with 😵💫