[deprecated] Upsert Conversation
The Upsert conversation method is deprecated in favor of the Threads Ingestion Method. Please do not use Upsert for new integrations, using Threads is much simpler and less prone to user error!
Upserting a conversation is a way to continuously send a transcript of an LLM interaction to Context.ai, without needing to keep track of when the transcript ends. You can instead repeatedly send an updated conversation object as each new message arrives.
The semantics of upserting are this: If a conversation request is received that does not match a prior conversation, a new conversation is created. If the conversation request partially matches a prior conversation uploaded to Context.ai, then the prior conversation is amended with the new messages.
To use upserting, you must:
Always send conversation log requests with an increasing number of messages, always including the full conversation history in each request. Do not send log requests out of order.
Always include the same metadata on each conversation log request.
Always include at least 2 messages in the first upsert request. A conversation will only be considered a 'match' if new requests are prefixed with at least 2 messages from prior insertions/upsertions.
Upserting comes with caveats, since Context.ai uses heuristics to perform the upsert. For example, if two sets of conversation requests contain the same set of messages, then these requests may be treated as the same conversation and be incorrectly deduplicated by Context.ai. Log events must happen within 6 hours of one another to be considered for matching. To prevent this from happening, consider attaching a unique identifier (such as a user ID) to the metadata object on each request. This will allow Context.ai to correctly identify conversation uniqueness and prevent incorrect deduplication.
Upsert a Conversation
POST
https://api.context.ai/api/v1/log/conversation/upsert
Records a conversation in Context.
Request Body
Example Request
Example Response
Last updated