Attach a new source to a prompt object by passing directly the query results from a previous query.
(self, query_results)
| 372 | return sources |
| 373 | |
| 374 | def add_source_query_results(self, query_results): |
| 375 | |
| 376 | """ Attach a new source to a prompt object by passing directly the query results from a previous query. """ |
| 377 | |
| 378 | # example use - run a query directly, and then 'add' the query results to a prompt |
| 379 | # query_results = Query(self.library).semantic_query("what is the duration of the non-compete clause?") |
| 380 | # prompter = Prompt().load_model("claude-instant-v1",api_key="my_api_key") |
| 381 | # sources = prompter.add_source_query_results(query_results["results"]) |
| 382 | |
| 383 | sources = Sources(self).package_source(query_results,aggregate_source=True) |
| 384 | |
| 385 | # enables use of 'prompt_with_sources' |
| 386 | if not sources["text_batch"]: |
| 387 | logger.warning("No source added in .add_source_query_results.") |
| 388 | |
| 389 | return sources |
| 390 | |
| 391 | def add_source_library(self, library_name, account_name="llmware"): |
| 392 |
no test coverage detected