langchain_community.graphs.neptune_graph.NeptuneGraph

class langchain_community.graphs.neptune_graph.NeptuneGraph(host: str, port: int = 8182, use_https: bool = True, client: Any = None, credentials_profile_name: Optional[str] = None, region_name: Optional[str] = None, sign: bool = True)[source]

海王星图操作的封装器。

参数:

host: 数据库实例的端点 port: 数据库实例的端口号,默认为8182 use_https: 是否使用安全连接,默认为True client: 可选的boto3 Neptune客户端 credentials_profile_name: 可选的AWS配置文件名称 region_name: 可选的AWS区域,例如us-west-2 service: 可选的服务名称,默认为neptunedata sign: 可选的,是否对请求有效载荷进行签名,默认为True

示例:

graph = NeptuneGraph(

host=’<my-cluster>’, port=8182

)

安全提示: 确保数据库连接使用的凭据范围仅包括必要的权限。

如果未能这样做,可能会导致数据损坏或丢失,因为调用代码可能会尝试执行命令, 这些命令将导致删除、变异数据(如果适当提示)或读取敏感数据(如果数据库中存在此类数据)。 防范这些负面结果的最佳方法是(视情况)限制授予此工具使用的凭据的权限。

有关更多信息,请参见https://python.langchain.com/docs/security。

创建一个新的 Neptune 图包装器实例。

Attributes

get_schema

返回 Neptune 数据库的模式

Methods

__init__(host[, port, use_https, client, ...])

创建一个新的 Neptune 图包装器实例。

query(query[, params])

查询海王星数据库。

Parameters
  • host (str) –

  • port (int) –

  • use_https (bool) –

  • client (Any) –

  • credentials_profile_name (Optional[str]) –

  • region_name (Optional[str]) –

  • sign (bool) –

Return type

None

__init__(host: str, port: int = 8182, use_https: bool = True, client: Any = None, credentials_profile_name: Optional[str] = None, region_name: Optional[str] = None, sign: bool = True) None[source]

创建一个新的 Neptune 图包装器实例。

Parameters
  • host (str) –

  • port (int) –

  • use_https (bool) –

  • client (Any) –

  • credentials_profile_name (Optional[str]) –

  • region_name (Optional[str]) –

  • sign (bool) –

Return type

None

query(query: str, params: dict = {}) Dict[str, Any][source]

查询海王星数据库。

Parameters
  • query (str) –

  • params (dict) –

Return type

Dict[str, Any]

Examples using NeptuneGraph