Skip to main content

Topic Initialization

Respectify assesses a comment in the context of what it is replying to or is likely about. There is an implicit assumption that all comments are about something, and that is usually an article, blog post, or similar. It doesn't have to be online: you can just give Respectify some text.

You always need to initialize a topic so that when evaluating a comment, Respectify knows the 'something' that the conversation is about.

Reference

See the Topic Initialization API Reference for method signatures and parameters.

Response: InitTopicResponse

By Example

From Text

Initialize with plain text or Markdown content. Use this when you already have the content (e.g., when integrating into a blog engine, it's more efficient to pass the Markdown or text directly rather than requiring Respectify to fetch it from a URL):

result = client.init_topic_from_text(
"This article discusses the benefits of type hints in Python. "
"Type hints improve code readability and catch errors early..."
)
article_id = result.article_id
# Store this UUID for future comment analysis

From URL

Respectify can fetch and read the contents of a webpage or document at a URL. Point it at a blog post, PDF, or other online content to use as topic context:

result = client.init_topic_from_url(
"https://your-blog.com/articles/python-type-hints"
)

article_id = result.article_id

The URL can point to an HTML page, Markdown file, PDF document, or plain text file. If the URL points to an unsupported format, the API raises an UnsupportedMediaTypeError (HTTP 415) describing the content type that was found.

Best Practices

  1. Store the article ID: Save the UUID in your database.
  2. Retain and reuse the ID: Don't re-initialize the same content unnecessarily. Each initialization is an API call, so retain the article ID and reuse it for every comment on that page or topic.
  3. Update when content changes: Re-initialize if the article is substantially edited.
  4. Use descriptive content: More context leads to better analysis.

Next Steps

Once you have an article ID: