sweepai / sweep

Sweep: open-source AI-powered Software Developer for small features and bug fixes.
https://sweep.dev
Other
7.46k stars 430 forks source link

Add unit tests for vector_db.py #4071

Closed sweep-nightly[bot] closed 4 months ago

sweep-nightly[bot] commented 5 months ago

Purpose

This pull request adds unit tests for the vector_db.py file, which contains the main implementation of the vector database functionality.

Description

The changes include:

  1. Creating a new file test_vector_db.py in the sweepai/core/ directory.
  2. Implementing test functions for the following functionalities:
    • embed_text_array
    • openai_call_embedding
    • normalize_l2
    • Caching functionality
    • cosine_similarity
    • multi_get_query_texts_similarity
  3. Adding a mock test for embed_text_array to avoid calling the actual OpenAI API during testing.
  4. Including a if __name__ == "__main__": block to allow running the tests directly from the file.

Summary

Suggested changes from Sweep Chat by @kevinlu1248. Continue chatting at http://localhost:3000/c/16ef85d9-bfe6-4427-ad23-cfa483609ee2.

vercel[bot] commented 5 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sweep-chat 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 2:02am
sweep-chat-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 2:02am
sweep-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 2:02am
sweep-pulley 🔄 Building (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 2:02am