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

Question about input parameters, history and sessions #38

Open
chriso0710 opened this issue Sep 20, 2023 · 2 comments
Open

Question about input parameters, history and sessions #38

chriso0710 opened this issue Sep 20, 2023 · 2 comments

Comments

@chriso0710
Copy link

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

@msoedov
Copy link
Owner

msoedov commented Oct 4, 2023

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?

@chriso0710
Copy link
Author

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.

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

No branches or pull requests

2 participants