Quick Start Guide

Get started with Reasoner by using one of our Client SDKs

The quickest way to get started with Reasoner is by using the Python SDK.

Installation

To install the Python SDK, you can run the following command or equivalent for your package manager.

$pip install reasonercli

Authentication

Once you’ve installed the SDK, run the following command to authenticate with Reasoner.

$reasonercli auth

After you have completed the steps to get authenticated, you’re ready to go!

Building and Tracing Your First Index

To get started with your first index, copy and paste the following example into your code editor of choice and run it as a script.

The following code snippet demonstrates how to use the SDK to

  • Create an index
  • Populate that index
  • Build it
  • Run a trace on the index

1import time
2from reasoner import Reasoner
3
4r = Reasoner(api_key=”foobar”)
5
6# Create index
7index = r.indexes.create(index_name)
8
9index_uid = index["uid"]
10
11# Add urls and documents to the index
12r.indexes.add_urls(['https://reasoner.com'], index_uid)
13
14# Build the index with (blocking call)
15updated_index = r.indexes.build(index_uid, wait=True)
16
17# Query on the index (blocking call)
18response = r.trace('What is Reasoner?', index_uid, wait=True)
19
20# Get list of indexes
21indexes, cursor = r.indexes.list()
22
23# Get next page of indexes
24if cursor.get("before_created_at") is not None:
25 more_index, _ = r.indexes.list(index_uid, next=cursor)
26
27# Get index details
28index = r.indexes.get(index_uid)
29
30# Delete index
31r.indexes.delete(index_uid)

If you’d like to request an SDK for a language that we don’t currently support, let us know. We’re always looking to expand our SDK offerings and would love to hear from you.