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: make with_alisteners() example workable. #30059

Merged
merged 1 commit into from
Mar 1, 2025

Conversation

ArrayPD
Copy link
Contributor

@ArrayPD ArrayPD commented Mar 1, 2025

Description:

5 fix of example from function with_alisteners() in libs/core/langchain_core/runnables/base.py
Replace incoherent example output with workable example's output.

  1. SyntaxError: unterminated string literal
    print(f"on start callback starts at {format_t(time.time())}
    correct as
    print(f"on start callback starts at {format_t(time.time())}")

  2. SyntaxError: unterminated string literal
    print(f"on end callback starts at {format_t(time.time())}
    correct as
    print(f"on end callback starts at {format_t(time.time())}")

  3. NameError: name 'Runnable' is not defined
    Fix as
    from langchain_core.runnables import Runnable

  4. NameError: name 'asyncio' is not defined
    Fix as
    import asyncio

  5. NameError: name 'format_t' is not defined.
    Implement format_t() as
    from datetime import datetime, timezone

    def format_t(timestamp: float) -> str:
    return datetime.fromtimestamp(timestamp, tz=timezone.utc).isoformat()

5 fix of example from function with_alisteners()

1. SyntaxError: unterminated string literal
print(f"on start callback starts at {format_t(time.time())}

2. SyntaxError: unterminated string literal
print(f"on end callback starts at {format_t(time.time())}

3. NameError: name 'Runnable' is not defined

4. NameError: name 'asyncio' is not defined

5. NameError: name 'format_t' is not defined.
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 1, 2025
Copy link

vercel bot commented Mar 1, 2025

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

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Visit Preview Mar 1, 2025 11:41am

@dosubot dosubot bot added the 🤖:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs label Mar 1, 2025
@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label Mar 1, 2025
@ccurme ccurme merged commit c671d54 into langchain-ai:master Mar 1, 2025
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm PR looks good. Use to confirm that a PR is ready for merging. 🤖:nit Small modifications/deletions, fixes, deps or improvements to existing code or docs size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants