run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
36.47k stars 5.21k forks source link

[Feature Request]: Supporting routing via Not Diamond #15161

Closed acompa closed 1 month ago

acompa commented 2 months ago

Feature Description

Hi llama_index folks! As a fan of your library, I want to contribute a routing integration supported by Not Diamond.*

Our API works similarly to your standalone selector functionality. We expect to route prompts across multiple indexes, though, similar to PydanticMultiSelector.

That said, I also see that other routing options implemented as contributing LLMs. See OpenRouter and Unify for examples.

I have some questions before starting our contribution:

Thanks for fielding these questions - really looking forward to adding our routing to llama_index!!


* _Briefly, on us: we're offering AI-powered routing for LLM prompts, so that users can focus on workflows and prompts instead of integrating with the latest LLM releases or various provider libraries. You can watch Tomas walk through our SDK here._

Reason

Time, implementation bandwidth etc

Value of Feature

Routing selection via Not Diamond can help llama_index users benefit from both higher prompt accuracy and lower cost.

acompa commented 2 months ago

Okay, I believe I want to create a NotDiamondRouterQueryEngine, which folks can then call via

notdiamond = NotDiamondQueryEngine()
messages = [...]
response = notdiamond.query(messages)
print(str(response.metadata["selector_result"]))

More details:

acompa commented 2 months ago

Changed my implementation slightly towards defining a NotDiamondSelector which folks can use within a RouterQueryEngine or as a standalone selector. Details available in the linked PR above ^^.