You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Context7 response cache and topic cache keys raise UnicodeEncodeError for a library id or query with a lone surrogate #756
Two more cache keys hash text with .encode(): Context7Client.get_library_docs (dokimi/dokimi/mcp/context7.py:137, f"{library_id}:{query}:{max_tokens}") and RagasSeedExtractor.extract_topics (dokimi/dokimi/questions/ragas_seed.py:100, f"{library_id}:{max_topics}:{max_tokens}"). The library id comes from --context7-id or, for a local: doc source, from the path; the query is a question text. Repro, with a cache directory set: Context7Client(cache_dir=d).get_library_docs('org/n\udcff', 'q') and get_library_docs('org/x', json.loads('"n\\ud800"')) raise UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position N: surrogates not allowed at context7.py:137; RagasSeedExtractor(mcp_client=..., cache_dir=d).extract_topics(library_id='local:n\udcff', library_name='n', max_topics=3) raises at ragas_seed.py:100. The second one also stops EvaluationPipeline._generate_questions end to end for a local: doc source whose directory name has a non-UTF-8 byte, after the pipeline's own topics-cache key (#716) is fixed. Fix: os.fsencode(...) for the library id (a path or argv value) and .encode('utf-8', 'surrogatepass') for the query (question text from JSON), which keeps every key that encodes today unchanged.
Activity