Skip to content

out of range eror when calling intrinsics on empty contexts #937

Closed

Description

@nrfulton

Code to reproduce:

import mellea
from mellea.stdlib.components.intrinsic.rag import check_answerability

m = mellea.start_session(backend_name="hf", model_id="ibm-granite/granite-4.0-micro")
check_answerability(
    question="Does our firm have any current investments in the foo industry?",
    documents=["The user works for blah capital", "blah capital leads investment round in acme corp", "acme corp is disrupting the foo industry"],
    context=m.ctx,
    backend=m.backend
)

Expected: answerability intrinsic provides a result.

Actual: out of index error when running isinstance(conversation[0], (list, tuple)) or hasattr(conversation[0], "messages") in transformers.tokenization_utils_base

Activity

  1. added
    bug
    on Apr 25, 2026
  2. akihikokuroda commented on May 4, 2026

    @akihikokuroda
    Contributor

    The context argument of check_answerability method is expecting ChatContext instead of SimpleContext

    mypy result:

         Argument "context" to "check_answerability" has incompatible type "Context"; expected "ChatContext"  [arg-type]                                                                
         Argument "backend" to "check_answerability" has incompatible type "Backend"; expected "AdapterMixin"  [arg-type]                                                              
         Found 2 errors in 1 file (checked 1 source file) 
    

    Adding 'context_type="chat"' in the start_session method argument seems fixing this issue.

  3. added
    area/backends
    area/adapter-functions
    area/stdlib
    p1
    and removed on May 20, 2026
  4. added
    p2
    and removed
    p1
    on Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/adapter-functionsarea/backendsarea/stdlibbugp2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions