Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Python: VolatileMemoryStore.get_nearest_match returns an un-awaited coroutine instead of a (MemoryRecord, score) tuple

オープン 初心者向け
#14,521 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 6 日以内に返信

@VANDRANKI がすでに取り組んでいます。

2026年10月1日 から。

  • #14523 @VANDRANKI による — オープン
  • #14580 @FOWEPJF255 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
88/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

python/semantic_kernel/memory/volatile_memory_store.py の VolatileMemoryStore.get_nearest_match から始め、次に動作するリファレンスとして ChromaMemoryStore.get_nearest_match と比較します。再現した呼び出しを対象とするリグレッションテストを追加し、未 await の coroutine を残さず、単一の (MemoryRecord, score) タプルを返すことを確認します。

索引モデルが issue の本文から書いたものです。

説明

python triage

What happens

VolatileMemoryStore.get_nearest_match is declared async def, but it returns the result of calling self.get_nearest_matches(...) without awaiting it. get_nearest_matches is also async def, so await store.get_nearest_match(...) gives the caller a coroutine, not the tuple[MemoryRecord, float] the signature promises. The inner coroutine is never run and Python warns "coroutine ... was never awaited". Even if it were awaited, it would be a list of tuples, not a single tuple.

Where

python/semantic_kernel/memory/volatile_memory_store.py, get_nearest_match (current main):

    ) -> tuple[MemoryRecord, float]:
        ...
        return self.get_nearest_matches(
            collection_name=collection_name,
            embedding=embedding,
            limit=1,
            min_relevance_score=min_relevance_score,
            with_embeddings=with_embedding,
        )

Reproduce

import asyncio, numpy as np
from semantic_kernel.memory.volatile_memory_store import VolatileMemoryStore
from semantic_kernel.memory.memory_record import MemoryRecord

async def main():
    s = VolatileMemoryStore()
    await s.create_collection("c")
    await s.upsert("c", MemoryRecord.local_record("id1", "text", "desc", None, np.array([1.0, 0.0])))
    m = await s.get_nearest_match("c", np.array([1.0, 0.0]))
    print(type(m))

asyncio.run(main())

Output on semantic-kernel main (also 1.44.1): <class 'coroutine'>

Expected

await store.get_nearest_match(...) returns a (MemoryRecord, score) tuple, as MemoryStoreBase.get_nearest_match documents. ChromaMemoryStore.get_nearest_match already does this: results = await self.get_nearest_matches(...) followed by return results[0].

Notes

The class is deprecated, but it is still exported from semantic_kernel.memory. I can send a fix with a test.

主要言語
C#
スター
28.7k
フォーク
4.8k
平均マージ
7日 5時間
マージ済み PR(30日)
59

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/semantic-kernel のほかの issue

microsoft/semantic-kernel の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。