View Source LangChain.Tools.DeepResearch.ResearchResult (LangChain v0.4.0)

Represents the final result of a completed Deep Research request.

This schema captures the research findings, citations, usage statistics, and other metadata from a successful research operation.

Summary

Functions

Creates a changeset for research result.

Formats the result for display, including the main text and source summary.

Creates a ResearchResult from an OpenAI API response.

Gets the total number of sources cited in the research.

Extracts just the URLs from the sources for easy reference.

Gets the total number of tool calls made during research.

Types

@type t() :: %LangChain.Tools.DeepResearch.ResearchResult{
  completion_time: integer() | nil,
  created_at: integer() | nil,
  id: String.t(),
  model: String.t() | nil,
  output_text: String.t(),
  sources: [any()],
  tool_calls: [any()],
  usage: any() | nil
}

Functions

Link to this function

changeset(result \\ %__MODULE__{}, attrs)

View Source
@spec changeset(t(), map()) :: Ecto.Changeset.t()

Creates a changeset for research result.

Link to this function

format_for_display(result)

View Source
@spec format_for_display(t()) :: String.t()

Formats the result for display, including the main text and source summary.

Link to this function

from_api_response(response)

View Source
@spec from_api_response(map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}

Creates a ResearchResult from an OpenAI API response.

Link to this function

source_count(research_result)

View Source
@spec source_count(t()) :: integer()

Gets the total number of sources cited in the research.

Link to this function

source_urls(research_result)

View Source
@spec source_urls(t()) :: [String.t()]

Extracts just the URLs from the sources for easy reference.

Link to this function

tool_call_count(research_result)

View Source
@spec tool_call_count(t()) :: integer()

Gets the total number of tool calls made during research.