Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Avoid causing first-chance exceptions in CodeTokenizer #4471

Merged
merged 6 commits into from
Jan 5, 2024

Conversation

glahaye
Copy link
Contributor

@glahaye glahaye commented Jan 3, 2024

Motivation and Context

The CodeTokenizer routinely causes first-chance (caught) exceptions to determine whether tokens belong to function names of named argument blocks. This is inefficient but also can be startling depending on how one has set one's configuration for breaking on exceptions.

See #4418

Description

CodeTokenizer now uses a new method from NamedArgBlock to determine whether a string could result in a NamedArgBlock instead of resorting to causing exceptions to gather the same information.

Contribution Checklist

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
crazy-max CrazyMax
@glahaye glahaye requested a review from a team as a code owner January 3, 2024 22:03
@glahaye glahaye self-assigned this Jan 3, 2024
@shawncal shawncal added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels Jan 3, 2024
@github-actions github-actions bot changed the title Avoid causing first-chance exceptions in CodeTokenizer .Net: Avoid causing first-chance exceptions in CodeTokenizer Jan 3, 2024
@glahaye glahaye linked an issue Jan 3, 2024 that may be closed by this pull request
Copy link
Member

@markwallace-microsoft markwallace-microsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor comments

@glahaye glahaye added this pull request to the merge queue Jan 5, 2024
Merged via the queue into microsoft:main with commit 1c2d0fe Jan 5, 2024
@glahaye glahaye deleted the namedArgBlock branch January 5, 2024 17:56
Bryan-Roe pushed a commit to Bryan-Roe-ai/semantic-kernel that referenced this pull request Oct 6, 2024
…ft#4471)

### Motivation and Context
The CodeTokenizer routinely causes first-chance (caught) exceptions to
determine whether tokens belong to function names of named argument
blocks. This is inefficient but also can be startling depending on how
one has set one's configuration for breaking on exceptions.

See microsoft#4418 

### Description
CodeTokenizer now uses a new method from NamedArgBlock to determine
whether a string could result in a NamedArgBlock instead of resorting to
causing exceptions to gather the same information.

### Contribution Checklist
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

.Net: Semantic Kernel Exception when running TextMemory Plugin Sample
4 participants