MCPcopy
hub / github.com/Effect-TS/effect / emitReasoningPart

Function emitReasoningPart

packages/ai/openrouter/src/OpenRouterLanguageModel.ts:768–793  ·  view source on GitHub ↗
(delta: string, metadata: OpenRouterReasoningInfo | undefined = undefined)

Source from the content-addressed store, hash-verified

766 // Reasoning Parts
767
768 const emitReasoningPart = (delta: string, metadata: OpenRouterReasoningInfo | undefined = undefined) => {
769 // End in-progress text part if present before starting reasoning
770 if (Predicate.isNotUndefined(activeTextId)) {
771 parts.push({
772 type: "text-end",
773 id: activeTextId
774 })
775 activeTextId = undefined
776 }
777 // Start a new reasoning part if necessary
778 if (Predicate.isUndefined(activeReasoningId)) {
779 activeReasoningId = (idCounter++).toString()
780 parts.push({
781 type: "reasoning-start",
782 id: activeReasoningId,
783 metadata: { openrouter: metadata }
784 })
785 }
786 // Emit the reasoning delta
787 parts.push({
788 type: "reasoning-delta",
789 id: activeReasoningId,
790 delta,
791 metadata: { openrouter: metadata }
792 })
793 }
794
795 if (Predicate.isNotNullable(delta?.reasoning_details) && delta.reasoning_details.length > 0) {
796 for (const detail of delta.reasoning_details) {

Callers 1

Calls 1

toStringMethod · 0.65

Tested by

no test coverage detected