Skip to main content

Natural Language Search

Natural language search allows you to search for information using natural language queries, offering considerable performance gains above traditional search algorithms. The TrueState Python SDK provides a high-level API for making predictions on your searchable datasets.

To create a searchable dataset, visit the Text Embedding documentation.

from truestate.inference import search

query = "lightweight camping gear for backpacking"

dataset_id = "your-dataset-id"

results = search(query, dataset_id)

print(results)
# [
# {
# "id": "UL001",
# "name": "Featherlight Pro X2 Tent",
# "description": "Ultra-lightweight 2-person tent weighing 1.75 lbs (794g). Made with Dyneema Composite Fabric for ultimate strength-to-weight ratio. Ideal for thru-hikers on long-distance trails."
# },
# {
# "id": "UL002",
# "name": "AeroDown Ultralight 5°F Sleeping Bag",
# "description": "Premium 5°F (-15°C) rated sleeping bag weighing only 1.2 lbs (544g). Features 950+ fill power down with water-repellent treatment. Perfect for long-distance backpacking in varied conditions."
# },
# {
# "id": "UL003",
# "name": "TitaniumFlame Micro Stove System",
# "description": "Integrated stove system weighing 5.6 oz (159g) including pot. Boils water in 100 seconds and nests with a fuel canister. Engineered for ultralight long-distance hikers."
# }
# ]