inputlayer-client-dev 0.1.0.dev912__tar.gz → 0.1.0.dev915__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. inputlayer_client_dev-0.1.0.dev915/LICENSE +203 -0
  2. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/PKG-INFO +4 -3
  3. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/README.md +1 -1
  4. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/pyproject.toml +2 -1
  5. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langchain/retriever.py +26 -3
  6. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langchain/tool.py +38 -18
  7. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langchain/vector_store.py +29 -9
  8. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_langchain.py +151 -0
  9. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/.gitignore +0 -0
  10. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/01_quickstart.py +0 -0
  11. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/02_social_network.py +0 -0
  12. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/03_rag_pipeline.py +0 -0
  13. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/04_ecommerce.py +0 -0
  14. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/05_rbac.py +0 -0
  15. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/06_realtime_dashboard.py +0 -0
  16. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/07_dataframe_etl.py +0 -0
  17. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/08_session_rules.py +0 -0
  18. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/09_access_control.py +0 -0
  19. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/10_migrations.py +0 -0
  20. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/__init__.py +0 -0
  21. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/_common.py +0 -0
  22. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex01_retriever.py +0 -0
  23. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex02_vector.py +0 -0
  24. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex03_tool.py +0 -0
  25. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex04_lcel_chain.py +0 -0
  26. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex05_kg_building.py +0 -0
  27. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex06_explainable_rag.py +0 -0
  28. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex07_multihop.py +0 -0
  29. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex08_memory.py +0 -0
  30. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex09_access_control.py +0 -0
  31. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex10_multi_agent.py +0 -0
  32. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex11_anomaly.py +0 -0
  33. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex12_hallucination.py +0 -0
  34. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex13_guardrails.py +0 -0
  35. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex14_graphrag.py +0 -0
  36. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex15_caching.py +0 -0
  37. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex16_recommendation.py +0 -0
  38. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/ex17_lineage.py +0 -0
  39. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langchain/runner.py +0 -0
  40. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/__init__.py +0 -0
  41. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/_common.py +0 -0
  42. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex01_reasoning_loop.py +0 -0
  43. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex02_investigation.py +0 -0
  44. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex03_human_in_loop.py +0 -0
  45. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex04_branching_pipeline.py +0 -0
  46. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex05_self_correcting.py +0 -0
  47. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex06_collaborative_planning.py +0 -0
  48. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex07_event_correlation.py +0 -0
  49. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex08_tool_selection.py +0 -0
  50. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex09_streaming_aggregation.py +0 -0
  51. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex10_resumable_graph.py +0 -0
  52. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex11_memory.py +0 -0
  53. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/ex12_resumable_chat.py +0 -0
  54. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/examples/langgraph/runner.py +0 -0
  55. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/__init__.py +0 -0
  56. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/_ast.py +0 -0
  57. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/_naming.py +0 -0
  58. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/_protocol.py +0 -0
  59. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/_proxy.py +0 -0
  60. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/_sync.py +0 -0
  61. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/aggregations.py +0 -0
  62. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/auth.py +0 -0
  63. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/client.py +0 -0
  64. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/client_sync.py +0 -0
  65. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/compiler.py +0 -0
  66. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/connection.py +0 -0
  67. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/derived.py +0 -0
  68. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/exceptions.py +0 -0
  69. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/functions.py +0 -0
  70. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/index.py +0 -0
  71. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/__init__.py +0 -0
  72. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langchain/__init__.py +0 -0
  73. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langchain/params.py +0 -0
  74. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/__init__.py +0 -0
  75. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/_checkpoint_serde.py +0 -0
  76. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/_checkpointer_mixin.py +0 -0
  77. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/_memory_helpers.py +0 -0
  78. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/_memory_mixin.py +0 -0
  79. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/_utils.py +0 -0
  80. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/checkpointer.py +0 -0
  81. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/memory.py +0 -0
  82. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/nodes.py +0 -0
  83. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/router.py +0 -0
  84. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/integrations/langgraph/state.py +0 -0
  85. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/knowledge_graph.py +0 -0
  86. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/migrations/__init__.py +0 -0
  87. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/migrations/autodetector.py +0 -0
  88. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/migrations/cli.py +0 -0
  89. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/migrations/executor.py +0 -0
  90. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/migrations/loader.py +0 -0
  91. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/migrations/operations.py +0 -0
  92. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/migrations/recorder.py +0 -0
  93. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/migrations/state.py +0 -0
  94. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/migrations/writer.py +0 -0
  95. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/notifications.py +0 -0
  96. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/py.typed +0 -0
  97. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/relation.py +0 -0
  98. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/result.py +0 -0
  99. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/session.py +0 -0
  100. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/src/inputlayer/types.py +0 -0
  101. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/__init__.py +0 -0
  102. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/_mock_checkpoint_kg.py +0 -0
  103. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/_mock_memory_kg.py +0 -0
  104. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/conftest.py +0 -0
  105. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_aggregations.py +0 -0
  106. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_ast.py +0 -0
  107. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_autodetector.py +0 -0
  108. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_checkpointer_core.py +0 -0
  109. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_checkpointer_lifecycle.py +0 -0
  110. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_checkpointer_list.py +0 -0
  111. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_checkpointer_validation.py +0 -0
  112. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_cli.py +0 -0
  113. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_compiler.py +0 -0
  114. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_connection.py +0 -0
  115. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_derived.py +0 -0
  116. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_escape_iql.py +0 -0
  117. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_executor.py +0 -0
  118. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_functions.py +0 -0
  119. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_integration.py +0 -0
  120. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_kg_node.py +0 -0
  121. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_kg_router.py +0 -0
  122. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_langgraph_integration.py +0 -0
  123. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_loader.py +0 -0
  124. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_memory_core.py +0 -0
  125. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_memory_edge_cases.py +0 -0
  126. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_memory_helpers.py +0 -0
  127. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_naming.py +0 -0
  128. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_operations.py +0 -0
  129. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_protocol.py +0 -0
  130. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_proxy.py +0 -0
  131. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_relation.py +0 -0
  132. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_result.py +0 -0
  133. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_serde.py +0 -0
  134. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_state.py +0 -0
  135. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_sync.py +0 -0
  136. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_types.py +0 -0
  137. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/tests/test_writer.py +0 -0
  138. {inputlayer_client_dev-0.1.0.dev912 → inputlayer_client_dev-0.1.0.dev915}/uv.lock +0 -0
