mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-27 06:18:05 +00:00
multiple: merge master into v0.3rc branch (#26163)
Signed-off-by: ChengZi <chen.zhang@zilliz.com> Co-authored-by: Bagatur <baskaryan@gmail.com> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Tomaz Bratanic <bratanic.tomaz@gmail.com> Co-authored-by: ZhangShenao <15201440436@163.com> Co-authored-by: Friso H. Kingma <fhkingma@gmail.com> Co-authored-by: Chester Curme <chester.curme@gmail.com> Co-authored-by: ChengZi <chen.zhang@zilliz.com>
This commit is contained in:
@@ -650,6 +650,10 @@ class LLMGraphTransformer:
|
||||
any relationship properties from text. Alternatively, a list of valid
|
||||
properties can be provided for the LLM to extract, restricting extraction to
|
||||
those specified.
|
||||
ignore_tool_usage (bool): Indicates whether the transformer should
|
||||
bypass the use of structured output functionality of the language model.
|
||||
If set to True, the transformer will not use the language model's native
|
||||
function calling capabilities to handle structured output. Defaults to False.
|
||||
|
||||
Example:
|
||||
.. code-block:: python
|
||||
@@ -675,16 +679,18 @@ class LLMGraphTransformer:
|
||||
strict_mode: bool = True,
|
||||
node_properties: Union[bool, List[str]] = False,
|
||||
relationship_properties: Union[bool, List[str]] = False,
|
||||
ignore_tool_usage: bool = False,
|
||||
) -> None:
|
||||
self.allowed_nodes = allowed_nodes
|
||||
self.allowed_relationships = allowed_relationships
|
||||
self.strict_mode = strict_mode
|
||||
self._function_call = True
|
||||
self._function_call = not ignore_tool_usage
|
||||
# Check if the LLM really supports structured output
|
||||
try:
|
||||
llm.with_structured_output(_Graph)
|
||||
except NotImplementedError:
|
||||
self._function_call = False
|
||||
if self._function_call:
|
||||
try:
|
||||
llm.with_structured_output(_Graph)
|
||||
except NotImplementedError:
|
||||
self._function_call = False
|
||||
if not self._function_call:
|
||||
if node_properties or relationship_properties:
|
||||
raise ValueError(
|
||||
|
Reference in New Issue
Block a user