How do I create a function that takes the input_type, Configurable fields, and abitrary input? #331
Unanswered
joshuajohananorthos
asked this question in
Q&A
Replies: 2 comments 3 replies
-
@joshuajohananorthos Runnable Lambdas are not configurable right now so what you did works. Ideal end state is obviously closer to
I'm trying to expose internals now to make this easier. By the way, runnable lambdas don't support streaming, so if using runnable lambdas instead of runnable generators double check that streaming still works / or that it's not needed. |
Beta Was this translation helpful? Give feedback.
2 replies
-
@joshuajohananorthos does something like this work: This is a proposal in this PR: #333 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I keep running into an issue where I want to take the input, configuration for the models (api_key, endpoint, etc) and a Runnable Config?
I need an endpoint to give me three things:
Request
I know that I can use
per_req_config_modifier
, but that will only bind keys that are defined as fields on the chain or fields in custom types that I create beforehand. I cannot figure out how to bind both the chain and a custom type at the same time.Here is an example of the custom type I created:
This works, but I cannot then add other configurable fields into the Chain. Technically I could add them to the outer type and pass them down or add logic to determine what to do.
This is a workaround of the execution for why Configurable alternatives were created.
I cannot just create the chain and use that in
add_routes
as it needs per request information. Then if I create a function to do all of that, then I lose the context of the chain asadd_routes
inspects the function not the returned chain. Which is what lead to the types to establish a context around the function.I would like to create a parameterized function that asks for everything it needs to execute the chain without having to create all the objects in the root of a FastApi project.
It would great if I could create a chain that would execute like this:
Beta Was this translation helpful? Give feedback.
All reactions