mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-21 14:18:52 +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
|
```python
|
||||||
# Input is a measurement, so should select the tall/short example
|
# 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">
|
<CodeOutputBlock lang="python">
|
||||||
@ -81,10 +81,10 @@ print(similar_prompt.format(adjective="fat"))
|
|||||||
```
|
```
|
||||||
Give the antonym of every input
|
Give the antonym of every input
|
||||||
|
|
||||||
Input: happy
|
Input: tall
|
||||||
Output: sad
|
Output: short
|
||||||
|
|
||||||
Input: fat
|
Input: large
|
||||||
Output:
|
Output:
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ print(similar_prompt.format(adjective="fat"))
|
|||||||
```python
|
```python
|
||||||
# You can add new examples to the SemanticSimilarityExampleSelector as well
|
# You can add new examples to the SemanticSimilarityExampleSelector as well
|
||||||
similar_prompt.example_selector.add_example({"input": "enthusiastic", "output": "apathetic"})
|
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">
|
<CodeOutputBlock lang="python">
|
||||||
@ -102,10 +102,10 @@ print(similar_prompt.format(adjective="joyful"))
|
|||||||
```
|
```
|
||||||
Give the antonym of every input
|
Give the antonym of every input
|
||||||
|
|
||||||
Input: happy
|
Input: enthusiastic
|
||||||
Output: sad
|
Output: apathetic
|
||||||
|
|
||||||
Input: joyful
|
Input: passionate
|
||||||
Output:
|
Output:
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user