This guide goes over automatic insights generated by Honcho. An example of this being used can be found in Curation Buddy

Honcho will do automatic reasoning for you to derive facts about users and allow your own agents to use them to reason about the user’s needs. There are two aspects to this:

  1. Automatic Fact Derivation
  2. Dialectic Endpoint

Automatic Fact Derivation

When you are saving conversations in sessions and messages via Honcho an automatic callback is run that will reason about the conversations and store facts in a collection named Honcho. This is a reserved collection specifically for the backend Honcho agent to interact with.

These facts are derived asynchonously and automatically as your users interact with your agents.

Dialectic Endpoint

You can make use the automatically derived facts in the Honcho collection directly by querying the documents stored in it, but an alternative is to use the *Dialectic Endpoint`. What this is, is an endpoint that allows you to talk to an agent that can automatically take the collection into their context and reason about the users with you.

This chat interface is exposed via the Sessions object.

Belows is some example code on how this works.

from honcho import Honcho

honcho = Honcho()

# Create or get an existing App
app = honcho.apps.get_or_create(name="demo-app")

# create or get user
user = honcho.apps.users.get_or_create(app_id=app.id, name="demo-user")

# create a new session
session = honcho.apps.users.session.create(app_id=app.id, user_id=user.id)

# Talk to the dialectic agent to reason about their needs
answer = honcho.apps.users.session.chat(app_id=app.id, user_id=user.id, session_id=session.id, query="What is the user's favorite way of completing the task")