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

Added a text completion connector to oobabooga text-generation-webui project #1357

Merged
merged 91 commits into from
Jul 8, 2023

Conversation

jsboige
Copy link
Contributor

@jsboige jsboige commented Jun 7, 2023

Motivation and Context

Oobabooga's text-generation-webui is the most popular open-source platform to host LLMs. It has a web API that supports blocking and streaming requests.
Having a connector to oobabooga brings semantic-kernel to the global "local Llamas" community.

Description

This PR adds to the solution a project similar to HuggingFace connectors project, and an additional integration test also similar to HuggingFace connector's
The code for the connector was based on the existing HuggingFace's, with a couple improvements (e.g. using web sockets for streaming API)

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows SK Contribution Guidelines (https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
  • The code follows the .NET coding conventions (https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions) verified with dotnet format
  • All unit tests pass, and I have added new tests where possible
    As for HuggingFace, the integration tests are meant to be tested manually together with oobabooga installed with a model selected and a running API. Both the blocking and streaming APIs were tested succesfully, though parameters mappings from sk's CompleteRequestSettings to oobabooga's TextCompletionRequest was done very roughly and would need adjusting since some units scales don't match, and oobabooga's API has a lot more parameters to feed, but I suppose it works well enough for an first version.
  • I didn't break anyone 😄

@github-actions github-actions bot added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel labels Jun 7, 2023
@jsboige
Copy link
Contributor Author

jsboige commented Jun 7, 2023

@microsoft-github-policy-service agree company="My Intelligence Agency"

Copy link
Member

@dmytrostruk dmytrostruk left a comment

Choose a reason for hiding this comment

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

@jsboige Awesome work, thank you! I left initial comments, when they will be resolved, I will test this functionality locally and if everything works as expected, we will merge it to main! Thanks again!

@dmytrostruk dmytrostruk added the PR: feedback to address Waiting for PR owner to address comments/questions label Jun 7, 2023
dmytrostruk
dmytrostruk previously approved these changes Jun 9, 2023
Copy link
Member

@dmytrostruk dmytrostruk left a comment

Choose a reason for hiding this comment

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

Tested this connector locally using integration tests - everything works as expected.

@dmytrostruk dmytrostruk added PR: ready to merge PR has been approved by all reviewers, and is ready to merge. and removed PR: feedback to address Waiting for PR owner to address comments/questions labels Jun 9, 2023
@dmytrostruk
Copy link
Member

dmytrostruk commented Jun 9, 2023

Please ignore Spell Check pipeline issue for now - we are going to fix that separately. PR still can be merged.

@lemillermicrosoft lemillermicrosoft removed the PR: ready to merge PR has been approved by all reviewers, and is ready to merge. label Jun 9, 2023
@jsboige
Copy link
Contributor Author

jsboige commented Jul 3, 2023

@dmytrostruk , @RogerBarreto,
Hi guys, as you may see, I'm strill struggling trying to figure out what's going on with the TextCompletionStreamingResult alternatives.
After some more tinkering and refactoring, it would seem that Channels do actually support concurrent asynchronous broadcasts of completion streams, which does not fit my understanding of how they work.
Conversely, I'm now struggling to get BroadcastBlocks to work with a rare racing condition.
Accordingly, I added logging and many unit tests to investigate those issues, and there will be some cleanup whether we decide for a single All-use-cases best implementation or not.

In the mean time, I would really appreciate your feedback on those complicated issues.

Edit: It seems you've been busy, so I just reverted to a single Channel based Result class since it seems to do the job, and wrapped up the unit tests.
I removed the dependency to the Dataflow library and set aside the alternatives in a dedicated branch if you ever want to give it a try.

@jsboige jsboige requested a review from dmytrostruk July 3, 2023 13:35
@github-actions github-actions bot added the docs and tests Improvements or additions to documentation label Jul 4, 2023
@dmytrostruk
Copy link
Member

@jsboige Thank you for the updates. I will review this PR and reply shortly.

@jsboige
Copy link
Contributor Author

jsboige commented Jul 7, 2023

@jsboige Thank you for the updates. I will review this PR and reply shortly.

Hi @dmytrostruk, do you have any news concerning this PR? I'll be happy to contribute some more, but since this has been open for quite some time now, and it does add a new project to the solution, it would be nice if we can wrap it up and move on.

@shawncal shawncal changed the base branch from main to feature/oobabooga July 8, 2023 03:54
@shawncal shawncal merged commit 91292ab into microsoft:feature/oobabooga Jul 8, 2023
8 of 10 checks passed
@shawncal
Copy link
Member

shawncal commented Jul 8, 2023

@jsboige Thanks for all the hard work! We'll help take this home.
Note: Our PR process requires that all changes be synced up with main before merge, and that's obviously a moving target. Normally we'd merge the latest changes for you before merging your PR, but it looks like you have the "Allow edits by maintainers" box turned off, so we can't merge into your PR branch.

I've merged the whole PR into a feature branch in the sk repo, where we'll easily be able to address any conflicts and @dmytrostruk will bring it into main. If there are any further changes you'd like to push in the meantime, please add them to the "feature/oobabooga" branch.

Thanks again!

@jsboige
Copy link
Contributor Author

jsboige commented Jul 8, 2023

Hi @shawncal , thanks for moving on with merging this PR.
About the "Allow edits by maintainers" feature, it appears that there is a bug preventing to enable that feature when the fork was made under an organization instead of a user, which is the case with this fork. Accordingly, I created a new Fork under my username and will start a new PR to that new branch from that new fork to help with finishing this up.

shawncal added a commit that referenced this pull request Jul 10, 2023
Hi, this is a new PR from a new user-level fork to account for a github
bug preventing edits by maintainers on a PR made from an
organization-level fork (see that [final
comment](#1357 (comment))
on last PR)
This PR is only an attempt at merging upstream's main for final
integration of the oobabooga connector into main branch. Last set of
commits made CompleteRequestSettings.MaxTokens Nullable
([#450f1d3a11eb95d6975da33f581d3997bed42906](#1367)),
which broke this connector.
Making TextCompletionRequest.MaxNewTokens also nullable fixed the issue.
Note that Oobabooga [defaults max tokens to
200](https://github.com/oobabooga/text-generation-webui/blob/main/extensions/api/util.py#L24)

Co-authored-by: Shawn Callegari <36091529+shawncal@users.noreply.github.com>
github-merge-queue bot pushed a commit that referenced this pull request Jul 17, 2023
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Merge
[feature/oobabooga](https://github.com/microsoft/semantic-kernel/tree/feature/oobabooga)
branch to `main` with
[Oobabooga](https://github.com/oobabooga/text-generation-webui) AI
Connector functionality.
Functionality verified with unit and integration testing.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

From original PR
(#1357):

> This PR adds to the solution a project similar to HuggingFace
connectors project, and an additional integration test also similar to
HuggingFace connector's
The code for the connector was based on the existing HuggingFace's, with
a couple improvements (e.g. using web sockets for streaming API)

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] 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#dev-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄


Co-authored-by: Jean-Sylvain Boige <jsboige@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jean-Sylvain Boige <jsboige@gmail.com>
Co-authored-by: Shawn Callegari <36091529+shawncal@users.noreply.github.com>
Co-authored-by: Gina Triolo <51341242+gitri-ms@users.noreply.github.com>
Co-authored-by: Devis Lucato <dluc@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Craig Presti <146438+craigomatic@users.noreply.github.com>
Co-authored-by: Craig Presti <craig.presti@microsoft.com>
Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
Co-authored-by: Teresa Hoang <125500434+teresaqhoang@users.noreply.github.com>
Co-authored-by: Abby Harrison <54643756+awharrison-28@users.noreply.github.com>
Co-authored-by: Tao Chen <TaoChenOSU@users.noreply.github.com>
Co-authored-by: Aman Sachan <51973971+amsacha@users.noreply.github.com>
Co-authored-by: cschadewitz <schadewitzcasey@gmail.com>
Co-authored-by: Abby Harrison <abby.harrison@microsoft.com>
piotrek-appstream pushed a commit to Appstream-Studio/semantic-kernel that referenced this pull request Jul 19, 2023
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->

Merge
[feature/oobabooga](https://github.com/microsoft/semantic-kernel/tree/feature/oobabooga)
branch to `main` with
[Oobabooga](https://github.com/oobabooga/text-generation-webui) AI
Connector functionality.
Functionality verified with unit and integration testing.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

From original PR
(microsoft#1357):

> This PR adds to the solution a project similar to HuggingFace
connectors project, and an additional integration test also similar to
HuggingFace connector's
The code for the connector was based on the existing HuggingFace's, with
a couple improvements (e.g. using web sockets for streaming API)

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [x] The code builds clean without any errors or warnings
- [x] 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#dev-scripts)
raises no violations
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄


Co-authored-by: Jean-Sylvain Boige <jsboige@gmail.com>

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jean-Sylvain Boige <jsboige@gmail.com>
Co-authored-by: Shawn Callegari <36091529+shawncal@users.noreply.github.com>
Co-authored-by: Gina Triolo <51341242+gitri-ms@users.noreply.github.com>
Co-authored-by: Devis Lucato <dluc@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Craig Presti <146438+craigomatic@users.noreply.github.com>
Co-authored-by: Craig Presti <craig.presti@microsoft.com>
Co-authored-by: Mark Wallace <127216156+markwallace-microsoft@users.noreply.github.com>
Co-authored-by: Teresa Hoang <125500434+teresaqhoang@users.noreply.github.com>
Co-authored-by: Abby Harrison <54643756+awharrison-28@users.noreply.github.com>
Co-authored-by: Tao Chen <TaoChenOSU@users.noreply.github.com>
Co-authored-by: Aman Sachan <51973971+amsacha@users.noreply.github.com>
Co-authored-by: cschadewitz <schadewitzcasey@gmail.com>
Co-authored-by: Abby Harrison <abby.harrison@microsoft.com>
@iamianM
Copy link

iamianM commented Aug 1, 2023

Any chance this could be done for the python package please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai connector Anything related to AI connectors docs and tests Improvements or additions to documentation kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code PR: feedback to address Waiting for PR owner to address comments/questions
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants