meilisearch / meilisearch-python

Python wrapper for the Meilisearch API
https://meilisearch.com
MIT License
459 stars 85 forks source link

semantic score not generated when sending a query using vectorstore.similarity_search method #962

Closed AhmedMostafa08 closed 5 months ago

AhmedMostafa08 commented 5 months ago

Description when trying to send a query using vectorstore.similarity_search i get a KeyError: '_semanticScore' as the result doesn't have a semantic score generated semantic_score = result["_semanticScore"]

Expected behavior to get a response

Current behavior the mentioned error happens

here's the code for how I created the vector index : client=meilisearch.Client('url','api key ') embeddings = OpenAIEmbeddings() vectorstore = Meilisearch( embedding=embeddings, client=client, embedders=embedders, index_name='vector_index') and here's the embedding and embedder code embeddings = OpenAIEmbeddings() embedders = { "default": { "source": "userProvided", "dimensions": 1536, } } embedder_name = "default"

also note that the vector store is created and documents are added just fine and here's an example for the indexed document Document(page_content="name: MA in Sport Management\ncities: ['Southampton']\ncountries: ['United Kingdom']\ncontinents: ['Europe']\nei: Solent University\nmajors: ['Sports Management']\nminors: ['Sport and Fitness Management']\ndegree_level: Masters\nid: 470849\nis_featured: False\nint_fee_currency: USD\ntuition_fee_type: absolute\nslug: ma-in-sport-management\nboosted: 299995\nphoto: https://active-storage-assets.s3.eu-west-1.amazonaws.com/3t4naBgJWYSZqr8DZrg4GkAY\npartnership_boost: 49926\npartnership_type: Recruitment Solution\neasy_apply: True\nprogram_ranking: None\nei_global_ranking: 74\nei_country_ranking: 93\nleads_subscription: 0\nvisits_subscription: 0\ntotal_tuition_fee: 18352.0\nprogram_level_id: 71\nparent_degree_level_id: 2770\ncity_ids: [30580]\ncountry_ids: [75]\nmajor_ids: [2846]\nint_tuition_fees: 18352.0\ntuition_fees: 10,000 - 20,000\nduration_in_days: 365\napplication_deadlines: [1688774400]\nei_id: 36943\npersuasion_text: None\nintakes: ['Winter 2023', 'Fall 2023', 'Winter 2024']\nduration: Less than 2 years\nparent_degree_level: Masters\nformat: Full time\nstudy_type: ['On campus']\ndiscipline: {'lvl0': ['Business & Management'], 'lvl1': ['Business & Management > Sports Management']}\npage_content: name: MA in Sport Management\ncities: ['Southampton']\ncountries: ['United Kingdom']\ncontinents: ['Europe']\nei: Solent University\nmajors: ['Sports Management']\nminors: ['Sport and Fitness Management']\ndegree_level: Masters\nid: 470849\nis_featured: False\nint_fee_currency: USD\ntuition_fee_type: absolute\nslug: ma-in-sport-management\nboosted: 299995\nphoto: https://active-storage-assets.s3.eu-west-1.amazonaws.com/3t4naBgJWYSZqr8DZrg4GkAY\npartnership_boost: 49926\npartnership_type: Recruitment Solution\neasy_apply: True\nprogram_ranking: None\nei_global_ranking: 74\nei_country_ranking: 93\nleads_subscription: 0\nvisits_subscription: 0\ntotal_tuition_fee: 18352.0\nprogram_level_id: 71\nparent_degree_level_id: 2770\ncity_ids: [30580]\ncountry_ids: [75]\nmajor_ids: [2846]\nint_tuition_fees: 18352.0\ntuition_fees: 10,000 - 20,000\nduration_in_days: 365\napplication_deadlines: [1688774400]\nei_id: 36943\npersuasion_text: None\nintakes: ['Winter 2023', 'Fall 2023', 'Winter 2024']\nduration: Less than 2 years\nparent_degree_level: Masters\nformat: Full time\nstudy_type: ['On campus']\ndiscipline: {'lvl0': ['Business & Management'], 'lvl1': ['Business & Management > Sports Management']}", metadata={'source': 'https://www.educatly.com/program/470849')

sanders41 commented 5 months ago

_semanticScore was removed from the results in 1.8.0. See the Hybrid Search section of the release notes https://github.com/meilisearch/meilisearch/releases/tag/v1.8.0.

sanders41 commented 5 months ago

I'm going to go ahead and close this, but if there is somthing I'm missing about the issue feel free to reopen and further explain.