Giter Club home page Giter Club logo

Comments (2)

dosubot avatar dosubot commented on July 1, 2024 2

To fix the error related to de-serialization while building the FAISS Search component, you might consider setting the allow_dangerous_deserialization parameter to True. However, this is generally not recommended due to security risks.

Here is an example of how you might modify the build method to include allow_dangerous_deserialization:

def build(
    self,
    input_value: Text,
    embedding: Embeddings,
    folder_path: str,
    number_of_results: int = 4,
    index_name: str = "langflow_index",
    allow_dangerous_deserialization: bool = False  # Add this parameter
) -> List[Record]:
    if not folder_path:
        raise ValueError("Folder path is required to save the FAISS index.")
    path = self.resolve_path(folder_path)
    vector_store = FAISS.load_local(
        folder_path=Text(path),
        embeddings=embedding,
        index_name=index_name,
        allow_dangerous_deserialization=allow_dangerous_deserialization  # Pass it here
    )
    if not vector_store:
        raise ValueError("Failed to load the FAISS index.")

    return self.search_with_vector_store(
        vector_store=vector_store, input_value=input_value, search_type="similarity", k=number_of_results
    )

Regarding the safety of setting allow_dangerous_deserialization to True, it is generally not safe because it can expose your application to security vulnerabilities, such as arbitrary code execution. Use this option only if you fully understand the risks and have no other alternatives [1].

To continue talking to Dosu, mention @dosu.

from langflow.

isold23 avatar isold23 commented on July 1, 2024

vector_store = FAISS.load_local(folder_path=Text(path), embeddings=embedding, index_name=index_name, allow_dangerous_deserialization=True)
no fixes

from langflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.