Open
Conversation
9a4400f to
19520f3
Compare
This was referenced Apr 10, 2026
19520f3 to
e7e804e
Compare
…crosoft#231) - `parse_azure_endpoint` returned the full URL including `?api-version=...` - `AsyncAzureOpenAI` appends `/openai/` to `azure_endpoint`, producing a mangled URL with the query string in the path - Now strips the query string with `str.split("?", 1)[0]` before returning - Added 6 unit tests covering: basic URL, no version, separate env var, missing env var, empty query string ## Benchmark No performance impact — this is a correctness fix. --- *Generated by codeflash optimization agent*
- Defer `import black` from module level to first use in `answers.py` and `utils.py` - `black` (code formatter + transitive deps: pathspec, black.nodes, etc.) loaded on every `import typeagent` but only used in two cold formatting paths `black.format_str()` is called in two places: - `create_context_prompt()` in `knowpro/answers.py` — formats debug context for LLM prompts - `format_code()` in `aitools/utils.py` — developer pretty-print utility Neither runs during normal library operation. Moving the import inside each function eliminates ~78ms of transitive module loading from the import chain. ## Benchmark ### Azure Standard_D2s_v5 — 2 vCPU, 8 GiB RAM, Python 3.13 #### Import Time (hyperfine, warmup 5, min-runs 30) | Benchmark | Before | After | Speedup | |:---|---:|---:|---:| | `import typeagent` | 791 ms ± 11 ms | 713 ms ± 8 ms | **1.11x** | #### Offline E2E Test Suite (hyperfine, warmup 2, min-runs 10) | Benchmark | Before | After | Speedup | |:---|---:|---:|---:| | 69 offline tests | 5.72 s ± 90 ms | 5.60 s ± 98 ms | 1.02x | --- *Generated by codeflash optimization agent* --------- Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Add add_terms_batch / add_properties_batch to the index interfaces with executemany-based SQLite implementations. Restructure add_metadata_to_index_from_list and add_to_property_index to collect all items first, then batch-insert via extend() and the new batch methods. Eliminates ~1000 individual INSERT round-trips during indexing.
Rename _collect_{facet,entity,action}_{terms,properties} to drop the
leading underscore in propindex.py and semrefindex.py.
Change list to Sequence in add_terms_batch and add_properties_batch interfaces and implementations to satisfy covariance. Add missing add_terms_batch to FakeTermIndex in conftest.py.
4030379 to
82ba650
Compare
…ft#237) Apparently at least one of isort and black was updated and now produces more compact code in some cases. Also change the black call in Makefile to use only -tpy312 since black on 3.12 cannot parse back the py314 code it generated (maybe only the last -t flag was effective?). And finally make Makefile more robust by using `uv run X` instead of `.venv/bin/X`. --------- Co-authored-by: Kevin Turcios <turcioskevinr@gmail.com>
@bmerkle could you review this too? This is really an independent little tool, but super handy -- it can show you all your AI chats used from VS Code. (I suspect it wouldn't be too hard to be able to point it to other frameworks' logs as well.) --------- Co-authored-by: Guido van Rossum <gvanrossum@microsoft.com> Co-authored-by: Bernhard Merkle <bernhard.merkle@gmail.com>
fixes bugs described in microsoft#238 - regression URL parsing in PR microsoft#231 - uv.lock updated to newer versions in many cases
…move imports - Fix inverse_actions omission in add_metadata_to_index_from_list (regression) - Fix inverse_actions omission in add_metadata_to_index (pre-existing) - Delete duplicate add_entity_to_index, add_action_to_index, add_topic_to_index, text_range_from_location — unified into add_entity, add_action, add_topic - Update all callers and tests to use unified functions - Move function-level imports to top-level in sqlite/propindex.py per AGENTS.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
add_terms_batchandadd_properties_batchtoITermToSemanticRefIndexandIPropertyToSemanticRefIndexinterfacesexecutemanyinstead of individualcursor.execute()calls (~1000+ calls → 2-3 calls per indexing batch)add_metadata_to_index_from_listandadd_to_property_indexto collect all data first (pure functions), then batch-insertBenchmark
Azure Standard_D2s_v5 (2 vCPU, 8 GB RAM), Python 3.13, Ubuntu 24.04
pytest-async-benchmark pedantic mode, 20 rounds, 3 warmup -- only hot path timed (setup/teardown excluded)
add_messages_with_indexing(200 msgs)add_messages_with_indexing(50 msgs)Consistent ~14-16% improvement --
executemanyamortizes per-call overhead.Reproduce
Save the benchmark file below as
tests/benchmarks/test_benchmark_indexing.py, then:Benchmark test file (tests/benchmarks/test_benchmark_indexing.py)
If you'd like the benchmark tests committed to the repo, see follow-up PR #6.
Test plan
pytest tests/ -k "not test_benchmark")