Skip to content

How to add the params to add_routes #322

Answered by eyurtsev
kientv asked this question in Q&A
Discussion options

You must be logged in to vote

It's an abstract method so you need to leave some implementation in place even if it's not used:

class RetrieverChain(RunnableSerializable[str, List[Document]]):
    collection_name: str
    def invoke(  
        self, input: str, config: Optional[RunnableConfig] = None
    ) -> List[Document]:
      # You can replace this with an actual implementation once you confirm that you can get streaming to work
      raise NotImplementedError('This is not implemented to make sure that `asream` is invoked.')
        

    async def astream( # <-- This needs to be async to work with langserve, since the server is async by default
        self, input: str, config: Optional[RunnableConfig] = None
    ) 

Replies: 4 comments 8 replies

Comment options

You must be logged in to vote
0 replies
Comment options

@kientv
Comment options

Comment options

You must be logged in to vote
1 reply
@kientv
Comment options

Comment options

You must be logged in to vote
6 replies
@kientv
Comment options

@eyurtsev
Comment options

@kientv
Comment options

@eyurtsev
Comment options

Answer selected by kientv
@kientv
Comment options

@eyurtsev
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants