Skip to content

Add SDE Code Search Tool for API-based code search #73

Merged
NISH1001 merged 13 commits into
developfrom
feature/code_search_tool
Jul 18, 2025
Merged

Add SDE Code Search Tool for API-based code search #73
NISH1001 merged 13 commits into
developfrom
feature/code_search_tool

Conversation

@pranath-reddy
Copy link
Copy Markdown
Member

@pranath-reddy pranath-reddy commented Jul 17, 2025

Summary 📝

This PR adds the initial implementation of the SDECodeSearchTool, which queries the SDE API for relevant code repositories. It also includes a suite of PyTests for tool validation.

Details

SDECodeSearchTool (API-Based Search via NASA SDE)

  • Introduced SDECodeSearchTool under akd.tools.code_search, a tool for querying repositories via the NASA SDE code search REST API.
  • Implements pagination, configurable via max_pages and page_size.
  • Accepts search queries and returns parsed results in the standard SearchResultItem format.
  • Uses CodeSearchToolInputSchema and CodeSearchToolOutputSchema to ensure compatibility with the base tool interface.

PyTests Added

  • Structure Tests: Validate output and input schema integrity.
  • Google Drive Link Test: Ensure data file for local tools is accessible.
  • Vectorizer Tests: Validate the embedding model.

Usage

SDE Code Search Tool

from akd.tools.code_search import (
    CodeSearchToolInputSchema,
    SDECodeSearchTool, 
    SDECodeSearchToolConfig
)

# Configure the tool
search_cfg = SDECodeSearchToolConfig(
    max_pages=2,
    page_size=10
)

# Initialize the SDE code search tool
search_tool = SDECodeSearchTool(config=search_cfg)

# Run the SDE search
result = await search_tool._arun(
    CodeSearchToolInputSchema(
        queries=["Weather prediction"],
        max_results=5
    )
)

Run tests with:

pytest tests/code_search_tool_test.py

Bugfixes 🐛 (delete if dind't have any)

Checks

  • Closed #798
  • Tested Changes
  • Stakeholder Approval

- Initial implementation of SDE code search tool
- Initial implementation of pytest tests for code search tool
- Added pytest-asyncio dependency
- Added output structure validation to tests
- Added input structure validation and google drive link test
- Added generate_embeddings method in case data is missing the embedding column
- Added vectorizer test
- Move embedding processing to init
@pranath-reddy pranath-reddy requested a review from NISH1001 July 17, 2025 05:47
@pranath-reddy pranath-reddy self-assigned this Jul 17, 2025
@pranath-reddy pranath-reddy changed the title Feature/code search tool Add SDE Code Search Tool for API-based code search Jul 17, 2025
Comment thread akd/tools/code_search.py Outdated
Comment thread akd/tools/code_search.py Outdated
Comment thread akd/tools/code_search.py
Comment thread akd/tools/code_search.py Outdated
Comment thread akd/tools/code_search.py
Comment thread examples/code_search_test.py
Comment thread tests/code_search_tool_test.py
Comment thread tests/code_search_tool_test.py
Comment thread tests/code_search_tool_test.py
- Updates to SDE code search tool based on PR feedback
Comment thread akd/tools/code_search.py Outdated
Comment thread akd/tools/code_search.py Outdated
@NISH1001
Copy link
Copy Markdown
Collaborator

@pranath-reddy this branch seems to have merge conflicts. can you check?

@NISH1001 NISH1001 merged commit 9081013 into develop Jul 18, 2025
@NISH1001 NISH1001 deleted the feature/code_search_tool branch July 18, 2025 15:28
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.

2 participants