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

[docs]: copying threads #1350

Merged
merged 5 commits into from
Aug 15, 2024
Merged

[docs]: copying threads #1350

merged 5 commits into from
Aug 15, 2024

Conversation

isahers1
Copy link
Contributor

No description provided.

}'
```

### Thread creation
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think we need this section at all, we can just add a note to the section below saying "This assumes that a thread you'd like to copy already exists"

original_thread_history = list(map(remove_thread_id,await client.threads.get_history(<THREAD_ID>)))
copied_thread_history = list(map(remove_thread_id,await client.threads.get_history(copied_thread['thread_id'])))

if original_thread_history == copied_thread_history:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit) maybe just do assert original == copied? hopefully we will never see "histories are different" :)

const copiedThreadHistory = (await client.threads.getHistory(copiedThreadId)).map(removeThreadId);

// Compare the two histories
if (JSON.stringify(originalThreadHistory) === JSON.stringify(copiedThreadHistory)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same -- maybe just console.assert?

@@ -0,0 +1,165 @@
# Copying Threads

You may wish to copy an existing thread in order to keep the existing history and experiment with different runs in the future.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe something like "You may wish to copy (i.e. "fork") an existing thread in order to keep the existing thread's history and create independent runs that do not affect the original thread. This guide shows how you can do that."


## Setup

To copy a thread, we must first set up our client and also create a thread we wish to copy.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think we need to actually create one, we can just say "we assume you already have a thread to copy. if not, see this guide on how to make one"

@isahers1 isahers1 merged commit 388a964 into main Aug 15, 2024
46 checks passed
@isahers1 isahers1 deleted the isaac/threadcopying branch August 15, 2024 18:19
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.

2 participants