langchain.js
    Preparing search index...

    Chain for question-answering against a graph by generating Cypher statements.

    const chain = new GraphCypherQAChain({
    llm: new ChatOpenAI({ model: "gpt-4o-mini", temperature: 0 }),
    graph: new Neo4jGraph(),
    });
    const res = await chain.invoke("Who played in Pulp Fiction?");

    This chain will execute Cypher statements against the provided database. Make sure that the database connection uses credentials that are narrowly-scoped to only include necessary permissions. Failure to do so may result in data corruption or loss, since the calling code may attempt commands that would result in deletion, mutation of data if appropriately prompted or reading sensitive data if such data is present in the database. The best way to guard against such negative outcomes is to (as appropriate) limit the permissions granted to the credentials used with this tool.

    See https://js.langchain.com/docs/security for more information.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    memory?: any

    Accessors

    • get inputKeys(): string[]

      Returns string[]

    • get lc_namespace(): string[]

      Returns string[]

    • get outputKeys(): string[]

      Returns string[]

    Methods

    • Run the core logic of this chain and return the output

      Parameters

      • values: ChainValues
      • OptionalrunManager: any

      Returns Promise<ChainValues>

    • Return the string type key uniquely identifying this class of chain.

      Returns "graph_cypher_chain"

    • Parameters

      • values: any

      Returns Promise<any>

    • Parameters

      • inputs: ChainValues[]
      • Optionalconfig: any[]

      Returns Promise<ChainValues[]>

      Use .batch() instead. Will be removed in 0.2.0.

      Call the chain on all inputs in the list

    • Parameters

      • values: any
      • Optionalconfig: any
      • Optionaltags: string[]

      Returns Promise<ChainValues>

      Use .invoke() instead. Will be removed in 0.2.0.

      Run the core logic of this chain and add to output if desired.

      Wraps _call and handles memory.

    • Invoke the chain with the provided input and returns the output.

      Parameters

      • input: ChainValues

        Input values for the chain run.

      • Optionaloptions: any

      Returns Promise<ChainValues>

      Promise that resolves with the output of the chain run.

    • Parameters

      • inputs: Record<string, unknown>
      • outputs: Record<string, unknown>
      • returnOnlyOutputs: boolean = false

      Returns Promise<Record<string, unknown>>

    • Parameters

      • input: any
      • Optionalconfig: any

      Returns Promise<string>

      Use .invoke() instead. Will be removed in 0.2.0.

    • Load a chain from a json-like object describing it.

      Parameters

      Returns Promise<BaseChain<ChainValues, ChainValues>>