Skip to main content

Package Ingestion

Ground can index packages from npm and PyPI registries, providing accurate documentation context for your dependencies.

Why Index Packages?

When AI assistants answer questions about libraries, they often:
  • Use outdated patterns from training data
  • Hallucinate function signatures
  • Provide incorrect usage examples
Ground solves this by indexing the actual package metadata including:
  • README documentation
  • Package description and keywords
  • Type definitions (when available)
  • Version-specific information

Supported Registries

RegistryStatusContent Indexed
npm✅ SupportedREADME, package.json, types
PyPI✅ SupportedREADME, metadata, description

Creating a Package Source

curl -X POST https://api.trygroundai.com/sources \
-H "Authorization: Bearer gnd_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "lodash",
    "source_type": "package",
    "url": "lodash",
    "extra_metadata": {
      "ecosystem": "npm",
      "version": "latest"
    }
  }'

Using SDKs

// Index an npm package
const source = await client.createSource({
  name: "axios",
  source_type: "package",
  url: "axios",
  extra_metadata: {
    ecosystem: "npm",
    version: "latest"
  }
});

// Trigger sync
const job = await client.triggerSync(source.id);

What Gets Indexed

npm Packages

ContentDescription
README.mdFull README content
package.jsonName, description, keywords, dependencies
Type definitionsIf types or typings field exists

PyPI Packages

ContentDescription
READMELong description from PyPI
MetadataSummary, keywords, classifiers
Version infoCurrent version number

Version Pinning

You can index specific versions:
{
  "extra_metadata": {
    "ecosystem": "npm",
    "version": "4.17.21"  // Specific version instead of "latest"
  }
}

Search Examples

After indexing packages, search returns accurate context:
curl "https://api.trygroundai.com/search" \
  -H "Authorization: Bearer gnd_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"query": "lodash debounce function", "top_k": 5}'
Response includes:
  • README sections about debounce
  • Package description
  • Keywords and related utilities

Best Practices

Focus on packages your team actually uses. Don’t index everything from npm.
For production, pin to specific versions to avoid staleness issues.
Index both your code AND your dependencies for complete context.
Set up scheduled syncs to keep package docs fresh.

Limitations

Package ingestion currently focuses on documentation and metadata. Full source code indexing is not yet supported.
  • Source code files are not indexed (only documentation)
  • Private registries not yet supported
  • Scoped packages (@org/package) require URL encoding