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

Organize chains code. Separate 'remote' code. #1265

Merged
merged 4 commits into from
Dec 5, 2024
Merged

Conversation

marius-baseten
Copy link
Contributor

@marius-baseten marius-baseten commented Dec 5, 2024

🚀 What

  • Organize code into "remote_chainlet" (that runs in the deployed chainlets), "deployment" (code gen and push to baseten) and everything else.
    • In the future this allows to make remote dependencies optional, and conversely leave out the deployment dependencies in the remote deployment.
  • Move error handling code from stub.py -> remote_chainlet.utils.py.
  • Add back fastapi dependency to defaults, since chains needs it (still) - current release is broken in that regard.
  • Fix deprecated control server tests.
  • Fix chains streaming: make sure generator runs in the context managers of def predict(...).

Note: at the surface level, the chains API stays the same, through the uniform export of symbols in __ini__.py.

💻 How

🔬 Testing

parts.append(
_indent(f"result = {maybe_await}self._chainlet.{run_remote}({args})", 2)
)
if chainlet_descriptor.endpoint.is_streaming:
# Streaming returns raw iterator, no pydantic model.
parts.append(_indent("return result"))
# This needs to be nested inside the `trace_parent` context!
parts.append(_indent("async for chunk in result:", 2))
Copy link
Collaborator

Choose a reason for hiding this comment

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

just to be clear, the problem with just returning the result is that the actual generator executes outside of the context of the trace parent right?

@marius-baseten marius-baseten merged commit 77343fb into main Dec 5, 2024
4 checks passed
@marius-baseten marius-baseten deleted the marius/chains-org branch December 5, 2024 21:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants