Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add enhanced memory methods: uploadText, uploadFromSearch, uploadFromCrawl #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
Copilot wants to merge 2 commits into main
base: main
Choose a base branch
Loading
from copilot/fix-6a783a20-e55d-462d-aafa-b21adede7c78

Conversation

Copy link

Copilot AI commented Sep 22, 2025
edited
Loading

This PR adds three powerful new memory methods that significantly improve the developer experience for populating Langbase memory from various content sources.

New Methods

memories.uploadText()

Upload text content directly to memory without file handling:

await langbase.memories.uploadText({
 memoryName: 'my-memory',
 text: 'Your content here...',
 documentName: 'optional-name.txt', // Auto-generates if not provided
 meta: { type: 'user-content' }
});

memories.uploadFromSearch()

Search the web and upload results directly to memory:

await langbase.memories.uploadFromSearch({
 memoryName: 'research-memory',
 query: 'What is artificial intelligence?',
 service: 'exa',
 totalResults: 5,
 apiKey: 'your-exa-key',
 documentNamePrefix: 'ai-research'
});

memories.uploadFromCrawl()

Crawl URLs and upload content directly to memory:

await langbase.memories.uploadFromCrawl({
 memoryName: 'docs-memory',
 url: ['https://example.com', 'https://example.com/about'],
 maxPages: 2,
 apiKey: 'your-crawl-key',
 service: 'spider'
});

Key Features

  • Seamless Integration: Leverages existing webSearch and webCrawl tools without modification
  • Smart Content Formatting: Combines URL and content for better context in search/crawl results
  • Automatic Metadata: Adds source tracking (search query, URLs, services used) to all uploads
  • Flexible Document Naming: Auto-generation with timestamps or custom prefixes
  • Type Safety: Complete TypeScript interfaces with proper exports
  • Error Handling: Comprehensive error propagation and validation

Implementation Details

The methods follow the same upload pattern as existing uploadDocs(), using the signed URL approach for efficient content upload. Search and crawl methods return arrays of responses for batch operations, while text upload returns a single response.

Content from search/crawl is formatted as:

URL: https://example.com
Content:
[Page content here...]

Testing & Documentation

  • ✅ 5 comprehensive test cases covering all methods and edge cases
  • ✅ Complete working examples for each method
  • ✅ Full API documentation with parameter descriptions
  • ✅ TypeScript compilation and type exports verified

This enhancement addresses the common need to populate memory from various sources and provides a streamlined developer experience for building knowledge bases, research collections, and content repositories.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /usr/local/bin/node /home/REDACTED/work/langbase-sdk/langbase-sdk/node_modules/.pnpm/next@14.2.5_@playwright+test@1.50.1_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/next/dist/compiled/jest-worker/processChild.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

...Crawl
Co-authored-by: ahmadawais <960133+ahmadawais@users.noreply.github.com>
Copilot AI changed the title (削除) [WIP] memory: make better memory methods like uploadText, and others like where a tool like search or web fetch is used to add content from a page to memory (削除ここまで) (追記) Add enhanced memory methods: uploadText, uploadFromSearch, uploadFromCrawl (追記ここまで) Sep 22, 2025
Copilot AI requested a review from ahmadawais September 22, 2025 01:32
Copy link
Member

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

Reviewers

@ahmadawais ahmadawais Awaiting requested review from ahmadawais

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

AltStyle によって変換されたページ (->オリジナル) /