Skip to content

Prompt exceeds max context length error (LeapGenerationPromptExceedContextLengthException) #30

Description

@Asim-App

When I try to send a long prompt, I get the following error:

LeapGenerationPromptExceedContextLengthException
Prompt too long: The prompt exceeds the max context length of 4096 tokens.

Steps to Reproduce:

Load model using Leap SDK.
Pass a prompt longer than 4096 tokens.
Observe the error.

Expected Behavior:
The SDK should:

Either automatically truncate the prompt or provide a clear way to handle longer inputs.
Expose the max context length in the API so developers can validate before sending.

Actual Behavior:
Error is thrown directly without any way to manage/handle the prompt size.

Additional Context:

There’s also no option in SDK to clear prompt history or reset the conversation without unloading the model.
It would be helpful if there’s a method like resetHistory() or truncatePrompt().
Also, please confirm if token size limit is fixed per model or configurable.

Environment:

Leap SDK version: v0.5.0
Platform: Android (Kotlin)
Device: Pixel 9 pro
Model: LFM2-700M

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions