NVIDIA / NeMo-Guardrails

NeMo Guardrails is an open-source toolkit for easily adding programmable guardrails to LLM-based conversational systems.
Other
4.21k stars 400 forks source link

How can I pass in class in context. #746

Closed nhantran0506 closed 2 months ago

nhantran0506 commented 2 months ago

I wonder how can I pass in classes for variable in context just like below. I can not find any example about this, only see text and number

[{"role": "context", "content": {
        "index_store" : IndexClass,
        "retrieval_config" : retrieval_config,
        "retriver" : RetriverClass,
      }}]
Pouyanpi commented 2 months ago

It only works if the values provided are JSON Serializable as its corresponding event will be stored to a dictionary for caching. And Could you please elaborate on why you need this feature?

nhantran0506 commented 2 months ago

It only works if the values provided are JSON Serializable as its corresponding event will be stored to a dictionary for caching. And Could you please elaborate on why you need this feature?

Well, it is easier if I can execute a class method from outside and not set up that class all again in the action.