@@ -0,0 +1,203 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. Please also get in touch with
186
+ us at legal@inputlayer.ai to let us know you're using the license.
187
+
188
+ Copyright 2024-2026 InputLayer
189
+
190
+ Licensed under the Apache License, Version 2.0 (the "License");
191
+ you may not use this file except in compliance with the License.
192
+ You may obtain a copy of the License at
193
+
194
+ http://www.apache.org/licenses/LICENSE-2.0
195
+
196
+ Unless required by applicable law or agreed to in writing, software
197
+ distributed under the License is distributed on an "AS IS" BASIS,
198
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
199
+ See the License for the specific language governing permissions and
200
+ limitations under the License.
201
+
202
+
203
+ Copyright 2024-2026 InputLayer
@@ -1,8 +1,9 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: inputlayer-client-dev
3
- Version: 0.1.0.dev912
3
+ Version: 0.1.0.dev915
4
4
  Summary: Python Object-Logic Mapper for InputLayer knowledge graph engine
5
5
  License-Expression: Apache-2.0
6
+ License-File: LICENSE
6
7
  Requires-Python: >=3.10
7
8
  Requires-Dist: pydantic<3,>=2.0
8
9
  Requires-Dist: websockets<15,>=12.0
@@ -572,4 +573,4 @@ uv run mypy src/inputlayer/
572
573
 
573
574
  ## License
574
575
 
575
- Apache 2.0 + Commons Clause. See [LICENSE](../../LICENSE).
576
+ Apache 2.0. See [LICENSE](./LICENSE). (The InputLayer core server is separately licensed under the Elastic License 2.0.)
@@ -539,4 +539,4 @@ uv run mypy src/inputlayer/
539
539
 
540
540
  ## License
541
541
 
542
- Apache 2.0 + Commons Clause. See [LICENSE](../../LICENSE).
542
+ Apache 2.0. See [LICENSE](./LICENSE). (The InputLayer core server is separately licensed under the Elastic License 2.0.)
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "inputlayer-client-dev"
7
- version = "0.1.0.dev912"
7
+ version = "0.1.0.dev915"
8
8
  description = "Python Object-Logic Mapper for InputLayer knowledge graph engine"
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -62,3 +62,4 @@ warn_return_any = true
62
62
  warn_unused_configs = true
63
63
  packages = ["inputlayer"]
64
64
  mypy_path = "src"
65
+ exclude = ["examples/"]
@@ -21,6 +21,21 @@ from inputlayer.integrations.langchain.params import bind_params
21
21
 
22
22
  logger = logging.getLogger(__name__)
23
23
 
24
+
25
+ def _extract_error_message(result: Any) -> str:
26
+ """Extract the error text from an ``columns == ["error"]`` result.
27
+
28
+ Guards against missing rows and empty rows so the retriever never
29
+ crashes with IndexError when the engine sends a malformed error
30
+ envelope.
31
+ """
32
+ rows = getattr(result, "rows", None) or []
33
+ if not rows or not rows[0]:
34
+ return "unknown error"
35
+ msg = rows[0][0]
36
+ return str(msg) if msg is not None else "unknown error"
37
+
38
+
24
39
  class InputLayerRetriever(BaseRetriever):
25
40
  """Retrieve documents from an InputLayer KnowledgeGraph.
26
41
 
@@ -59,6 +74,11 @@ class InputLayerRetriever(BaseRetriever):
59
74
  )
60
75
 
61
76
  Both sync and async paths are supported natively.
77
+
78
+ When the engine rejects a query (parse error, unknown relation,
79
+ etc.) the retriever raises ``RuntimeError`` with the engine message
80
+ rather than returning empty results, so a misconfigured chain fails
81
+ loudly instead of silently producing zero documents.
62
82
  """
63
83
 
64
84
  kg: Any # KnowledgeGraph - typed as Any for Pydantic compatibility
@@ -145,8 +165,9 @@ class InputLayerRetriever(BaseRetriever):
145
165
  logger.debug("IQL retriever query: %s", compiled)
146
166
  result = await self.kg.execute(compiled)
147
167
  if result.columns == ["error"]:
148
- msg = result.rows[0][0] if result.rows else "unknown error"
149
- raise RuntimeError(f"InputLayer rejected query: {msg}")
168
+ raise RuntimeError(
169
+ f"InputLayer rejected query: {_extract_error_message(result)}"
170
+ )
150
171
  return self._to_documents(result.columns, result.rows, hidden_columns=set())
151
172
 
152
173
  def _resolve_params(self, user_query: str) -> dict[str, Any]:
@@ -244,7 +265,9 @@ class InputLayerRetriever(BaseRetriever):
244
265
 
245
266
  resolved_content: list[str] = []
246
267
  content_cols = (
247
- self.page_content_columns if self.page_content_columns is not None else ["content"]
268
+ self.page_content_columns
269
+ if self.page_content_columns is not None
270
+ else ["content"]
248
271
  )
249
272
  explicit_content = self.page_content_columns is not None
250
273
  for c in content_cols:
@@ -82,6 +82,10 @@ class InputLayerIQLTool(BaseTool):
82
82
  placeholder; the agent's input is safely bound (escaped, quoted)
83
83
  rather than spliced as raw text.
84
84
 
85
+ Engine errors are returned to the agent as ``"Error: <message>"`` so
86
+ the tool-calling LLM can observe the failure and adjust its next
87
+ action instead of the coroutine raising an exception mid-chain.
88
+
85
89
  Prefer ``tools_from_relations`` for normal agent use.
86
90
  """
87
91
 
@@ -137,6 +141,8 @@ class InputLayerIQLTool(BaseTool):
137
141
 
138
142
  logger.debug("IQL tool query: %s", compiled)
139
143
  result = await self.kg.execute(compiled)
144
+ if result.columns == ["error"]:
145
+ return f"Error: {_extract_error_message(result)}"
140
146
  return _format_result(result, self.max_rows)
141
147
 
142
148
 
@@ -171,7 +177,9 @@ def tools_from_relations(
171
177
  agent = create_tool_calling_agent(llm, tools, prompt)
172
178
 
173
179
  Returned tools emit JSON arrays of row dicts so tool-calling LLMs
174
- can parse them directly.
180
+ can parse them directly. Engine errors are returned as a JSON
181
+ ``{"error": "<message>"}`` object rather than raising, so the agent
182
+ can recover from a bad filter without aborting the chain.
175
183
  """
176
184
  return [
177
185
  _relation_to_tool(kg, r, max_rows=max_rows, name_prefix=name_prefix)
@@ -343,9 +351,7 @@ def _make_relation_runner(
343
351
  logger.debug("Structured tool query: %s", q)
344
352
  result = await kg.execute(q)
345
353
  if result.columns == ["error"]:
346
- return json.dumps(
347
- {"error": result.rows[0][0] if result.rows else "unknown error"}
348
- )
354
+ return json.dumps({"error": _extract_error_message(result)})
349
355
  if not merged_columns:
350
356
  merged_columns = result.columns
351
357
  for row in result.rows:
@@ -359,8 +365,12 @@ def _make_relation_runner(
359
365
  if len(merged_rows) >= max_rows + 1:
360
366
  break
361
367
 
362
- # Wrap merged rows in a synthetic ResultSet-like object.
363
- return _format_result(_FakeResult(merged_columns, merged_rows), max_rows)
368
+ was_truncated = len(merged_rows) > max_rows
369
+ capped = merged_rows[:max_rows]
370
+ fake = _FakeResult(merged_columns, capped)
371
+ if was_truncated:
372
+ fake.row_count = max_rows + 1
373
+ return _format_result(fake, max_rows)
364
374
 
365
375
  run.__name__ = f"search_{rel_name}"
366
376
  run.parse_clauses = parse_clauses # type: ignore[attr-defined]
@@ -393,6 +403,24 @@ def _hashable(v: Any) -> Any:
393
403
  # ── Result formatting ────────────────────────────────────────────────
394
404
 
395
405
 
406
+ def _extract_error_message(result: Any) -> str:
407
+ """Extract a single error message from an ``error`` result set.
408
+
409
+ The engine signals an error with ``columns == ["error"]`` and a single
410
+ row whose first cell is the message. Guard against both the no-row and
411
+ empty-row shapes so a malformed response never masquerades as a
412
+ successful result or crashes the caller.
413
+ """
414
+ rows = getattr(result, "rows", None) or []
415
+ if not rows:
416
+ return "unknown error"
417
+ first = rows[0]
418
+ if not first:
419
+ return "unknown error"
420
+ msg = first[0]
421
+ return str(msg) if msg is not None else "unknown error"
422
+
423
+
396
424
  def _format_result(result: Any, max_rows: int) -> str:
397
425
  """Format a ResultSet as a JSON array of row dicts.
398
426
 
@@ -403,18 +431,10 @@ def _format_result(result: Any, max_rows: int) -> str:
403
431
  return "[]"
404
432
 
405
433
  rows = result.rows[:max_rows]
406
- columns = result.columns
407
- payload = []
408
- for row in rows:
409
- if len(row) != len(columns):
410
- logger.warning(
411
- "Row length (%d) does not match column count (%d); "
412
- "truncating to shorter. Columns: %r",
413
- len(row), len(columns), columns,
414
- )
415
- payload.append(
416
- {col: _jsonify(val) for col, val in zip(columns, row, strict=False)}
417
- )
434
+ payload = [
435
+ {col: _jsonify(val) for col, val in zip(result.columns, row, strict=True)}
436
+ for row in rows
437
+ ]
418
438
 
419
439
  total = getattr(result, "row_count", len(result.rows)) or len(result.rows)
420
440
  if total > max_rows:
@@ -72,6 +72,13 @@ class InputLayerVectorStore(VectorStore):
72
72
  on the provider itself, e.g.
73
73
  ``OpenAIEmbeddings(timeout=30, max_retries=2)``.
74
74
 
75
+ .. note::
76
+
77
+ ``add_texts`` validates that ``texts``, ``metadatas``, and ``ids``
78
+ all have the same length and raises ``ValueError`` up front.
79
+ Previously a mismatch would surface as an opaque ``zip`` error
80
+ deep inside the embedding call.
81
+
75
82
  Usage::
76
83
 
77
84
  class Chunk(Relation):
@@ -190,6 +197,17 @@ class InputLayerVectorStore(VectorStore):
190
197
  if not texts_list:
191
198
  return []
192
199
 
200
+ if metadatas is not None and len(metadatas) != len(texts_list):
201
+ raise ValueError(
202
+ f"Length mismatch: {len(texts_list)} texts but "
203
+ f"{len(metadatas)} metadata dicts"
204
+ )
205
+ if ids is not None and len(ids) != len(texts_list):
206
+ raise ValueError(
207
+ f"Length mismatch: {len(texts_list)} texts but "
208
+ f"{len(ids)} ids"
209
+ )
210
+
193
211
  vectors = await self._embeddings.aembed_documents(texts_list)
194
212
  ids_out = ids or [str(uuid.uuid4()) for _ in texts_list]
195
213
  metas = metadatas or [{} for _ in texts_list]
@@ -448,13 +466,14 @@ class InputLayerVectorStore(VectorStore):
448
466
  ),
449
467
  )
450
468
 
451
- # Find the vector column index in the result.
452
- vec_col_idx = None
453
- for i, c in enumerate(result.columns):
454
- if c.lower() == self._vector_field.lower():
455
- vec_col_idx = i
456
- break
457
-
469
+ vec_col_idx = next(
470
+ (
471
+ i
472
+ for i, c in enumerate(result.columns)
473
+ if c.lower() == self._vector_field.lower()
474
+ ),
475
+ None,
476
+ )
458
477
  if vec_col_idx is None:
459
478
  raise ValueError(
460
479
  f"Could not find vector column {self._vector_field!r} in "
@@ -467,7 +486,7 @@ class InputLayerVectorStore(VectorStore):
467
486
  out: list[tuple[Document, float, list[float]]] = []
468
487
  docs_and_scores = self._rows_to_documents(result.columns, result.rows)
469
488
  for (doc, score), row in zip(docs_and_scores, result.rows, strict=True):
470
- raw = row[vec_col_idx] if vec_col_idx is not None else None
489
+ raw = row[vec_col_idx]
471
490
  vec = list(raw) if raw is not None else []
472
491
  out.append((doc, score, vec))
473
492
  return out
@@ -584,7 +603,8 @@ class InputLayerVectorStore(VectorStore):
584
603
  if k.lower() == self._vector_field.lower():
585
604
  continue
586
605
  metadata[canonical(k)] = v
587
- score = float(row_dict[score_col]) if score_col else 0.0
606
+ raw_score = row_dict.get(score_col) if score_col else None
607
+ score = float(raw_score) if raw_score is not None else 0.0
588
608
  out.append((Document(page_content=content, metadata=metadata), score))
589
609
  return out
590
610
 
@@ -1741,3 +1741,154 @@ class TestDebugResultDeprecation:
1741
1741
  dr = DebugResult(iql="?test(X)", plan="plan text")
1742
1742
  with pytest.raises(AttributeError, match="no_such_field"):
1743
1743
  _ = dr.no_such_field
1744
+
1745
+
1746
+ # ═══════════════════════════════════════════════════════════════════════
1747
+ # Edge case regression tests
1748
+ # ═══════════════════════════════════════════════════════════════════════
1749
+
1750
+
1751
+ class TestErrorResponseHandling:
1752
+ """Error responses from the server should be detected, not treated as data."""
1753
+
1754
+ async def test_retriever_raises_on_error_response(self) -> None:
1755
+ kg = _mock_kg(columns=["error"], rows=[["Parse error at line 1"]])
1756
+ r = InputLayerRetriever(kg=kg, query="?bad(X)")
1757
+ with pytest.raises(RuntimeError, match="InputLayer rejected query"):
1758
+ await r.ainvoke("test")
1759
+
1760
+ async def test_retriever_raises_on_empty_error_row(self) -> None:
1761
+ """Error response with empty row should not crash."""
1762
+ kg = _mock_kg(columns=["error"], rows=[[]])
1763
+ r = InputLayerRetriever(kg=kg, query="?bad(X)")
1764
+ with pytest.raises(RuntimeError, match="unknown error"):
1765
+ await r.ainvoke("test")
1766
+
1767
+ async def test_retriever_raises_on_no_rows(self) -> None:
1768
+ """Error response with no rows at all."""
1769
+ kg = _mock_kg(columns=["error"], rows=[])
1770
+ r = InputLayerRetriever(kg=kg, query="?bad(X)")
1771
+ with pytest.raises(RuntimeError, match="unknown error"):
1772
+ await r.ainvoke("test")
1773
+
1774
+ async def test_iql_tool_returns_error_string(self) -> None:
1775
+ kg = _mock_kg(columns=["error"], rows=[["Unknown relation 'foo'"]])
1776
+ tool = InputLayerIQLTool(kg=kg)
1777
+ result = await tool.ainvoke("?foo(X)")
1778
+ assert "Error:" in result
1779
+ assert "Unknown relation" in result
1780
+
1781
+ async def test_iql_tool_handles_empty_error_row(self) -> None:
1782
+ kg = _mock_kg(columns=["error"], rows=[[]])
1783
+ tool = InputLayerIQLTool(kg=kg)
1784
+ result = await tool.ainvoke("?bad(X)")
1785
+ assert "Error:" in result
1786
+ assert "unknown error" in result
1787
+
1788
+ async def test_iql_tool_handles_none_error_cell(self) -> None:
1789
+ """An error envelope carrying a None cell should not crash."""
1790
+ kg = _mock_kg(columns=["error"], rows=[[None]])
1791
+ tool = InputLayerIQLTool(kg=kg)
1792
+ result = await tool.ainvoke("?bad(X)")
1793
+ assert "Error:" in result
1794
+ assert "unknown error" in result
1795
+
1796
+ async def test_structured_tool_handles_empty_error_row(self) -> None:
1797
+ """Structured tool path must guard the same edge as the IQL tool."""
1798
+ kg = _mock_kg(columns=["error"], rows=[[]])
1799
+ tool = tools_from_relations(kg, [_Employee])[0]
1800
+ out = await tool.ainvoke({"department": "eng"})
1801
+ payload = json.loads(out)
1802
+ assert payload == {"error": "unknown error"}
1803
+
1804
+ async def test_structured_tool_handles_no_rows_error(self) -> None:
1805
+ """Error response with an empty rows list must not crash."""
1806
+ kg = _mock_kg(columns=["error"], rows=[])
1807
+ tool = tools_from_relations(kg, [_Employee])[0]
1808
+ out = await tool.ainvoke({"department": "eng"})
1809
+ payload = json.loads(out)
1810
+ assert payload == {"error": "unknown error"}
1811
+
1812
+
1813
+ class TestNoneAndEdgeValues:
1814
+ """None values and edge cases in results should be handled gracefully."""
1815
+
1816
+ async def test_retriever_none_in_content_column(self) -> None:
1817
+ """None content values should be skipped, not rendered as 'None'."""
1818
+ kg = _mock_kg(
1819
+ columns=["title", "content"],
1820
+ rows=[["Doc1", None]],
1821
+ )
1822
+ r = InputLayerRetriever(
1823
+ kg=kg,
1824
+ query="?docs(T, C)",
1825
+ page_content_columns=["content"],
1826
+ metadata_columns=["title"],
1827
+ )
1828
+ docs = await r.ainvoke("test")
1829
+ assert len(docs) == 1
1830
+ assert docs[0].page_content == "" # not "None"
1831
+
1832
+ async def test_retriever_all_none_content_columns(self) -> None:
1833
+ """When all content columns are None, page_content should be empty."""
1834
+ kg = _mock_kg(
1835
+ columns=["title", "body", "summary"],
1836
+ rows=[["Doc1", None, None]],
1837
+ )
1838
+ r = InputLayerRetriever(
1839
+ kg=kg,
1840
+ query="?docs(T, B, S)",
1841
+ page_content_columns=["body", "summary"],
1842
+ metadata_columns=["title"],
1843
+ )
1844
+ docs = await r.ainvoke("test")
1845
+ assert docs[0].page_content == ""
1846
+
1847
+
1848
+ class TestMetadataValidation:
1849
+ """Length mismatches in add_texts should be caught early."""
1850
+
1851
+ async def test_vectorstore_rejects_mismatched_metadatas(self) -> None:
1852
+ from inputlayer.integrations.langchain import InputLayerVectorStore
1853
+
1854
+ kg = MagicMock()
1855
+ kg.execute = AsyncMock(return_value=ResultSet(columns=[], rows=[]))
1856
+ store = InputLayerVectorStore(
1857
+ kg=kg,
1858
+ relation=_make_vector_relation(),
1859
+ embeddings=_StubEmbeddings(),
1860
+ )
1861
+ with pytest.raises(ValueError, match="Length mismatch"):
1862
+ await store.aadd_texts(
1863
+ ["text1", "text2", "text3"],
1864
+ metadatas=[{"a": 1}], # only 1 metadata for 3 texts
1865
+ )
1866
+
1867
+ async def test_vectorstore_rejects_mismatched_ids(self) -> None:
1868
+ from inputlayer.integrations.langchain import InputLayerVectorStore
1869
+
1870
+ kg = MagicMock()
1871
+ kg.execute = AsyncMock(return_value=ResultSet(columns=[], rows=[]))
1872
+ store = InputLayerVectorStore(
1873
+ kg=kg,
1874
+ relation=_make_vector_relation(),
1875
+ embeddings=_StubEmbeddings(),
1876
+ )
1877
+ with pytest.raises(ValueError, match="Length mismatch"):
1878
+ await store.aadd_texts(
1879
+ ["text1", "text2"],
1880
+ ids=["id1"], # only 1 id for 2 texts
1881
+ )
1882
+
1883
+
1884
+ def _make_vector_relation() -> type[Relation]:
1885
+ """Create a minimal Relation with a vector column for testing."""
1886
+ from inputlayer import Vector # noqa: F401 # used in forward annotation
1887
+
1888
+ class TestDoc(Relation):
1889
+ __relation_name__ = "test_doc"
1890
+ id: str
1891
+ content: str
1892
+ embedding: Vector
1893
+
1894
+ return TestDoc