Anonymous View
Skip to content

Reading text from LlmGenerateTextResult requires an undocumented helper #190

@jakobklippel

Description

@jakobklippel

Context

LlmGenerateTextResult.message.content is typed as string | LlmContentBlock[]. For all currently supported providers (Claude, OpenAI), it is always a LlmContentBlock[] — so the obvious result.data.message.content as string yields [object Object] at runtime. Extracting the plain text requires importing extractText from @loopstack/llm-provider-module, which is not surfaced in any public doc and is only discoverable by reading source.

What to do

Make "give me the text" the obvious operation on an LlmGenerateText result.

Affected area

  • Package(s): @loopstack/llm-provider-module
  • Docs: build/ai/text-generation.md

Acceptance criteria

  • A developer who has read only the public docs and seen the tool's call signature can reliably get a string out of the result on the first attempt.
  • Existing consumers (registry examples, sandbox apps) continue to work or are migrated.

Additional context

Surfaced during a benchmark agent session where the agent extracted the wrong thing from the result, saved a malformed message document, and could not see why the summary did not render in Studio.

Metadata

Metadata

Assignees

Labels

priority:p2Medium prioritytaskGeneral task / chore

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions