SelfQueryRetriever returns duplicate document data using with chromaDB
Labels: name: area: embeddings, name: area: vector store, name: auto:bug

### System Info

Langchain version = 0.0.268

### Who can help?

_No response_

### Information

- [ ] The official example notebooks/scripts
- [X] My own modified scripts

### Related Components

- [ ] LLMs/Chat Models
- [X] Embedding Models
- [ ] Prompts / Prompt Templates / Prompt Selectors
- [ ] Output Parsers
- [ ] Document Loaders
- [X] Vector Stores / Retrievers
- [ ] Memory
- [ ] Agents / Agent Executors
- [ ] Tools / Toolkits
- [ ] Chains
- [ ] Callbacks/Tracing
- [ ] Async

### Reproduction

I have list of objects in roadmap.json and I tried to achieve the what was given in selfquery retriver documentation
```
with open('roadmap.json') as json_file:
  allRoadmap = json.load(json_file)

docs = []

for roadmap in allRoadmap:
  print(roadmap["name"])
  for section in roadmap["sections"]:
    single_doc = Document(
        page_content=f"This section is related to {roadmap['name']}",
        metadata={"roadmapName": roadmap["name"], "sectionTopic": section["name"]}
    )
    docs.append(single_doc)
    print(section["name"])
  print("\n")

vectorstore = Chroma.from_documents(docs, embeddings)

print(vectorstore)

for doc in docs:
  print(doc)
```

This above code outputs

```
page_content='This section is related to HTML for beginners' metadata={'roadmapName': 'HTML for beginners', 'sectionTopic': 'HTML Basics'}
page_content='This section is related to HTML for beginners' metadata={'roadmapName': 'HTML for beginners', 'sectionTopic': 'HTML Tags and Elements'}
page_content='This section is related to HTML for beginners' metadata={'roadmapName': 'HTML for beginners', 'sectionTopic': 'Intermediate Concepts'}
page_content='This section is related to HTML for beginners' metadata={'roadmapName': 'HTML for beginners', 'sectionTopic': 'Advanced Concepts'}
page_content='This section is related to How Search Engine Works' metadata={'roadmapName': 'How Search Engine Works', 'sectionTopic': 'Internet'}
page_content='This section is related to How Search Engine Works' metadata={'roadmapName': 'How Search Engine Works', 'sectionTopic': 'Search Engine'}
page_content='This section is related to Github Roadmap' metadata={'roadmapName': 'Github Roadmap', 'sectionTopic': 'Section 1'}
page_content='This section is related to Bootstrap' metadata={'roadmapName': 'Bootstrap', 'sectionTopic': 'Introduction'}
page_content='This section is related to Bootstrap' metadata={'roadmapName': 'Bootstrap', 'sectionTopic': 'Concepts'}
page_content='This section is related to Bootstrap' metadata={'roadmapName': 'Bootstrap', 'sectionTopic': 'Hands On'}
page_content='This section is related to MongoDB' metadata={'roadmapName': 'MongoDB', 'sectionTopic': 'Introduction'}
page_content='This section is related to MongoDB' metadata={'roadmapName': 'MongoDB', 'sectionTopic': 'Queries'}
page_content='This section is related to MongoDB' metadata={'roadmapName': 'MongoDB', 'sectionTopic': 'Data Modeling'}
page_content='This section is related to MongoDB' metadata={'roadmapName': 'MongoDB', 'sectionTopic': 'Aggregation'}
page_content='This section is related to Python for Beginers' metadata={'roadmapName': 'Python for Beginers', 'sectionTopic': 'Getting Started'}
page_content='This section is related to Python for Beginers' metadata={'roadmapName': 'Python for Beginers', 'sectionTopic': 'Basics'}
page_content='This section is related to Python for Beginers' metadata={'roadmapName': 'Python for Beginers', 'sectionTopic': 'Conditions and Loops'}
page_content='This section is related to Python for Beginers' metadata={'roadmapName': 'Python for Beginers', 'sectionTopic': 'Arrays'}
page_content='This section is related to Python for Beginers' metadata={'roadmapName': 'Python for Beginers', 'sectionTopic': 'Functions'}
page_content='This section is related to Python for Beginers' metadata={'roadmapName': 'Python for Beginers', 'sectionTopic': 'Solving Problems'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Basics'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Color and Background'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Typography and Fonts'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Spacing in CSS'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Basic Styling'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Positioning Techniques'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Advanced Styling'}
page_content='This section is related to Google Colab' metadata={'roadmapName': 'Google Colab', 'sectionTopic': 'Section 1'}
page_content='This section is related to MySQL' metadata={'roadmapName': 'MySQL', 'sectionTopic': 'Section 1'}
page_content='This section is related to Docker' metadata={'roadmapName': 'Docker', 'sectionTopic': 'Section 1'}
page_content='This section is related to AWS Lambda' metadata={'roadmapName': 'AWS Lambda', 'sectionTopic': 'Section 1'}
page_content='This section is related to Java' metadata={'roadmapName': 'Java', 'sectionTopic': 'Section 1'}

```
I tried to retrieve data from using selfQuery

```
from langchain.llms import OpenAI
from langchain.retrievers.self_query.base import SelfQueryRetriever
from langchain.chains.query_constructor.base import AttributeInfo

metadata_field_info = [
    AttributeInfo(
        name="sectionTopic",
        description="The section topic of the roadmap",
        type="string",
    ),
    AttributeInfo(
        name="roadmapName",
        description="Name of the roadmap",
        type="string",
    ),
]
document_content_description = "Roadmap section topics"
llm = OpenAI(temperature=0.1)
retriever = SelfQueryRetriever.from_llm(
    llm, vectorstore, document_content_description, metadata_field_info, verbose=True,
    search_kwargs={"k": 7}
)

retriever.get_relevant_documents("What are unique section topics that are related to css")

```
For the above code it gave repeated document. 

```
query='css' filter=None limit=None
[Document(page_content='This section is related to CSS for beginners', metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Advanced Styling'}),
 Document(page_content='This section is related to CSS for beginners', metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Typography and Fonts'}),
 Document(page_content='This section is related to CSS for beginners', metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Basic Styling'}),
 Document(page_content='This section is related to CSS for beginners', metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Color and Background'}),
 Document(page_content='This section is related to CSS for beginners', metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Spacing in CSS'}),
 Document(page_content='This section is related to CSS for beginners', metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Basic Styling'}),
 Document(page_content='This section is related to CSS for beginners', metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Advanced Styling'})]

```

### Expected behavior

It should return 7 unique documents
```
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Basics'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Color and Background'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Typography and Fonts'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Spacing in CSS'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Basic Styling'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Positioning Techniques'}
page_content='This section is related to CSS for beginners' metadata={'roadmapName': 'CSS for beginners', 'sectionTopic': 'Advanced Styling'}
```