Question about input parameters, history and sessions
Hi there, I just found this repo and it looks very promising.
I have a few qestions, which I could not find in the documentation:
- how exactly does langcorn "know" or identify which input parameters are available in the llm chain?
- I could not find an example for handling memory in a conversation bot? how does this work? the history has always be handled on the client and send as a parameter on every request?
- additional question: are you planning any kind of session handling (like session ids and history) on the server side?
Thank you and best regards Christian
Hi @chriso0710 !
how exactly does langcorn "know" or identify which input parameters are available in the llm chain?
It's done through a pattern-matching
def derive_fields(language_app: Chain) -> (list[str], list[str]):
match language_app:
case Chain(input_variables=input_variables, output_variables=output_variables):
return input_variables, output_variables
case FnWrapper(
input_variables=input_variables, output_variables=output_variables
):
return input_variables, output_variables
case Chain(prompt=prompt, output_key=output_key):
return prompt.input_variables, [output_key]
case Chain(input_keys=input_keys, output_key=output_key):
return input_keys, [output_key]
case _:
return [language_app.input_key], ["output"]
I could not find an example for handling memory in a conversation bot? how does this work? the history has always be handled on the client and send as a parameter on every request?
Right, because currently, there is no support for user sessions. That would allow us to persist the history on the server side.
additional question: are you planning any kind of session handling (like session ids and history) on the server side?
I am open to suggestions or feature requests. How would you configure or implement a user session for your app?
Ok, thanks for the answers!
I think authentication and sessions for the api requests could be implemented via json web tokens. The server would then also need some kind of storage for api users, tokens, history. This could be in memory or in a database. This might be out of scope for your project ATM, but could become neccesary in the future and/or in production environments.