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

Create new RunnableSerializable base class in preparation for configurable runnables #11279

Merged
merged 9 commits into from
Oct 2, 2023

Conversation

nfcampos
Copy link
Collaborator

@nfcampos nfcampos commented Oct 2, 2023

  • Also move RunnableBranch to its own file

… runnables

- Also move RunnableBranch to its own file
@nfcampos nfcampos requested a review from eyurtsev October 2, 2023 09:08
@vercel
Copy link

vercel bot commented Oct 2, 2023

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 Oct 2, 2023 9:34am

@dosubot dosubot bot added Ɑ: models Related to LLMs or chat model modules 🤖:refactor A large refactor of a feature(s) or restructuring of many files labels Oct 2, 2023
@nfcampos nfcampos changed the title Create new RunnableSerializable class in preparation for configurable runnables Create new RunnableSerializable base class in preparation for configurable runnables Oct 2, 2023
@@ -119,6 +122,24 @@ def output_schema(self) -> Type[BaseModel]:
self.__class__.__name__ + "Output", __root__=(root_type, None)
)

def config_schema(
self, *, include: Optional[Sequence[str]] = None
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you explain where this comes into play? This looks like the change I needed for remote runnables, but for that case I'm not sure I would've wanted the config defined as a method on runnables since config doesn't vary by runnable

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will make sense in the next PR :) #11282


from langchain.load.dump import dumpd
from langchain.pydantic_v1 import BaseModel
from langchain.schema.runnable.base import Runnable, RunnableSerializable
Copy link
Collaborator

Choose a reason for hiding this comment

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

is_lcserializable is a class method, so I think inheritance will work, we could define it such that anything that inherits from RunnableSerializable is in fact serializable and also provide a default namespace

Copy link
Collaborator Author

@nfcampos nfcampos Oct 2, 2023

Choose a reason for hiding this comment

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

I think that's going a bit too far for now, but would be useful in the future

@eyurtsev
Copy link
Collaborator

eyurtsev commented Oct 2, 2023

This looks good!

@nfcampos nfcampos merged commit 0638f7b into master Oct 2, 2023
@nfcampos nfcampos deleted the nc/runnable-serializable branch October 2, 2023 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ɑ: models Related to LLMs or chat model modules 🤖:refactor A large refactor of a feature(s) or restructuring of many files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants