@@ -57,22 +57,36 @@ AZURE_LLM_DEPLOYMENT_MODEL=gpt-35-turbo
57
57
58
58
## Testing using a retriever with a basic query
59
59
60
- You are now ready to test the example retriever. Run the following to ask a question with the
61
- results augmented via the ` marklogic_retriever .py` module in this project; you will be
62
- prompted for an AzureOpenAI API key when you run this, which you can type or paste in :
60
+ You are now ready to test the example retriever. Run the following to ask a question
61
+ with the results augmented via the ` marklogic_similar_query_retriever .py` module in this
62
+ project :
63
63
64
64
python ask_similar_query.py "What is task decomposition?" posts
65
65
66
- The retriever uses a [ cts.similarQuery] ( https://docs.marklogic.com/cts.similarQuery ) to select from the documents
67
- loaded via ` load_data.py ` . It defaults to a page length of 10. You can change this by providing a command line
68
- argument - e.g.:
66
+ The retriever uses a [ cts.similarQuery] ( https://docs.marklogic.com/cts.similarQuery ) to
67
+ select from the documents loaded via ` load_data.py ` . It defaults to a page length of 10.
68
+ You can change this by providing a command line argument - e.g.:
69
69
70
70
python ask_similar_query.py "What is task decomposition?" posts 15
71
71
72
72
Example of a question for the "sotu" (State of the Union speech) collection:
73
73
74
74
python ask_similar_query.py "What are economic sanctions?" sotu 20
75
75
76
- To use a word query instead of a similar query, along with a set of drop words, specify "word" as the 4th argument:
76
+ To use a word query instead of a similar query, along with a set of drop words, specify
77
+ "word" as the 4th argument:
77
78
78
79
python ask_similar_query.py "What are economic sanctions?" sotu 20 word
80
+
81
+ ## Testing using a retriever with a contextual query
82
+
83
+ There may be times when your langchain application needs to use both a question and a
84
+ structured query during the document retrieval process. To see an example of this, run
85
+ the following to ask a question. That question is combined with a hard-coded structured
86
+ query using the ` marklogic_contextual_query_retriever.py ` module in this project.
87
+
88
+ python ask_contextual_query.py "What is task decomposition?" posts
89
+
90
+ This retriever builds a term-query using words from the question. Then the term-query is
91
+ added to the structured query and the merged query is used to select from the documents
92
+ loaded via ` load_data.py ` .
0 commit comments