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

Update ChatBot to work with dotnet-isolated and remove durable dependency #10

Merged
merged 30 commits into from
Feb 13, 2024

Conversation

aishwaryabh
Copy link
Contributor

@aishwaryabh aishwaryabh commented Jan 24, 2024

Resolves issue: https://github.com/Azure/azure-functions-pyfx-planning/issues/141

This PR removes the durable dependency in the chat bot as that was causing issues in the compatibility with dotnet-isolated since durable can't run a built in function that is technically OOP in in-proc mode. We decided to replace durable with table storage, in which the ChatBotStateEntity stores the state of the chatbot and the ChatMessageTableEntity represents each message that the chat bot processes. Each entity has the partition key being the id of the chat bot and the rowkey is called ChatMessage + index number of that message.

The table storage is configured by the user by adding the following in the host.json:

"extensions": {
    "openai": {
      "StorageConnectionName": "AzureWebJobsStorage",
      "CollectionName": "ChatBotRequests"
    }
  }

StorageConnectionName can be any connection string of a storage account and CollectionName is the name of the table that would hold the chat bot state and messages.

Here is an example of what the azure storage table will look like:
image
ChatBotState represents the state of the chatbot, and the corresponding messages are all of type ChatMessageEntity which contains each user that is relayed to and by the chatbot.

@manvkaur
Copy link
Collaborator

take latest of main and merge to your current branch, should have some conflicts and would require some changes

Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

Initial feedback on the samples and worker extension changes. Haven't looked at the WebJobs changes yet.

@aishwaryabh aishwaryabh changed the title Remove durable prototype Fix ChatBot to work with dotnet-isolated and remove durable dependency Jan 31, 2024
@aishwaryabh aishwaryabh marked this pull request as ready for review January 31, 2024 21:04
@aishwaryabh aishwaryabh changed the title Fix ChatBot to work with dotnet-isolated and remove durable dependency Update ChatBot to work with dotnet-isolated and remove durable dependency Jan 31, 2024
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

Added more feedback, this time including the table storage implementation.

samples/chat/csharp-inproc/host.json Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotEntity.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Models/ChatBotStateEntity.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

More comments, this time a bit more skewed towards code style and organization. We to make sure the changes in your PR are consistent with the rest of the code in this repo.

src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Models/ChatBotStateEntity.cs Outdated Show resolved Hide resolved
@cgillum cgillum mentioned this pull request Feb 8, 2024
3 tasks
Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

A few more comments, mostly around code style but a few around proper API usage, and one about potential issues with batch transaction sizes. I think we're nearly done!

src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
src/WebJobs.Extensions.OpenAI/Agents/ChatBotService.cs Outdated Show resolved Hide resolved
@manvkaur
Copy link
Collaborator

manvkaur commented Feb 13, 2024

some changes in https://github.com/Azure/azure-functions-openai-extension/blob/main/build/build-release.yml to publish worker nupkg as well can be done once worker reference is updated
Update below lines to include Worker package

Line 54 - Pattern: WebJobs.Extensions.OpenAI*.dll
Line 91 - projects: src//WebJobs.Extensions.OpenAI.csproj
Line 98 - Pattern: 'Microsoft.Azure.WebJobs.Extensions.OpenAI*.nupkg'

The attached build should produce 3 nupkg in artifacts

Copy link
Member

@cgillum cgillum left a comment

Choose a reason for hiding this comment

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

Just a few additional tiny suggestions plus one small question, but all blockers are resolved so I'm signing off. :)

build/build-release.yml Outdated Show resolved Hide resolved
build/build-release.yml Outdated Show resolved Hide resolved
build/build-release.yml Outdated Show resolved Hide resolved
Copy link
Collaborator

@manvkaur manvkaur left a comment

Choose a reason for hiding this comment

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

approving the PR, no blocking comment, check the build issues

@aishwaryabh aishwaryabh merged commit df416ce into main Feb 13, 2024
3 checks passed
@cgillum cgillum deleted the aibhandari/remove-durable-prototype branch February 14, 2024 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants