langchain.graphs.arangodb_graph.ArangoGraph

class langchain.graphs.arangodb_graph.ArangoGraph(db: Any)[source]

ArangoDB wrapper for graph operations.

Security note: 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://python.langchain.com/docs/security for more information.

Create a new ArangoDB graph wrapper instance.

Attributes

db

schema

Methods

__init__(db)

Create a new ArangoDB graph wrapper instance.

from_db_credentials([url, dbname, username, ...])

Convenience constructor that builds Arango DB from credentials.

generate_schema([sample_ratio])

Generates the schema of the ArangoDB Database and returns it User can specify a sample_ratio (0 to 1) to determine the ratio of documents/edges used (in relation to the Collection size) to render each Collection Schema.

query(query[, top_k])

Query the ArangoDB database.

set_db(db)

set_schema([schema])

Set the schema of the ArangoDB Database.

__init__(db: Any) None[source]

Create a new ArangoDB graph wrapper instance.

classmethod from_db_credentials(url: Optional[str] = None, dbname: Optional[str] = None, username: Optional[str] = None, password: Optional[str] = None) Any[source]

Convenience constructor that builds Arango DB from credentials.

Parameters
  • url – Arango DB url. Can be passed in as named arg or set as environment var ARANGODB_URL. Defaults to “http://localhost:8529”.

  • dbname – Arango DB name. Can be passed in as named arg or set as environment var ARANGODB_DBNAME. Defaults to “_system”.

  • username – Can be passed in as named arg or set as environment var ARANGODB_USERNAME. Defaults to “root”.

  • password – Can be passed ni as named arg or set as environment var ARANGODB_PASSWORD. Defaults to “”.

Returns

An arango.database.StandardDatabase.

generate_schema(sample_ratio: float = 0) Dict[str, List[Dict[str, Any]]][source]

Generates the schema of the ArangoDB Database and returns it User can specify a sample_ratio (0 to 1) to determine the ratio of documents/edges used (in relation to the Collection size) to render each Collection Schema.

query(query: str, top_k: Optional[int] = None, **kwargs: Any) List[Dict[str, Any]][source]

Query the ArangoDB database.

set_db(db: Any) None[source]
set_schema(schema: Optional[Dict[str, Any]] = None) None[source]

Set the schema of the ArangoDB Database. Auto-generates Schema if schema is None.

Examples using ArangoGraph