Interface ResponseContentMatcher

Clients can contribute response content matchers to parse a chat response into specific ChatResponseContent instances.

interface ResponseContentMatcher {
    contentFactory: ResponseContentFactory;
    end: RegExp;
    incompleteContentFactory?: ResponseContentFactory;
    start: RegExp;
}

Properties

contentFactory: ResponseContentFactory

The factory creating a response content from the matching content, from start index to end index of the match (including delimiters).

end: RegExp

Regular expression for finding the start delimiter.

incompleteContentFactory?: ResponseContentFactory

Optional factory for creating a response content when only the start delimiter has been matched, but not yet the end delimiter. Used during streaming to provide better visual feedback. If not provided, the default content factory will be used until the end delimiter is matched.

start: RegExp

Regular expression for finding the start delimiter.