langflow-ai / langflow

⛓️ Langflow is a visual framework for building multi-agent and RAG applications. It's open-source, Python-powered, fully customizable, model and vector store agnostic.

Home Page:http://www.langflow.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Chroma and Astra DB Search components not allowing Chat Input

brylie opened this issue · comments

When adding a Chroma Search or Astra DB component, I am unable to connect a Chat Input component output to the Chroma Search or Astra DB component input.

Langflow: langflow==1.0.0a57

To Reproduce
Steps to reproduce the behavior:

  1. Create a flow
  2. Add a Chroma Search or Astra DB component
  3. Add a Chat Input component
  4. Attempt to connect the "message/text" of the Chat Input component to the input of the Chroma Search or Astra DB component

Screenshots

Screenshot 2024-06-14 at 19 46 42

To connect the "message/text" output of the Chat Input component to the input of the Chroma Search component, you need to map the output of the Chat Input component to the input_value parameter of the build method in the ChromaSearchComponent.

Here is how you can do it:

  1. Ensure that the Chat Input component's output is correctly configured to produce a text message.
  2. Connect the output of the Chat Input component to the input_value of the Chroma Search component.

The input_value parameter in the build method of ChromaSearchComponent is defined as follows:

def build(
        self,
        input_value: Text,
        search_type: str,
        collection_name: str,
        embedding: Embeddings,
        chroma_server_ssl_enabled: bool,
        number_of_results: int = 4,
        index_directory: Optional[str] = None,
        chroma_server_cors_allow_origins: List[str] = [],
        chroma_server_host: Optional[str] = None,
        chroma_server_http_port: Optional[int] = None,
        chroma_server_grpc_port: Optional[int] = None,
    ) -> List[Record]:
        """
        Builds the Vector Store or BaseRetriever object.

        Args:
        - input_value (Text): The input value.
        - search_type (str): The type of search.
        - collection_name (str): The name of the collection.
        - embedding (Embeddings): The embeddings to use for the Vector Store.
        - chroma_server_ssl_enabled (bool): Whether to enable SSL for the Chroma server.
        - number_of_results (int, optional): The number of results to retrieve. Defaults to 4.
        - index_directory (str, optional): The directory to persist the Vector Store to. Defaults to None.
        - chroma_server_cors_allow_origins (List[str], optional): The CORS allow origins for the Chroma server. Defaults to [].
        - chroma_server_host (str, optional): The host for the Chroma server. Defaults to None.
        - chroma_server_http_port (int, optional): The HTTP port for the Chroma server. Defaults to None.
        - chroma_server_grpc_port (int, optional): The gRPC port for the Chroma server. Defaults to None.

        Returns:
        - List[Record]: The list of records.
        """

In your flow configuration, you would map the Chat Input component's output to the input_value parameter of the Chroma Search component. This ensures that the text message from the Chat Input is used as the input for the Chroma Search.

Example configuration snippet:

{
  "components": {
    "ChatInput": {
      "outputs": {
        "message/text": "Hello, how can I help you?"
      }
    },
    "ChromaSearch": {
      "inputs": {
        "input_value": "ChatInput.message/text"
      }
    }
  }
}

This configuration connects the message/text output of the Chat Input component to the input_value input of the Chroma Search component [1].

To continue talking to Dosu, mention @dosu.

The same issue is present when connecting Chat Input to Astra DB Search.

@dosu, for some reason, those instructions no longer work. There seems to be a bug in a recent revision of Langflow that has broken the AstraDB Search and Chroma Search components. The issue may also affect other vector search components, but we haven't tested. Can you find any recent commits that modified the vector search components which may have introduced a regression?

Hey all.

We'll release a fix for this in a few minutes. Should be version 1.0.0a58

Was it related to this?

df57570

I was just getting familiar with the codebase, so was curious 😄

Was it related to this?

df57570

I was just getting familiar with the codebase, so was curious 😄

Yes.

For now ChatInput should output Message and Text so it can still connect to Text fields. This PR made it output only Message so it stopped working.

Strangely enough, this was fixed a while ago. Not sure why it is broken in a57.

By the way, is there a way to improve the automated test coverage of the component interfaces? I don't see a CI process for test running/coverage analysis on PRs, for example. What is the current coverage percent? I've had a good experience with Codecov both in open source projects and at work.

Hey all.

We'll release a fix for this in a few minutes. Should be version 1.0.0a58

Same validation error with Qdrant Search in v1.0.0a58

I can confirm that the Chroma Search component works correctly in v1.0.0a58.

However, perhaps this issue can remain open to track other vector search or similar regressions introduced in the recent refactoring?

I can confirm that the Chroma Search component works correctly in v1.0.0a58.

However, perhaps this issue can remain open to track other vector search or similar regressions introduced in the recent refactoring?

yep, "Qdrant Search" still not working: #2184

Workaround: turn off "Return Record" in "Chat Input" node.

I updated to v1.0.0a58 and v1.0.0a59 and I still get the "Error building Chroma Search: Invalid inputs provided". If I disconnect Chat Input from ChromaSearch and hard code an input string the build succeeds (but the flow is useless because of hard-coded text.) Are there additional config changes in my Chat Input component source to consume the bug fix?

I can confirm that the Chroma Search component works correctly in v1.0.0a58.

However, perhaps this issue can remain open to track other vector search or similar regressions introduced in the recent refactoring?

I updated to v1.0.0a58 and v1.0.0a59 both versions are giving the error:

Error building Component Astra DB Search: Invalid inputs provided.

I confirmed that Chroma Search works in v1.0.0.a59 if you toggle off the Chat Input Return Record in Advanced Settings.

Screenshot 2024-06-17 at 1 23 06 PM

Can confirm that @brianhadaway's suggestion works with AstraDB.
i.e., toggle off the Chat Input Return Record in Advanced Settings.

image

sorry for the newbie's question, but i cannot find Return Record...

i cancelled the component and re-inserted and now the advanced settings dialog has it... sorry

image

still, i disabled Return Record but Chroma Search is still complaining that there is an issue building the component due to invalid inputs provided

i cancelled the component and re-inserted and now the advanced settings dialog has it... sorry

image

still, i disabled Return Record but Chroma Search is still complaining that there is an issue building the component due to invalid inputs provided

You should try hard reload or re-run langflow

I've restarted Langflow, disabled Send Record, and updated to the latest 1.0.0a61 but both Astra and ChromaDB search fail when connected to to the output of the Chat Input component 🤔

I noticed that mine fail if the input is empty. Try with a predefined string to see if it helps :)

Congrats on the 1.0 release!

I'm trying to build a RAG flow with Langflow 1.0.5, following both the Langflow RAG with Astra DB tutorial and Quickstart for DataStax LangFlow. For some reason, the vector search components seem to be missing from the Langflow 1.0.5 release 🤔

Screenshot 2024-06-25 at 22 34 16

Oops, I figured it out. I needed to connect the Vector DB (chroma in this case) to a data parser, pictured:
Screenshot 2024-06-25 at 22 57 51