don't bears wear shoes?\n\nBecause they have bear feet!"),     AIMessage(content="Why don't cats play poker in the wild?\n\nToo many cheetahs!")]You can set the number of concurrent requests by using the max_concurrency parameterchain.batch([{"topic": "bears"}, {"topic": "cats"}], config={"max_concurrency": 5})    [AIMessage(content="Why don't bears wear shoes?\n\nBecause they have bear feet!"),     AIMessage(content="Sure, here's a cat joke for you:\n\nWhy don't cats play poker in the wild?\n\nToo many cheetahs!")]Async Stream‚Äãasync for s in chain.astream({"topic": "bears"}):    print(s.content, end="", flush=True)    Sure, here's a bear joke for you:        Why don't bears wear shoes?        Because they have bear feet!Async Invoke‚Äãawait chain.ainvoke({"topic": "bears"})    AIMessage(content="Why don't bears wear shoes? \n\nBecause they have bear feet!")Async Batch‚Äãawait chain.abatch([{"topic": "bears"}])    [AIMessage(content="Why don't bears wear shoes?\n\nBecause they have bear feet!")]Async Stream Intermediate Steps‚ÄãAll runnables also have a method .astream_log() which can be used to stream (as they happen) all or part of the intermediate steps of your chain/sequence. This is useful eg. to show progress to the user, to use intermediate results, or even just to debug your chain.You can choose to stream all steps (default), or include/exclude steps by name, tags or metadata.This method yields JSONPatch ops that when applied in the same order as received build up the RunState.class LogEntry(TypedDict):    id: str    """ID of the sub-run."""    name: str    """Name of the object being run."""    type: str    """Type of the object being run, eg. prompt, chain, llm, etc."""    tags: List[str]    """List of tags for the run."""    metadata: Dict[str, Any]    """Key-value pairs of metadata for the run."""    start_time: str    """ISO-8601 timestamp of when the run started."""    streamed_output_str: List[str]    """List of LLM tokens streamed by this run, if
In an effort to make it as easy as possible to create custom chains, we've implemented a "Runnable" protocol that most components implement. This is a standard interface with a few different methods, which makes it easy to define custom chains as well as making it possible to invoke them in a standard way. The standard interface exposed includes:
In an effort to make it as easy as possible to create custom chains, we've implemented a "Runnable" protocol that most components implement. This is a standard interface with a few different methods, which makes it easy to define custom chains as well as making it possible to invoke them in a standard way. The standard interface exposed includes: ->: don't bears wear shoes?\n\nBecause they have bear feet!"),     AIMessage(content="Why don't cats play poker in the wild?\n\nToo many cheetahs!")]You can set the number of concurrent requests by using the max_concurrency parameterchain.batch([{"topic": "bears"}, {"topic": "cats"}], config={"max_concurrency": 5})    [AIMessage(content="Why don't bears wear shoes?\n\nBecause they have bear feet!"),     AIMessage(content="Sure, here's a cat joke for you:\n\nWhy don't cats play poker in the wild?\n\nToo many cheetahs!")]Async Stream‚Äãasync for s in chain.astream({"topic": "bears"}):    print(s.content, end="", flush=True)    Sure, here's a bear joke for you:        Why don't bears wear shoes?        Because they have bear feet!Async Invoke‚Äãawait chain.ainvoke({"topic": "bears"})    AIMessage(content="Why don't bears wear shoes? \n\nBecause they have bear feet!")Async Batch‚Äãawait chain.abatch([{"topic": "bears"}])    [AIMessage(content="Why don't bears wear shoes?\n\nBecause they have bear feet!")]Async Stream Intermediate Steps‚ÄãAll runnables also have a method .astream_log() which can be used to stream (as they happen) all or part of the intermediate steps of your chain/sequence. This is useful eg. to show progress to the user, to use intermediate results, or even just to debug your chain.You can choose to stream all steps (default), or include/exclude steps by name, tags or metadata.This method yields JSONPatch ops that when applied in the same order as received build up the RunState.class LogEntry(TypedDict):    id: str    """ID of the sub-run."""    name: str    """Name of the object being run."""    type: str    """Type of the object being run, eg. prompt, chain, llm, etc."""    tags: List[str]    """List of tags for the run."""    metadata: Dict[str, Any]    """Key-value pairs of metadata for the run."""    start_time: str    """ISO-8601 timestamp of when the run started."""    streamed_output_str: List[str]    """List of LLM tokens streamed by this run, if