Skip to content

Empty or invalid input string. #281

@python26

Description

@python26

Using local ollama qwen3:4b The code show :extraction_data = self.format_handler.parse_output(parse_output
raise exceptions.FormatParseError("Empty or invalid input string."),but gemma3 is ok.

`
prompt = textwrap.dedent("""
Extract characters, emotions, and relationships in order of appearance.
Use exact text for extractions. Do not paraphrase or overlap entities.
Provide meaningful attributes for each entity to add context.""")

examples = [
lx.data.ExampleData(
text="ROMEO. But soft! What light through yonder window breaks? It is the east, and Juliet is the sun.",
extractions=[
lx.data.Extraction(
extraction_class="character",
extraction_text="ROMEO",
attributes={"emotional_state": "wonder"}
),
lx.data.Extraction(
extraction_class="emotion",
extraction_text="But soft!",
attributes={"feeling": "gentle awe"}
),
lx.data.Extraction(
extraction_class="relationship",
extraction_text="Juliet is the sun",
attributes={"type": "metaphor"}
),
]
)
]

input_text = "Lady Juliet gazed longingly at the stars, her heart aching for Romeo"

model_config = lx.factory.ModelConfig(
model_id="qwen3:4b",
provider_kwargs={
"model_url": os.getenv("OLLAMA_HOST", "http://localhost:11434"),
"format_type": lx.data.FormatType.JSON,
"temperature": 0.1,
"timeout": 400,
"max_tokens": 1024
},
)

result = lx.extract(
text_or_documents=input_text,
prompt_description=prompt,
examples=examples,
config=model_config,
fence_output=True,
use_schema_constraints=False
)
print(result.extractions) `

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