Skip to content

Add ExaDocumentLoader module to langchain4j-community#613

Open
harikrishna553 wants to merge 1 commit intolangchain4j:mainfrom
harikrishna553:feature/community-document-loader-exa
Open

Add ExaDocumentLoader module to langchain4j-community#613
harikrishna553 wants to merge 1 commit intolangchain4j:mainfrom
harikrishna553:feature/community-document-loader-exa

Conversation

@harikrishna553
Copy link
Copy Markdown
Contributor

Add ExaDocumentLoader module to langchain4j-community

Summary

This PR adds a new community module langchain4j-community-document-loader-exa to the LangChain4j ecosystem.
It provides a ready-to-use connector for the Exa Search API, allowing retrieval of web documents as Document objects enriched with metadata.


Features

  • ExaDocumentLoader: Loads documents from Exa Search API based on a query.
  • Search types via ExaSearchType:
    • AUTO – Balanced default mode combining quality and latency.
    • FAST – Optimized for low-latency, factual queries.
    • DEEP – Comprehensive multi-step and agentic retrieval.
    • NEURAL – Semantic/embedding-based exploratory search.
  • Flexible content resolution:
    • Includes full text if available and enabled.
    • Falls back to highlights or title when full text is unavailable.
  • Metadata extraction:
    • Title, URL, Exa result ID, publication date, author, relevance score.
  • Builder pattern:
    • Configure API key, number of results, search type, text inclusion, custom HTTP client, and custom ObjectMapper.
  • Consistent error handling:
    • All API and parsing errors are wrapped in ExaDocumentLoaderException.

Example Usage

ExaDocumentLoader loader = ExaDocumentLoader.builder()
    .apiKey("your-api-key")
    .numResults(5)
    .searchType(ExaSearchType.AUTO)
    .includeText(true)
    .build();

List<Document> documents = loader.loadDocuments("latest AI research");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant