langflow-ai / langflow

Langflow is a low-code app builder for RAG and multi-agent AI applications. It’s Python-based and agnostic to any model, API, or database.
http://www.langflow.org
MIT License
35.89k stars 4.25k forks source link

feat: Add combinatorial reasoning as a component #4782

Closed TarunAdvaithK closed 21 hours ago

TarunAdvaithK commented 6 days ago

This PR introduces Icosa's combinatorial reasoner (CR as a component to LangFlow, added as a tool. The component allows users to run the CR pipeline on their queries to generate optimized prompts by calling Icosa's API. This includes adding the component code in the backend under tools, adding Icosa's icon to the frontend, and updating the docs. To run CR through the component, users will need an OpenAI API Key as well as username-password authentication from Icosa.

@NadirJ This passes the make lint command. The make unit_tests command intermittently passes or has one failure. The specific test that occasially fails is the following: src/backend/tests/unit/test_database.py:178 test_read_flows_components_only_paginated

However, running only this test using pytest src/backend/tests/unit/test_database.py::test_read_flows_components_only_paginated passes every time. Unsure about why the make unit_tests command has intermittent failures, I have included the error message below.

―――――――――――――――― test_read_flows_components_only_paginated ―――――――――――――――――
[gw3] darwin -- Python 3.12.6 /Users/tarun/langflow/.venv/bin/python

client = <httpx.AsyncClient object at 0x3071450d0>
logged_in_headers = {'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6Ik
pXVCJ9.eyJzdWIiOiIzNzRiZTlhZS1kNDY4LTQ4ZjQtODc0ZC0zMDc2NDAyODgzNWIiLCJ0eXBlI
joiYWNjZXNzIiwiZXhwIjoxNzMyMTQzNjM1fQ.F7AJeBtbangrmZrg-KVc7hrn07OGI4ijvQv1uh
P0_W0'}

    async def test_read_flows_components_only_paginated(client: AsyncClient,
 logged_in_headers):
        number_of_flows = 10
        flows = [
            FlowCreate(name=f"Flow {i}", description="description", data={},
 is_component=True)
            for i in range(number_of_flows)
        ]
        for flow in flows:
            response = await client.post("api/v1/flows/", json=flow.model_du
mp(), headers=logged_in_headers)
            assert response.status_code == 201
        response = await client.get(
            "api/v1/flows/", headers=logged_in_headers, params={"components_
only": True, "get_all": False}
        )
        assert response.status_code == 200
        response_json = response.json()
>       assert response_json["total"] == 10
E       assert 0 == 10

src/backend/tests/unit/test_database.py:192: AssertionError
-------------------------- Captured stdout setup ---------------------------