Chat With Target Context
Engage in contextual, multi-turn conversations with Puppilot, leveraging existing chat transcripts and conversation history.
Overview
The Chat With Target Context endpoint empowers you to have dynamic, multi-turn conversations with Puppilot. It’s designed for scenarios where understanding previous interactions or external information is crucial for generating the most relevant and coherent responses.
Puppilot can leverage two key pieces of information you provide:
- Target Context (
target_context
): This is an external body of text, such as a detailed transcript of a telehealth session with a pet owner, a set of case notes, or any other relevant document. Puppilot uses this as a knowledge base for the conversation. - Chat History: The backend automatically maintains the history of your conversation with Puppilot using a unique
conversation_id
. This allows for natural, connected dialogue across multiple requests.
This endpoint is ideal for in-depth discussions, follow-up questions, or any interaction where context significantly influences the desired output.
Authentication: Calls to this endpoint must be authenticated using a Bearer token in the Authorization
header. You can obtain this token via the User Login endpoint documented under the API Reference for Multi-Shot Endpoints.
How It Works
When you send a request, you provide:
- Your current
message
to Puppilot. - The
target_context
you want Puppilot to reference (optional). - A
conversation_id
to maintain conversation context. For the first request, omit this field and the API will generate a newconversation_id
. Include this in subsequent requests to maintain conversation context.
Puppilot processes your message by considering both the specific context provided and the history of your conversation (maintained via conversation_id
), aiming to deliver an informed and relevant response.
Key Use Cases
- Analyzing Transcripts: Upload a telehealth consultation transcript as the
target_context
and ask Puppilot follow-up questions or request summaries based on that specific interaction. - Interactive Case Review: Provide patient medical records or case notes as the
target_context
and discuss diagnostic possibilities or treatment options with Puppilot, referencing details from the notes. - Iterative Information Refinement: Engage in a step-by-step dialogue with Puppilot, building upon previous interactions (maintained via
conversation_id
) to explore a topic thoroughly, all while keeping an external document (intarget_context
) as a central reference point.
Request
- Endpoint:
POST /chat
- Base URL:
https://agents.puppilot.co
- Authentication:
Bearer <YOUR_ACCESS_TOKEN>
in the Authorization header. - API Versioning: Include the header
X-API-Version: 0.2.0
in your requests.
Request Body
message
(string, required): Your current question, statement, or instruction for Puppilot.target_context
(string, optional): The external text or transcript that Puppilot should use as a reference for this conversational turn. This provides the background information.conversation_id
(string, optional): For the first request, omit this field and the API will generate a newconversation_id
. Include this in subsequent requests to maintain conversation context.
Example Request (First Request)
This example shows a user starting a new conversation by asking for guidance on urgent signs for a rabbit named Nibbles, providing the vet-owner chat transcript as context.
Example Request (Subsequent Request)
This example shows a follow-up question in the same conversation, using the conversation_id
from the previous response.
Response
Successful Response (200 OK)
A successful request will return a JSON object containing Puppilot’s response.
output
(string): Puppilot’s generated textual response, informed by yourmessage
, thetarget_context
, and the conversation history (maintained viaconversation_id
).conversation_id
(string): The unique identifier for this conversation. Use thisconversation_id
in all subsequent requests to maintain conversation context.
Example Successful Response
Error Responses
The API uses standard HTTP status codes to indicate the success or failure of a request.
- 400 Bad Request: This may indicate that your request was malformed, such as missing required fields (e.g.,
message
) or if the JSON structure is invalid. Example: - 401 Unauthorized: This error means that the
Authorization
header was missing or contained an invalid or expired Bearer token. Example: - 5xx Server Error: If Puppilot encounters an internal issue while processing your request, a 5xx error may be returned. This usually indicates a problem on our end, and we appreciate it if you report such occurrences.