mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-30 19:49:09 +00:00
Docs: improve similarity search examples (#11298)
**Description:** Examples in the "Select by similarity" section were not really highlighting capabilities of similarity search. E.g. "# Input is a measurement, so should select the tall/short example" was still outputting the "mood" example. I tweaked the inputs a bit and fixed the examples (checking that those are indeed what the search outputs). Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
4adb2b399d
commit
1ca62b232b
@ -73,7 +73,7 @@ print(similar_prompt.format(adjective="worried"))
|
||||
|
||||
```python
|
||||
# Input is a measurement, so should select the tall/short example
|
||||
print(similar_prompt.format(adjective="fat"))
|
||||
print(similar_prompt.format(adjective="large"))
|
||||
```
|
||||
|
||||
<CodeOutputBlock lang="python">
|
||||
@ -81,10 +81,10 @@ print(similar_prompt.format(adjective="fat"))
|
||||
```
|
||||
Give the antonym of every input
|
||||
|
||||
Input: happy
|
||||
Output: sad
|
||||
Input: tall
|
||||
Output: short
|
||||
|
||||
Input: fat
|
||||
Input: large
|
||||
Output:
|
||||
```
|
||||
|
||||
@ -94,7 +94,7 @@ print(similar_prompt.format(adjective="fat"))
|
||||
```python
|
||||
# You can add new examples to the SemanticSimilarityExampleSelector as well
|
||||
similar_prompt.example_selector.add_example({"input": "enthusiastic", "output": "apathetic"})
|
||||
print(similar_prompt.format(adjective="joyful"))
|
||||
print(similar_prompt.format(adjective="passionate"))
|
||||
```
|
||||
|
||||
<CodeOutputBlock lang="python">
|
||||
@ -102,10 +102,10 @@ print(similar_prompt.format(adjective="joyful"))
|
||||
```
|
||||
Give the antonym of every input
|
||||
|
||||
Input: happy
|
||||
Output: sad
|
||||
Input: enthusiastic
|
||||
Output: apathetic
|
||||
|
||||
Input: joyful
|
||||
Input: passionate
|
||||
Output:
|
||||
```
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user