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

core[patch]: Correctly order parent ids in astream events (from root to immediate parent), add defensive check for cycles #22637

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

eyurtsev
Copy link
Collaborator

@eyurtsev eyurtsev commented Jun 6, 2024

This PR makes two changes:

  1. Fixes the order of parent IDs to be from root to immediate parent
  2. Adds a simple defensive check for cycles

Copy link

vercel bot commented Jun 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Jun 6, 2024 8:33pm

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. 🤖:improvement Medium size change to existing code to handle new use-cases labels Jun 6, 2024
@eyurtsev eyurtsev changed the title core[minor]: Add defensive check in astream events for cycles in run tree core[patch]: Correctly order parent ids in astream events (from root to immediate parent), add defensive check for cycles Jun 6, 2024
@@ -118,13 +118,20 @@ def __init__(
def _get_parent_ids(self, run_id: UUID) -> List[str]:
"""Get the parent IDs of a run (non-recursively) cast to strings."""
parent_ids = []
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

list of parents ids isn't big so using list instead of deque

@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Jun 6, 2024
@eyurtsev eyurtsev enabled auto-merge (squash) June 6, 2024 20:37
@eyurtsev eyurtsev merged commit 28f744c into master Jun 6, 2024
96 checks passed
@eyurtsev eyurtsev deleted the eugene/check_cycles_2 branch June 6, 2024 20:37
JonZeolla pushed a commit to JonZeolla/langchain that referenced this pull request Jun 11, 2024
…to immediate parent), add defensive check for cycles (langchain-ai#22637)

This PR makes two changes:

1. Fixes the order of parent IDs to be from root to immediate parent
2. Adds a simple defensive check for cycles
hinthornw pushed a commit that referenced this pull request Jun 20, 2024
…to immediate parent), add defensive check for cycles (#22637)

This PR makes two changes:

1. Fixes the order of parent IDs to be from root to immediate parent
2. Adds a simple defensive check for cycles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:improvement Medium size change to existing code to handle new use-cases lgtm PR looks good. Use to confirm that a PR is ready for merging. size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants