MCPcopy
hub / github.com/llmware-ai/llmware / add_source_query_results

Method add_source_query_results

llmware/prompts.py:374–389  ·  view source on GitHub ↗

Attach a new source to a prompt object by passing directly the query results from a previous query.

(self, query_results)

Source from the content-addressed store, hash-verified

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

Callers 15

_doc_summarizerMethod · 0.95
ragFunction · 0.80
msa_processingFunction · 0.80
get_rag_responseFunction · 0.80
semantic_ragFunction · 0.80
msa_processingFunction · 0.80

Calls 2

SourcesClass · 0.90
package_sourceMethod · 0.80

Tested by

no test coverage detected