Skip to content

Basically working VolatileMemoryStore#1110

Closed
dsgrieve wants to merge 16 commits intomicrosoft:experimental-javafrom
dsgrieve:dsgrieve/memory
Closed

Basically working VolatileMemoryStore#1110
dsgrieve wants to merge 16 commits intomicrosoft:experimental-javafrom
dsgrieve:dsgrieve/memory

Conversation

@dsgrieve
Copy link
Contributor

Motivation and Context

Description

Contribution Checklist

@dsgrieve
Copy link
Contributor Author

I am aware of the spotbugs issue. Working to resolve.

@lemillermicrosoft lemillermicrosoft added the java Issue or PR regarding Java code label May 19, 2023
@dsgrieve
Copy link
Contributor Author

Created bug #1113 to address mitigating spotbugs-exclude

@github-actions github-actions bot added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core python Pull requests for the Python Semantic Kernel labels May 22, 2023
@lemillermicrosoft lemillermicrosoft added the feature branch PR targeting a feature branch label May 22, 2023
@dluc
Copy link
Contributor

dluc commented May 22, 2023

@shawncal @markwallace-microsoft pls let us know when the merge has been sorted out. Currently the PR is changing files under dotnet/ and python/

SergeyMenshykh and others added 13 commits May 23, 2023 10:50
### Motivation, Context and Description
Fixing a few small potential issues related to AI services registration.

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [x] The code builds clean without any errors or warnings
- [x] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [x] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [x] All unit tests pass, and I have added new tests where possible
- [x] I didn't break anyone 😄
…174.8 to 8.0.0-preview.4.23259.5 in /dotnet (#1164)

Bumps
[Microsoft.Extensions.DependencyInjection](https://github.com/dotnet/runtime)
from 8.0.0-preview.3.23174.8 to 8.0.0-preview.4.23259.5.
### Motivation and Context
This PR introduces streaming methods to TextCompletionBase and
ChatCompletionBase. With this pr, you can stream LLM output in the
following ways:

```
import semantic_kernel as sk
from semantic_kernel.connectors.ai import ChatCompletionClientBase, TextCompletionClientBase, ChatRequestSettings, CompleteRequestSettings
from semantic_kernel.connectors.ai.open_ai import AzureTextCompletion, AzureChatCompletion, OpenAITextCompletion, OpenAIChatCompletion
from semantic_kernel.connectors.ai.hugging_face import HuggingFaceTextCompletion

kernel = sk.Kernel()

# Configure Azure LLM service
deployment, api_key, endpoint = sk.azure_openai_settings_from_dot_env()
text_service = AzureTextCompletion("text-davinci-003", endpoint, api_key)
chat_service = AzureChatCompletion("gpt-35-turbo", endpoint, api_key)

# Configure OpenAI service
api_key, org_id = sk.openai_settings_from_dot_env()
oai_text_service = OpenAITextCompletion("text-davinci-003", api_key, org_id)
oai_chat_service = OpenAIChatCompletion("gpt-3.5-turbo", api_key, org_id)

# Configure Hugging Face service
hf_text_service = HuggingFaceTextCompletion("gpt2", task="text-generation")

request_settings = CompleteRequestSettings(
    max_tokens=1000,
    temperature=0.7,
    top_p=1,
    frequency_penalty=0.5,
    presence_penalty=0.5
)

stream = oai_text_service.complete_stream_async("Write an essay on why AI is awesome:", request_settings)
async for text in stream:
    print(text, end = "") # end = "" to avoid newlines

chat_request_settings = ChatRequestSettings(
    max_tokens=1000,
    temperature=0.7,
    top_p=1,
    frequency_penalty=0.5,
    presence_penalty=0.5,
)

stream = oai_chat_service.complete_chat_stream_async([("user","Write an essay on why AI is awesome:")], chat_request_settings)
async for text in stream:
    print(text, end = "") # end = "" to avoid newlines

request_settings = CompleteRequestSettings(
    max_tokens=256,
    temperature=0.7,
    top_p=1,
    frequency_penalty=0.5,
    presence_penalty=0.5
)

stream = hf_text_service.complete_stream_async("Hi my name is ", request_settings)
async for text in stream:
    print(text, end = "") # end = "" to avoid newlines
```
**Out of Scope**: Improving the chat history interface with come in a
future PR

### Description
- added the method complete_stream_async to TextCompletionBase
- added the method complete_chat_stream_async to ChatCompletionBase
- Updated OpenAI and Hugging Face text completion service classes to
support new streaming methods
- Added new __init__.py to make importing service classes
### Description
Removing the DocFX csproj and associated files. Replacing this with a
**GitHub Actions** job that does not require this csproj in the repo.
Having this project in the repo takes time when running dotnet format,
and is additional code and complexity requiring maintenance. Removing
for cleanup.
@github-actions github-actions bot removed .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel python Pull requests for the Python Semantic Kernel kernel.core labels May 23, 2023
@dsgrieve
Copy link
Contributor Author

@markwallace-microsoft - The issue with changes outside of the java branch have been resolved.

@github-actions github-actions bot added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel python Pull requests for the Python Semantic Kernel samples labels May 23, 2023
@markwallace-microsoft
Copy link
Member

@markwallace-microsoft - The issue with changes outside of the java branch have been resolved.

@dsgrieve

I had to update the branch and I'm still seeing changes outside of the java folder

image

@dsgrieve
Copy link
Contributor Author

I really don't understand what's going on here. I'm going to abandon this PR and start another.

@dsgrieve dsgrieve closed this May 24, 2023
@dsgrieve dsgrieve deleted the dsgrieve/memory branch May 24, 2023 12:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature branch PR targeting a feature branch java Issue or PR regarding Java code kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code python Pull requests for the Python Semantic Kernel

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants