'string'},        'additional_kwargs': {'title': 'Additional Kwargs', 'type': 'object'},        'type': {'title': 'Type',         'default': 'chat',         'enum': ['chat'],         'type': 'string'},        'role': {'title': 'Role', 'type': 'string'},        'is_chunk': {'title': 'Is Chunk',         'default': True,         'enum': [True],         'type': 'boolean'}},       'required': ['content', 'role']},      'FunctionMessageChunk': {'title': 'FunctionMessageChunk',       'description': 'A Function Message chunk.',       'type': 'object',       'properties': {'content': {'title': 'Content', 'type': 'string'},        'additional_kwargs': {'title': 'Additional Kwargs', 'type': 'object'},        'type': {'title': 'Type',         'default': 'function',         'enum': ['function'],         'type': 'string'},        'name': {'title': 'Name', 'type': 'string'},        'is_chunk': {'title': 'Is Chunk',         'default': True,         'enum': [True],         'type': 'boolean'}},       'required': ['content', 'name']},      'SystemMessageChunk': {'title': 'SystemMessageChunk',       'description': 'A System Message chunk.',       'type': 'object',       'properties': {'content': {'title': 'Content', 'type': 'string'},        'additional_kwargs': {'title': 'Additional Kwargs', 'type': 'object'},        'type': {'title': 'Type',         'default': 'system',         'enum': ['system'],         'type': 'string'},        'is_chunk': {'title': 'Is Chunk',         'default': True,         'enum': [True],         'type': 'boolean'}},       'required': ['content']}}}Stream‚Äãfor s in chain.stream({"topic": "bears"}):    print(s.content, end="", flush=True)    Why don't bears wear shoes?         Because they have bear feet!Invoke‚Äãchain.invoke({"topic": "bears"})    AIMessage(content="Why don't bears wear shoes?\n\nBecause they have bear feet!")Batch‚Äãchain.batch([{"topic": "bears"}, {"topic": "cats"}])    [AIMessage(content="Why don't bears wear shoes?\n\nBecause they have
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: ->: 'string'},        'additional_kwargs': {'title': 'Additional Kwargs', 'type': 'object'},        'type': {'title': 'Type',         'default': 'chat',         'enum': ['chat'],         'type': 'string'},        'role': {'title': 'Role', 'type': 'string'},        'is_chunk': {'title': 'Is Chunk',         'default': True,         'enum': [True],         'type': 'boolean'}},       'required': ['content', 'role']},      'FunctionMessageChunk': {'title': 'FunctionMessageChunk',       'description': 'A Function Message chunk.',       'type': 'object',       'properties': {'content': {'title': 'Content', 'type': 'string'},        'additional_kwargs': {'title': 'Additional Kwargs', 'type': 'object'},        'type': {'title': 'Type',         'default': 'function',         'enum': ['function'],         'type': 'string'},        'name': {'title': 'Name', 'type': 'string'},        'is_chunk': {'title': 'Is Chunk',         'default': True,         'enum': [True],         'type': 'boolean'}},       'required': ['content', 'name']},      'SystemMessageChunk': {'title': 'SystemMessageChunk',       'description': 'A System Message chunk.',       'type': 'object',       'properties': {'content': {'title': 'Content', 'type': 'string'},        'additional_kwargs': {'title': 'Additional Kwargs', 'type': 'object'},        'type': {'title': 'Type',         'default': 'system',         'enum': ['system'],         'type': 'string'},        'is_chunk': {'title': 'Is Chunk',         'default': True,         'enum': [True],         'type': 'boolean'}},       'required': ['content']}}}Stream‚Äãfor s in chain.stream({"topic": "bears"}):    print(s.content, end="", flush=True)    Why don't bears wear shoes?         Because they have bear feet!Invoke‚Äãchain.invoke({"topic": "bears"})    AIMessage(content="Why don't bears wear shoes?\n\nBecause they have bear feet!")Batch‚Äãchain.batch([{"topic": "bears"}, {"topic": "cats"}])    [AIMessage(content="Why don't bears wear shoes?\n\nBecause they have