mindsdb icon indicating copy to clipboard operation
mindsdb copied to clipboard

add LLM-based generation completions end point to knowledge base

Open dusvyat opened this issue 1 year ago • 0 comments

Description

Add LLM Based generations endpoint to knowledge base, this will allow standalone RAG on Knowledge base.

I have made retrieval_config optional, so if not specified defaults will be used.

This endpoint will also support reranking config FYI

e.g.


# First, create a knowledge base to use in the test
    create_kb_request = {
        'knowledge_base': {
            'name': 'test_completions_kb',
            'model': 'test_embedding_model'
        }
    }
    create_kb_response = client.post('/api/projects/mindsdb/knowledge_bases', json=create_kb_request, follow_redirects=True)
    assert '201' in create_kb_response.status

    # Test successful completion
    completion_request = {
        'query': 'What is the capital of France?',
        'knowledge_base': 'test_completions_kb'
    }
    completion_response = client.post('/api/projects/mindsdb/knowledge_bases/test_completions_kb/completions',
                                      json=completion_request, follow_redirects=True)

Fixes ML-166

Type of change

(Please delete options that are not relevant)

  • [ ] 🐛 Bug fix (non-breaking change which fixes an issue)
  • [ ] ⚡ New feature (non-breaking change which adds functionality)
  • [ ] 📢 Breaking change (fix or feature that would cause existing functionality not to work as expected)
  • [ ] 📄 This change requires a documentation update

Verification Process

To ensure the changes are working as expected:

  • [ ] Test Location: Specify the URL or path for testing.
  • [ ] Verification Steps: Outline the steps or queries needed to validate the change. Include any data, configurations, or actions required to reproduce or see the new functionality.

Additional Media:

  • [ ] I have attached a brief loom video or screenshots showcasing the new functionality or change.

Checklist:

  • [ ] My code follows the style guidelines(PEP 8) of MindsDB.
  • [ ] I have appropriately commented on my code, especially in complex areas.
  • [ ] Necessary documentation updates are either made or tracked in issues.
  • [ ] Relevant unit and integration tests are updated or added.

dusvyat avatar Oct 17 '24 15:10 dusvyat