Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fork conversation function #1241

Merged
merged 4 commits into from
Sep 7, 2024
Merged

Add Fork conversation function #1241

merged 4 commits into from
Sep 7, 2024

Conversation

Josh-XT
Copy link
Owner

@Josh-XT Josh-XT commented Sep 7, 2024

Add Fork conversation function for #1238

  • Endpoint is POST /api/conversation/fork

Input:

{
  "conversation_name": "The name of the conversation",
  "message_id": "ID of the message to fork the conversation at"
}

Output:

{
  "message": "The new conversation name from the fork"
}

Python SDK Updated

Usage:

from agixtsdk import AGiXTSDK

# Initialize AGiXT SDK
agixt = AGiXTSDK(base_uri="http://localhost:7437", api_key="Your API Key or JWT", verbose=True)

# Get an existing conversation
conversation_name = "Your Conversation"
conversation = agixt.get_conversation(
    agent_name=agent_name, conversation_name=conversation_name, limit=100, page=1
)

# Fork the conversation at the first response as an example, change the 1 to whichever number response you want, or use a message ID you have already.
forked_conversation = agixt.fork_conversation(
    conversation_name=conversation_name, message_id=conversation[1]["id"]
)

# Get the forked conversation interactions
fork = agixt.get_conversation(
    agent_name=agent_name,
    conversation_name=forked_conversation,
)

@Josh-XT Josh-XT marked this pull request as ready for review September 7, 2024 01:05
@Josh-XT Josh-XT merged commit fc8c32a into main Sep 7, 2024
7 checks passed
@Josh-XT Josh-XT deleted the 1238 branch September 7, 2024 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant