cognee 0.3.4.dev4__py3-none-any.whl → 0.3.6__py3-none-any.whl

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 (184) hide show
  1. cognee/api/client.py +16 -7
  2. cognee/api/health.py +5 -9
  3. cognee/api/v1/add/add.py +3 -1
  4. cognee/api/v1/cognify/cognify.py +44 -7
  5. cognee/api/v1/permissions/routers/get_permissions_router.py +8 -4
  6. cognee/api/v1/search/search.py +3 -0
  7. cognee/api/v1/ui/__init__.py +1 -1
  8. cognee/api/v1/ui/ui.py +215 -150
  9. cognee/api/v1/update/__init__.py +1 -0
  10. cognee/api/v1/update/routers/__init__.py +1 -0
  11. cognee/api/v1/update/routers/get_update_router.py +90 -0
  12. cognee/api/v1/update/update.py +100 -0
  13. cognee/base_config.py +5 -2
  14. cognee/cli/_cognee.py +28 -10
  15. cognee/cli/commands/delete_command.py +34 -2
  16. cognee/eval_framework/corpus_builder/task_getters/get_default_tasks_by_indices.py +2 -2
  17. cognee/eval_framework/evaluation/direct_llm_eval_adapter.py +3 -2
  18. cognee/eval_framework/modal_eval_dashboard.py +9 -1
  19. cognee/infrastructure/databases/graph/config.py +9 -9
  20. cognee/infrastructure/databases/graph/get_graph_engine.py +4 -21
  21. cognee/infrastructure/databases/graph/kuzu/adapter.py +60 -9
  22. cognee/infrastructure/databases/hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py +3 -3
  23. cognee/infrastructure/databases/relational/config.py +4 -4
  24. cognee/infrastructure/databases/relational/create_relational_engine.py +11 -3
  25. cognee/infrastructure/databases/vector/chromadb/ChromaDBAdapter.py +7 -3
  26. cognee/infrastructure/databases/vector/config.py +7 -7
  27. cognee/infrastructure/databases/vector/create_vector_engine.py +7 -15
  28. cognee/infrastructure/databases/vector/embeddings/EmbeddingEngine.py +9 -0
  29. cognee/infrastructure/databases/vector/embeddings/FastembedEmbeddingEngine.py +11 -0
  30. cognee/infrastructure/databases/vector/embeddings/LiteLLMEmbeddingEngine.py +19 -2
  31. cognee/infrastructure/databases/vector/embeddings/OllamaEmbeddingEngine.py +11 -0
  32. cognee/infrastructure/databases/vector/embeddings/config.py +8 -0
  33. cognee/infrastructure/databases/vector/embeddings/get_embedding_engine.py +5 -0
  34. cognee/infrastructure/databases/vector/lancedb/LanceDBAdapter.py +11 -10
  35. cognee/infrastructure/databases/vector/pgvector/PGVectorAdapter.py +48 -38
  36. cognee/infrastructure/databases/vector/vector_db_interface.py +8 -4
  37. cognee/infrastructure/files/storage/S3FileStorage.py +15 -5
  38. cognee/infrastructure/files/storage/s3_config.py +1 -0
  39. cognee/infrastructure/files/utils/open_data_file.py +7 -14
  40. cognee/infrastructure/llm/LLMGateway.py +19 -117
  41. cognee/infrastructure/llm/config.py +28 -13
  42. cognee/infrastructure/llm/{structured_output_framework/litellm_instructor/extraction → extraction}/extract_categories.py +2 -1
  43. cognee/infrastructure/llm/{structured_output_framework/litellm_instructor/extraction → extraction}/extract_event_entities.py +3 -2
  44. cognee/infrastructure/llm/{structured_output_framework/litellm_instructor/extraction → extraction}/extract_summary.py +3 -2
  45. cognee/infrastructure/llm/{structured_output_framework/litellm_instructor/extraction → extraction}/knowledge_graph/extract_content_graph.py +2 -1
  46. cognee/infrastructure/llm/{structured_output_framework/litellm_instructor/extraction → extraction}/knowledge_graph/extract_event_graph.py +3 -2
  47. cognee/infrastructure/llm/prompts/read_query_prompt.py +3 -2
  48. cognee/infrastructure/llm/prompts/show_prompt.py +35 -0
  49. cognee/infrastructure/llm/prompts/test.txt +1 -0
  50. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/__init__.py +2 -2
  51. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/async_client.py +50 -397
  52. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/inlinedbaml.py +2 -3
  53. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/parser.py +8 -88
  54. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/runtime.py +78 -0
  55. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/stream_types.py +2 -99
  56. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/sync_client.py +49 -401
  57. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/type_builder.py +19 -882
  58. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/type_map.py +2 -34
  59. cognee/infrastructure/llm/structured_output_framework/baml/baml_client/types.py +2 -107
  60. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/acreate_structured_output.baml +26 -0
  61. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/__init__.py +1 -2
  62. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/acreate_structured_output.py +76 -0
  63. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/create_dynamic_baml_type.py +122 -0
  64. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/generators.baml +3 -3
  65. cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/anthropic/adapter.py +0 -32
  66. cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/gemini/adapter.py +107 -98
  67. cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/generic_llm_api/adapter.py +5 -6
  68. cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/get_llm_client.py +5 -6
  69. cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/llm_interface.py +0 -26
  70. cognee/infrastructure/llm/structured_output_framework/litellm_instructor/llm/openai/adapter.py +17 -67
  71. cognee/infrastructure/llm/tokenizer/Gemini/adapter.py +8 -7
  72. cognee/infrastructure/llm/utils.py +4 -4
  73. cognee/infrastructure/loaders/LoaderEngine.py +5 -2
  74. cognee/infrastructure/loaders/external/__init__.py +7 -0
  75. cognee/infrastructure/loaders/external/advanced_pdf_loader.py +244 -0
  76. cognee/infrastructure/loaders/supported_loaders.py +7 -0
  77. cognee/modules/data/methods/create_authorized_dataset.py +9 -0
  78. cognee/modules/data/methods/get_authorized_dataset.py +1 -1
  79. cognee/modules/data/methods/get_authorized_dataset_by_name.py +11 -0
  80. cognee/modules/data/methods/get_deletion_counts.py +92 -0
  81. cognee/modules/graph/cognee_graph/CogneeGraph.py +1 -1
  82. cognee/modules/graph/utils/expand_with_nodes_and_edges.py +22 -8
  83. cognee/modules/graph/utils/retrieve_existing_edges.py +0 -2
  84. cognee/modules/ingestion/data_types/TextData.py +0 -1
  85. cognee/modules/observability/get_observe.py +14 -0
  86. cognee/modules/observability/observers.py +1 -0
  87. cognee/modules/ontology/base_ontology_resolver.py +42 -0
  88. cognee/modules/ontology/get_default_ontology_resolver.py +41 -0
  89. cognee/modules/ontology/matching_strategies.py +53 -0
  90. cognee/modules/ontology/models.py +20 -0
  91. cognee/modules/ontology/ontology_config.py +24 -0
  92. cognee/modules/ontology/ontology_env_config.py +45 -0
  93. cognee/modules/ontology/rdf_xml/{OntologyResolver.py → RDFLibOntologyResolver.py} +20 -28
  94. cognee/modules/pipelines/layers/resolve_authorized_user_dataset.py +21 -24
  95. cognee/modules/pipelines/layers/resolve_authorized_user_datasets.py +3 -3
  96. cognee/modules/retrieval/code_retriever.py +2 -1
  97. cognee/modules/retrieval/context_providers/TripletSearchContextProvider.py +1 -4
  98. cognee/modules/retrieval/graph_completion_cot_retriever.py +6 -5
  99. cognee/modules/retrieval/graph_completion_retriever.py +0 -3
  100. cognee/modules/retrieval/insights_retriever.py +1 -1
  101. cognee/modules/retrieval/jaccard_retrival.py +60 -0
  102. cognee/modules/retrieval/lexical_retriever.py +123 -0
  103. cognee/modules/retrieval/natural_language_retriever.py +2 -1
  104. cognee/modules/retrieval/temporal_retriever.py +3 -2
  105. cognee/modules/retrieval/utils/brute_force_triplet_search.py +2 -12
  106. cognee/modules/retrieval/utils/completion.py +4 -7
  107. cognee/modules/search/methods/get_search_type_tools.py +7 -0
  108. cognee/modules/search/methods/no_access_control_search.py +1 -1
  109. cognee/modules/search/methods/search.py +32 -13
  110. cognee/modules/search/types/SearchType.py +1 -0
  111. cognee/modules/users/permissions/methods/authorized_give_permission_on_datasets.py +12 -0
  112. cognee/modules/users/permissions/methods/check_permission_on_dataset.py +11 -0
  113. cognee/modules/users/permissions/methods/get_all_user_permission_datasets.py +10 -0
  114. cognee/modules/users/permissions/methods/get_document_ids_for_user.py +10 -0
  115. cognee/modules/users/permissions/methods/get_principal.py +9 -0
  116. cognee/modules/users/permissions/methods/get_principal_datasets.py +11 -0
  117. cognee/modules/users/permissions/methods/get_role.py +10 -0
  118. cognee/modules/users/permissions/methods/get_specific_user_permission_datasets.py +3 -3
  119. cognee/modules/users/permissions/methods/get_tenant.py +9 -0
  120. cognee/modules/users/permissions/methods/give_default_permission_to_role.py +9 -0
  121. cognee/modules/users/permissions/methods/give_default_permission_to_tenant.py +9 -0
  122. cognee/modules/users/permissions/methods/give_default_permission_to_user.py +9 -0
  123. cognee/modules/users/permissions/methods/give_permission_on_dataset.py +10 -0
  124. cognee/modules/users/roles/methods/add_user_to_role.py +11 -0
  125. cognee/modules/users/roles/methods/create_role.py +12 -1
  126. cognee/modules/users/tenants/methods/add_user_to_tenant.py +12 -0
  127. cognee/modules/users/tenants/methods/create_tenant.py +12 -1
  128. cognee/modules/visualization/cognee_network_visualization.py +13 -9
  129. cognee/shared/data_models.py +0 -1
  130. cognee/shared/utils.py +0 -32
  131. cognee/tasks/chunk_naive_llm_classifier/chunk_naive_llm_classifier.py +2 -2
  132. cognee/tasks/codingagents/coding_rule_associations.py +3 -2
  133. cognee/tasks/entity_completion/entity_extractors/llm_entity_extractor.py +3 -2
  134. cognee/tasks/graph/cascade_extract/utils/extract_content_nodes_and_relationship_names.py +3 -2
  135. cognee/tasks/graph/cascade_extract/utils/extract_edge_triplets.py +3 -2
  136. cognee/tasks/graph/cascade_extract/utils/extract_nodes.py +3 -2
  137. cognee/tasks/graph/extract_graph_from_code.py +2 -2
  138. cognee/tasks/graph/extract_graph_from_data.py +55 -12
  139. cognee/tasks/graph/extract_graph_from_data_v2.py +16 -4
  140. cognee/tasks/ingestion/migrate_relational_database.py +132 -41
  141. cognee/tasks/ingestion/resolve_data_directories.py +4 -1
  142. cognee/tasks/schema/ingest_database_schema.py +134 -0
  143. cognee/tasks/schema/models.py +40 -0
  144. cognee/tasks/storage/index_data_points.py +1 -1
  145. cognee/tasks/storage/index_graph_edges.py +3 -1
  146. cognee/tasks/summarization/summarize_code.py +2 -2
  147. cognee/tasks/summarization/summarize_text.py +2 -2
  148. cognee/tasks/temporal_graph/enrich_events.py +2 -2
  149. cognee/tasks/temporal_graph/extract_events_and_entities.py +2 -2
  150. cognee/tests/cli_tests/cli_unit_tests/test_cli_commands.py +13 -4
  151. cognee/tests/cli_tests/cli_unit_tests/test_cli_edge_cases.py +13 -3
  152. cognee/tests/test_advanced_pdf_loader.py +141 -0
  153. cognee/tests/test_chromadb.py +40 -0
  154. cognee/tests/test_cognee_server_start.py +6 -1
  155. cognee/tests/test_data/Quantum_computers.txt +9 -0
  156. cognee/tests/test_lancedb.py +211 -0
  157. cognee/tests/test_pgvector.py +40 -0
  158. cognee/tests/test_relational_db_migration.py +76 -0
  159. cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py +2 -1
  160. cognee/tests/unit/modules/ontology/test_ontology_adapter.py +330 -13
  161. cognee/tests/unit/modules/retrieval/graph_completion_retriever_context_extension_test.py +0 -4
  162. cognee/tests/unit/modules/retrieval/graph_completion_retriever_cot_test.py +0 -4
  163. cognee/tests/unit/modules/retrieval/graph_completion_retriever_test.py +0 -4
  164. {cognee-0.3.4.dev4.dist-info → cognee-0.3.6.dist-info}/METADATA +92 -96
  165. {cognee-0.3.4.dev4.dist-info → cognee-0.3.6.dist-info}/RECORD +172 -160
  166. cognee/infrastructure/data/utils/extract_keywords.py +0 -48
  167. cognee/infrastructure/databases/hybrid/falkordb/FalkorDBAdapter.py +0 -1227
  168. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extract_categories.baml +0 -109
  169. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extract_content_graph.baml +0 -343
  170. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/extract_categories.py +0 -0
  171. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/extract_summary.py +0 -89
  172. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/knowledge_graph/__init__.py +0 -0
  173. cognee/infrastructure/llm/structured_output_framework/baml/baml_src/extraction/knowledge_graph/extract_content_graph.py +0 -44
  174. cognee/tasks/graph/infer_data_ontology.py +0 -309
  175. cognee/tests/test_falkordb.py +0 -174
  176. distributed/poetry.lock +0 -12238
  177. distributed/pyproject.toml +0 -186
  178. /cognee/infrastructure/llm/{structured_output_framework/litellm_instructor/extraction → extraction}/__init__.py +0 -0
  179. /cognee/infrastructure/llm/{structured_output_framework/litellm_instructor/extraction → extraction}/knowledge_graph/__init__.py +0 -0
  180. /cognee/infrastructure/llm/{structured_output_framework/litellm_instructor/extraction → extraction}/texts.json +0 -0
  181. {cognee-0.3.4.dev4.dist-info → cognee-0.3.6.dist-info}/WHEEL +0 -0
  182. {cognee-0.3.4.dev4.dist-info → cognee-0.3.6.dist-info}/entry_points.txt +0 -0
  183. {cognee-0.3.4.dev4.dist-info → cognee-0.3.6.dist-info}/licenses/LICENSE +0 -0
  184. {cognee-0.3.4.dev4.dist-info → cognee-0.3.6.dist-info}/licenses/NOTICE.md +0 -0
@@ -57,6 +57,7 @@ class BamlSyncClient:
57
57
  typing.Union[baml_py.baml_py.Collector, typing.List[baml_py.baml_py.Collector]]
58
58
  ] = None,
59
59
  env: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None,
60
+ on_tick: typing.Optional[typing.Callable[[str, baml_py.baml_py.FunctionLog], None]] = None,
60
61
  ) -> "BamlSyncClient":
61
62
  options: BamlCallOptions = {}
62
63
  if tb is not None:
@@ -67,6 +68,8 @@ class BamlSyncClient:
67
68
  options["collector"] = collector
68
69
  if env is not None:
69
70
  options["env"] = env
71
+ if on_tick is not None:
72
+ options["on_tick"] = on_tick
70
73
  return BamlSyncClient(self.__options.merge_options(options))
71
74
 
72
75
  @property
@@ -89,106 +92,30 @@ class BamlSyncClient:
89
92
  def parse_stream(self):
90
93
  return self.__llm_stream_parser
91
94
 
92
- def ExtractCategories(
93
- self,
94
- content: str,
95
- baml_options: BamlCallOptions = {},
96
- ) -> types.DefaultContentPrediction:
97
- result = self.__options.merge_options(baml_options).call_function_sync(
98
- function_name="ExtractCategories",
99
- args={
100
- "content": content,
101
- },
102
- )
103
- return typing.cast(
104
- types.DefaultContentPrediction,
105
- result.cast_to(types, types, stream_types, False, __runtime__),
106
- )
107
-
108
- def ExtractContentGraphGeneric(
109
- self,
110
- content: str,
111
- mode: typing.Optional[
112
- typing.Union[
113
- typing_extensions.Literal["simple"],
114
- typing_extensions.Literal["base"],
115
- typing_extensions.Literal["guided"],
116
- typing_extensions.Literal["strict"],
117
- typing_extensions.Literal["custom"],
118
- ]
119
- ] = None,
120
- custom_prompt_content: typing.Optional[str] = None,
121
- baml_options: BamlCallOptions = {},
122
- ) -> types.KnowledgeGraph:
123
- result = self.__options.merge_options(baml_options).call_function_sync(
124
- function_name="ExtractContentGraphGeneric",
125
- args={
126
- "content": content,
127
- "mode": mode,
128
- "custom_prompt_content": custom_prompt_content,
129
- },
130
- )
131
- return typing.cast(
132
- types.KnowledgeGraph, result.cast_to(types, types, stream_types, False, __runtime__)
133
- )
134
-
135
- def ExtractDynamicContentGraph(
136
- self,
137
- content: str,
138
- mode: typing.Optional[
139
- typing.Union[
140
- typing_extensions.Literal["simple"],
141
- typing_extensions.Literal["base"],
142
- typing_extensions.Literal["guided"],
143
- typing_extensions.Literal["strict"],
144
- typing_extensions.Literal["custom"],
145
- ]
146
- ] = None,
147
- custom_prompt_content: typing.Optional[str] = None,
148
- baml_options: BamlCallOptions = {},
149
- ) -> types.DynamicKnowledgeGraph:
150
- result = self.__options.merge_options(baml_options).call_function_sync(
151
- function_name="ExtractDynamicContentGraph",
152
- args={
153
- "content": content,
154
- "mode": mode,
155
- "custom_prompt_content": custom_prompt_content,
156
- },
157
- )
158
- return typing.cast(
159
- types.DynamicKnowledgeGraph,
160
- result.cast_to(types, types, stream_types, False, __runtime__),
161
- )
162
-
163
- def SummarizeCode(
164
- self,
165
- content: str,
166
- baml_options: BamlCallOptions = {},
167
- ) -> types.SummarizedCode:
168
- result = self.__options.merge_options(baml_options).call_function_sync(
169
- function_name="SummarizeCode",
170
- args={
171
- "content": content,
172
- },
173
- )
174
- return typing.cast(
175
- types.SummarizedCode, result.cast_to(types, types, stream_types, False, __runtime__)
176
- )
177
-
178
- def SummarizeContent(
179
- self,
180
- content: str,
181
- baml_options: BamlCallOptions = {},
182
- ) -> types.SummarizedContent:
183
- result = self.__options.merge_options(baml_options).call_function_sync(
184
- function_name="SummarizeContent",
185
- args={
186
- "content": content,
187
- },
188
- )
189
- return typing.cast(
190
- types.SummarizedContent, result.cast_to(types, types, stream_types, False, __runtime__)
191
- )
95
+ def AcreateStructuredOutput(
96
+ self,
97
+ text_input: str,
98
+ system_prompt: str,
99
+ baml_options: BamlCallOptions = {},
100
+ ) -> types.ResponseModel:
101
+ # Check if on_tick is provided
102
+ if "on_tick" in baml_options:
103
+ stream = self.stream.AcreateStructuredOutput(
104
+ text_input=text_input, system_prompt=system_prompt, baml_options=baml_options
105
+ )
106
+ return stream.get_final_response()
107
+ else:
108
+ # Original non-streaming code
109
+ result = self.__options.merge_options(baml_options).call_function_sync(
110
+ function_name="AcreateStructuredOutput",
111
+ args={
112
+ "text_input": text_input,
113
+ "system_prompt": system_prompt,
114
+ },
115
+ )
116
+ return typing.cast(
117
+ types.ResponseModel, result.cast_to(types, types, stream_types, False, __runtime__)
118
+ )
192
119
 
193
120
 
194
121
  class BamlStreamClient:
@@ -197,149 +124,26 @@ class BamlStreamClient:
197
124
  def __init__(self, options: DoNotUseDirectlyCallManager):
198
125
  self.__options = options
199
126
 
200
- def ExtractCategories(
201
- self,
202
- content: str,
203
- baml_options: BamlCallOptions = {},
204
- ) -> baml_py.BamlSyncStream[
205
- stream_types.DefaultContentPrediction, types.DefaultContentPrediction
206
- ]:
207
- ctx, result = self.__options.merge_options(baml_options).create_sync_stream(
208
- function_name="ExtractCategories",
209
- args={
210
- "content": content,
211
- },
212
- )
213
- return baml_py.BamlSyncStream[
214
- stream_types.DefaultContentPrediction, types.DefaultContentPrediction
215
- ](
216
- result,
217
- lambda x: typing.cast(
218
- stream_types.DefaultContentPrediction,
219
- x.cast_to(types, types, stream_types, True, __runtime__),
220
- ),
221
- lambda x: typing.cast(
222
- types.DefaultContentPrediction,
223
- x.cast_to(types, types, stream_types, False, __runtime__),
224
- ),
225
- ctx,
226
- )
227
-
228
- def ExtractContentGraphGeneric(
229
- self,
230
- content: str,
231
- mode: typing.Optional[
232
- typing.Union[
233
- typing_extensions.Literal["simple"],
234
- typing_extensions.Literal["base"],
235
- typing_extensions.Literal["guided"],
236
- typing_extensions.Literal["strict"],
237
- typing_extensions.Literal["custom"],
238
- ]
239
- ] = None,
240
- custom_prompt_content: typing.Optional[str] = None,
241
- baml_options: BamlCallOptions = {},
242
- ) -> baml_py.BamlSyncStream[stream_types.KnowledgeGraph, types.KnowledgeGraph]:
243
- ctx, result = self.__options.merge_options(baml_options).create_sync_stream(
244
- function_name="ExtractContentGraphGeneric",
245
- args={
246
- "content": content,
247
- "mode": mode,
248
- "custom_prompt_content": custom_prompt_content,
249
- },
250
- )
251
- return baml_py.BamlSyncStream[stream_types.KnowledgeGraph, types.KnowledgeGraph](
252
- result,
253
- lambda x: typing.cast(
254
- stream_types.KnowledgeGraph,
255
- x.cast_to(types, types, stream_types, True, __runtime__),
256
- ),
257
- lambda x: typing.cast(
258
- types.KnowledgeGraph, x.cast_to(types, types, stream_types, False, __runtime__)
259
- ),
260
- ctx,
261
- )
262
-
263
- def ExtractDynamicContentGraph(
264
- self,
265
- content: str,
266
- mode: typing.Optional[
267
- typing.Union[
268
- typing_extensions.Literal["simple"],
269
- typing_extensions.Literal["base"],
270
- typing_extensions.Literal["guided"],
271
- typing_extensions.Literal["strict"],
272
- typing_extensions.Literal["custom"],
273
- ]
274
- ] = None,
275
- custom_prompt_content: typing.Optional[str] = None,
276
- baml_options: BamlCallOptions = {},
277
- ) -> baml_py.BamlSyncStream[stream_types.DynamicKnowledgeGraph, types.DynamicKnowledgeGraph]:
278
- ctx, result = self.__options.merge_options(baml_options).create_sync_stream(
279
- function_name="ExtractDynamicContentGraph",
280
- args={
281
- "content": content,
282
- "mode": mode,
283
- "custom_prompt_content": custom_prompt_content,
284
- },
285
- )
286
- return baml_py.BamlSyncStream[
287
- stream_types.DynamicKnowledgeGraph, types.DynamicKnowledgeGraph
288
- ](
289
- result,
290
- lambda x: typing.cast(
291
- stream_types.DynamicKnowledgeGraph,
292
- x.cast_to(types, types, stream_types, True, __runtime__),
293
- ),
294
- lambda x: typing.cast(
295
- types.DynamicKnowledgeGraph,
296
- x.cast_to(types, types, stream_types, False, __runtime__),
297
- ),
298
- ctx,
299
- )
300
-
301
- def SummarizeCode(
302
- self,
303
- content: str,
304
- baml_options: BamlCallOptions = {},
305
- ) -> baml_py.BamlSyncStream[stream_types.SummarizedCode, types.SummarizedCode]:
306
- ctx, result = self.__options.merge_options(baml_options).create_sync_stream(
307
- function_name="SummarizeCode",
308
- args={
309
- "content": content,
310
- },
311
- )
312
- return baml_py.BamlSyncStream[stream_types.SummarizedCode, types.SummarizedCode](
313
- result,
314
- lambda x: typing.cast(
315
- stream_types.SummarizedCode,
316
- x.cast_to(types, types, stream_types, True, __runtime__),
317
- ),
318
- lambda x: typing.cast(
319
- types.SummarizedCode, x.cast_to(types, types, stream_types, False, __runtime__)
320
- ),
321
- ctx,
322
- )
323
-
324
- def SummarizeContent(
127
+ def AcreateStructuredOutput(
325
128
  self,
326
- content: str,
129
+ text_input: str,
130
+ system_prompt: str,
327
131
  baml_options: BamlCallOptions = {},
328
- ) -> baml_py.BamlSyncStream[stream_types.SummarizedContent, types.SummarizedContent]:
132
+ ) -> baml_py.BamlSyncStream[stream_types.ResponseModel, types.ResponseModel]:
329
133
  ctx, result = self.__options.merge_options(baml_options).create_sync_stream(
330
- function_name="SummarizeContent",
134
+ function_name="AcreateStructuredOutput",
331
135
  args={
332
- "content": content,
136
+ "text_input": text_input,
137
+ "system_prompt": system_prompt,
333
138
  },
334
139
  )
335
- return baml_py.BamlSyncStream[stream_types.SummarizedContent, types.SummarizedContent](
140
+ return baml_py.BamlSyncStream[stream_types.ResponseModel, types.ResponseModel](
336
141
  result,
337
142
  lambda x: typing.cast(
338
- stream_types.SummarizedContent,
339
- x.cast_to(types, types, stream_types, True, __runtime__),
143
+ stream_types.ResponseModel, x.cast_to(types, types, stream_types, True, __runtime__)
340
144
  ),
341
145
  lambda x: typing.cast(
342
- types.SummarizedContent, x.cast_to(types, types, stream_types, False, __runtime__)
146
+ types.ResponseModel, x.cast_to(types, types, stream_types, False, __runtime__)
343
147
  ),
344
148
  ctx,
345
149
  )
@@ -351,95 +155,17 @@ class BamlHttpRequestClient:
351
155
  def __init__(self, options: DoNotUseDirectlyCallManager):
352
156
  self.__options = options
353
157
 
354
- def ExtractCategories(
158
+ def AcreateStructuredOutput(
355
159
  self,
356
- content: str,
160
+ text_input: str,
161
+ system_prompt: str,
357
162
  baml_options: BamlCallOptions = {},
358
163
  ) -> baml_py.baml_py.HTTPRequest:
359
164
  result = self.__options.merge_options(baml_options).create_http_request_sync(
360
- function_name="ExtractCategories",
165
+ function_name="AcreateStructuredOutput",
361
166
  args={
362
- "content": content,
363
- },
364
- mode="request",
365
- )
366
- return result
367
-
368
- def ExtractContentGraphGeneric(
369
- self,
370
- content: str,
371
- mode: typing.Optional[
372
- typing.Union[
373
- typing_extensions.Literal["simple"],
374
- typing_extensions.Literal["base"],
375
- typing_extensions.Literal["guided"],
376
- typing_extensions.Literal["strict"],
377
- typing_extensions.Literal["custom"],
378
- ]
379
- ] = None,
380
- custom_prompt_content: typing.Optional[str] = None,
381
- baml_options: BamlCallOptions = {},
382
- ) -> baml_py.baml_py.HTTPRequest:
383
- result = self.__options.merge_options(baml_options).create_http_request_sync(
384
- function_name="ExtractContentGraphGeneric",
385
- args={
386
- "content": content,
387
- "mode": mode,
388
- "custom_prompt_content": custom_prompt_content,
389
- },
390
- mode="request",
391
- )
392
- return result
393
-
394
- def ExtractDynamicContentGraph(
395
- self,
396
- content: str,
397
- mode: typing.Optional[
398
- typing.Union[
399
- typing_extensions.Literal["simple"],
400
- typing_extensions.Literal["base"],
401
- typing_extensions.Literal["guided"],
402
- typing_extensions.Literal["strict"],
403
- typing_extensions.Literal["custom"],
404
- ]
405
- ] = None,
406
- custom_prompt_content: typing.Optional[str] = None,
407
- baml_options: BamlCallOptions = {},
408
- ) -> baml_py.baml_py.HTTPRequest:
409
- result = self.__options.merge_options(baml_options).create_http_request_sync(
410
- function_name="ExtractDynamicContentGraph",
411
- args={
412
- "content": content,
413
- "mode": mode,
414
- "custom_prompt_content": custom_prompt_content,
415
- },
416
- mode="request",
417
- )
418
- return result
419
-
420
- def SummarizeCode(
421
- self,
422
- content: str,
423
- baml_options: BamlCallOptions = {},
424
- ) -> baml_py.baml_py.HTTPRequest:
425
- result = self.__options.merge_options(baml_options).create_http_request_sync(
426
- function_name="SummarizeCode",
427
- args={
428
- "content": content,
429
- },
430
- mode="request",
431
- )
432
- return result
433
-
434
- def SummarizeContent(
435
- self,
436
- content: str,
437
- baml_options: BamlCallOptions = {},
438
- ) -> baml_py.baml_py.HTTPRequest:
439
- result = self.__options.merge_options(baml_options).create_http_request_sync(
440
- function_name="SummarizeContent",
441
- args={
442
- "content": content,
167
+ "text_input": text_input,
168
+ "system_prompt": system_prompt,
443
169
  },
444
170
  mode="request",
445
171
  )
@@ -452,95 +178,17 @@ class BamlHttpStreamRequestClient:
452
178
  def __init__(self, options: DoNotUseDirectlyCallManager):
453
179
  self.__options = options
454
180
 
455
- def ExtractCategories(
456
- self,
457
- content: str,
458
- baml_options: BamlCallOptions = {},
459
- ) -> baml_py.baml_py.HTTPRequest:
460
- result = self.__options.merge_options(baml_options).create_http_request_sync(
461
- function_name="ExtractCategories",
462
- args={
463
- "content": content,
464
- },
465
- mode="stream",
466
- )
467
- return result
468
-
469
- def ExtractContentGraphGeneric(
470
- self,
471
- content: str,
472
- mode: typing.Optional[
473
- typing.Union[
474
- typing_extensions.Literal["simple"],
475
- typing_extensions.Literal["base"],
476
- typing_extensions.Literal["guided"],
477
- typing_extensions.Literal["strict"],
478
- typing_extensions.Literal["custom"],
479
- ]
480
- ] = None,
481
- custom_prompt_content: typing.Optional[str] = None,
482
- baml_options: BamlCallOptions = {},
483
- ) -> baml_py.baml_py.HTTPRequest:
484
- result = self.__options.merge_options(baml_options).create_http_request_sync(
485
- function_name="ExtractContentGraphGeneric",
486
- args={
487
- "content": content,
488
- "mode": mode,
489
- "custom_prompt_content": custom_prompt_content,
490
- },
491
- mode="stream",
492
- )
493
- return result
494
-
495
- def ExtractDynamicContentGraph(
496
- self,
497
- content: str,
498
- mode: typing.Optional[
499
- typing.Union[
500
- typing_extensions.Literal["simple"],
501
- typing_extensions.Literal["base"],
502
- typing_extensions.Literal["guided"],
503
- typing_extensions.Literal["strict"],
504
- typing_extensions.Literal["custom"],
505
- ]
506
- ] = None,
507
- custom_prompt_content: typing.Optional[str] = None,
508
- baml_options: BamlCallOptions = {},
509
- ) -> baml_py.baml_py.HTTPRequest:
510
- result = self.__options.merge_options(baml_options).create_http_request_sync(
511
- function_name="ExtractDynamicContentGraph",
512
- args={
513
- "content": content,
514
- "mode": mode,
515
- "custom_prompt_content": custom_prompt_content,
516
- },
517
- mode="stream",
518
- )
519
- return result
520
-
521
- def SummarizeCode(
522
- self,
523
- content: str,
524
- baml_options: BamlCallOptions = {},
525
- ) -> baml_py.baml_py.HTTPRequest:
526
- result = self.__options.merge_options(baml_options).create_http_request_sync(
527
- function_name="SummarizeCode",
528
- args={
529
- "content": content,
530
- },
531
- mode="stream",
532
- )
533
- return result
534
-
535
- def SummarizeContent(
181
+ def AcreateStructuredOutput(
536
182
  self,
537
- content: str,
183
+ text_input: str,
184
+ system_prompt: str,
538
185
  baml_options: BamlCallOptions = {},
539
186
  ) -> baml_py.baml_py.HTTPRequest:
540
187
  result = self.__options.merge_options(baml_options).create_http_request_sync(
541
- function_name="SummarizeContent",
188
+ function_name="AcreateStructuredOutput",
542
189
  args={
543
- "content": content,
190
+ "text_input": text_input,
191
+ "system_prompt": system_prompt,
544
192
  },
545
193
  mode="stream",
546
194
  )