Commit Graph
824 Commits
Author SHA1 Message Date
Bruno Borges bdbdc90661 Fix formatting (#1492) 2023-06-15 17:34:56 -07:00
markwallace-microsoft cb7abb3748 Merge remote-tracking branch 'origin/main' into experimental-java 2023-06-14 10:44:50 +01:00
dependabot[bot] 398982877d Bump Polly from 7.2.3 to 7.2.4 in /dotnet (#1475)
Bumps [Polly](https://github.com/App-vNext/Polly) from 7.2.3 to 7.2.4.
2023-06-13 22:07:37 -07:00
Giuseppe Romagnuolo a84723710d Update dependabot.yml (#1447)
1. Fixes incorrect comment
2. Improves documentation accuracy
2023-06-13 21:50:04 -07:00
Phil JirsaandCraig Presti 08bc3ccc44 Add .NET 7.0 SDK feature to devcontainer configuration (#1424)
### Motivation and Context
Resolves #1421 by specifying .NET 7.0 SDK as feature for dev container
to install.

Co-authored-by: Craig Presti <[email protected]>
2023-06-14 00:56:11 +00:00
Teresa Hoang 424e579662 Updating samples to suggest chat completion models (#1448)
### Motivation and Context
Updating all sample apps to suggest `gpt-3.5-turbo` as an example since
we no longer use text completion models in the samples.
2023-06-14 00:52:32 +00:00
Tao Chen 42cf99d907 Copilot Chat: Add back attrs needed for testing (#1449)
### Motivation and Context
Two attributes in the chat history item needed for testing purposes were accidentally removed.

### Description
Add the attributes back.
2023-06-13 17:03:00 -07:00
Mark KarleandAbby Harrison 4994f37643 Adding import checking to ruff (#1294)
### Motivation and Context

Replacing flake8 and isort with ruff in the pre-commit hook.
Adding "I" to ruff rules so that it checks for import errors.

Co-authored-by: Abby Harrison <[email protected]>
2023-06-13 16:42:49 -07:00
Desmond Howard f31c58bf7a CopilotChat: Fix prompt and improve creation for Document messages (#1400)
### Motivation and Context
Fixes the prompt for Document messages to be a natural language string
vs the JSON messaged that is stored.
Also changes the import flow to save messages in the same call vs going
back to the server again.

### Description
- updates `getFormattedString()` in `ChatMessage` to return a human
readable for Document messages
- updates `DocumentImportController` to create the `ChatMessage` which
removes the need to go to the `ChatSkill` after the `importDocument`
call returns.

### Before


![image](https://github.com/microsoft/semantic-kernel/assets/52973358/30ce97bf-8d06-44ae-9cd0-4f6de08499c9)


### After

![image](https://github.com/microsoft/semantic-kernel/assets/52973358/e94e5c5a-eb49-4cee-9b3d-8acfeaeefe36)
2023-06-13 11:34:46 -07:00
Bruno Borges 8d84dcca82 Recommended extensions for Java (#1438) 2023-06-13 10:04:21 -07:00
88fca3c85e Create Java Format workflow (#1344)
### Motivation and Context

### Description
Add command to PRs to properly format Java code.

This PR is a copy of #1304 but `experimental-java` branch is not capable
of creating this workflow.


### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [ ] 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
- [ ] I didn't break anyone 😄

---------

Co-authored-by: Lee Miller <[email protected]>
Co-authored-by: Mark Wallace <[email protected]>
2023-06-13 17:50:06 +01:00
f0df43528a CopilotChat: Add drag and drop for file upload (#1413)
### 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.
-->
gives users the ability to drag files into the textbox for upload.

### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
- adds additional styling to the `textarea` in `ChatInput` when a file
is being dragged over the element
- uses the existing `importDocument` handler to import the dropped file
> there is a slight lag from when the file is dropped vs when the upload
starts that seems to be a result of when the browser calls `onDrop` for
the `textarea`


### Preview

![gif](https://github.com/microsoft/semantic-kernel/assets/52973358/dc79e189-5a31-4acd-a834-ec8da203ac89)

### 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 😄

---------

Co-authored-by: Lee Miller <[email protected]>
Co-authored-by: Teresa Hoang <[email protected]>
Co-authored-by: Harleen Thind <[email protected]>
2023-06-13 09:24:20 -07:00
dependabot[bot] cde9d6d7a1 Bump cryptography from 39.0.2 to 41.0.0 in /samples/apps/hugging-face-http-server (#1320)
Bumps [cryptography](https://github.com/pyca/cryptography) from 39.0.2 to 41.0.0.

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 18:58:40 -07:00
dependabot[bot] 99592594cb Bump weaviate-client from 3.19.2 to 3.20.0 in /python (#1436)
Bumps
[weaviate-client](https://github.com/weaviate/weaviate-python-client)
from 3.19.2 to 3.20.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/weaviate/weaviate-python-client/releases">weaviate-client's
releases</a>.</em></p>
<blockquote>
<h2>v3.20.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Increase version of requests library by <a
href="https://github.com/dirkkul"><code>@​dirkkul</code></a> in <a
href="https://redirect.github.com/weaviate/weaviate-python-client/pull/353">weaviate/weaviate-python-client#353</a></li>
<li>Add error handling for grpc by <a
href="https://github.com/dirkkul"><code>@​dirkkul</code></a> in <a
href="https://redirect.github.com/weaviate/weaviate-python-client/pull/328">weaviate/weaviate-python-client#328</a></li>
<li>Add explicit license by <a
href="https://github.com/dirkkul"><code>@​dirkkul</code></a> in <a
href="https://redirect.github.com/weaviate/weaviate-python-client/pull/355">weaviate/weaviate-python-client#355</a></li>
<li>Increase default embedded version to 1.19.7 by <a
href="https://github.com/dirkkul"><code>@​dirkkul</code></a> in <a
href="https://redirect.github.com/weaviate/weaviate-python-client/pull/356">weaviate/weaviate-python-client#356</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/weaviate/weaviate-python-client/compare/v3.19.2...v3.20.0">https://github.com/weaviate/weaviate-python-client/compare/v3.19.2...v3.20.0</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/weaviate/weaviate-python-client/blob/main/docs/changelog.rst">weaviate-client's
changelog</a>.</em></p>
<blockquote>
<h2>Version 3.20.0</h2>
<p>This minor version includes:</p>
<ul>
<li>Increase maximum version of request library to <code>2.31.0</code>.
This also updates to urllib 2.0. This may contain minor breaking changes
if you use urllib in other projects in the same virtual
environment.</li>
<li>Add licensing information to pypi package</li>
<li>Increase default embedded version t0 1.19.7</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/5a161a9e167edba2f46a0f0991e09a71b5057f37"><code>5a161a9</code></a>
Merge pull request <a
href="https://redirect.github.com/weaviate/weaviate-python-client/issues/357">#357</a>
from weaviate/release/3.20.0</li>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/e3ab1962628324d3350aaf849ac9a7982b1afde2"><code>e3ab196</code></a>
Update changelog for 3.20.0</li>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/5f59fb79d67cf43f247e487fb0ee5b82e9ad1e5e"><code>5f59fb7</code></a>
Merge pull request <a
href="https://redirect.github.com/weaviate/weaviate-python-client/issues/356">#356</a>
from weaviate/default_version</li>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/eda1eeccd66ec357b011d4c78fbecfbbfd05a38a"><code>eda1eec</code></a>
Merge pull request <a
href="https://redirect.github.com/weaviate/weaviate-python-client/issues/355">#355</a>
from weaviate/license</li>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/bf1739eb569f81ccabb4d1edf1987a99b2cbe3fe"><code>bf1739e</code></a>
Increase default embedded version</li>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/e332f4182811b8a2fa84d0cd65791006d2c457d8"><code>e332f41</code></a>
Add explicit license file</li>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/e442a17e6e9d7d18b00591557e1f53e92d6aea39"><code>e442a17</code></a>
Merge pull request <a
href="https://redirect.github.com/weaviate/weaviate-python-client/issues/328">#328</a>
from weaviate/fix_errors_grpc</li>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/449007f3bedc0a025cd2c82c20d0e41ff1afc271"><code>449007f</code></a>
Merge pull request <a
href="https://redirect.github.com/weaviate/weaviate-python-client/issues/340">#340</a>
from weaviate/update-docs-wording</li>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/c0f51b5f88afa763c00521a9cf7aaa6b97e89d81"><code>c0f51b5</code></a>
Fix test</li>
<li><a
href="https://github.com/weaviate/weaviate-python-client/commit/4a64ccd3cfe929d3868b1e3edf9cdeca875d77fe"><code>4a64ccd</code></a>
Merge pull request <a
href="https://redirect.github.com/weaviate/weaviate-python-client/issues/353">#353</a>
from weaviate/increase_requests</li>
<li>Additional commits viewable in <a
href="https://github.com/weaviate/weaviate-python-client/compare/v3.19.2...v3.20.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=weaviate-client&package-manager=pip&previous-version=3.19.2&new-version=3.20.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 18:48:53 -07:00
dependabot[bot] 31e8091469 Bump ruff from 0.0.257 to 0.0.272 in /python (#1434)
Bumps [ruff](https://github.com/charliermarsh/ruff) from 0.0.257 to 0.0.272.

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-13 01:15:45 +00:00
Robin-Manuel Thiel 3dce34ca3f Consistent Defaults in Python Notebooks (#1411)
### Description
Consistently use `useAzureOpenAI = False` in Python Notebooks. I
stumbled over this. Default was always false.
2023-06-13 01:13:06 +00:00
dependabot[bot] 31e8f08fa4 Bump PdfPig from 0.1.8-alpha-20230529-6daa2 to 0.1.8 in /dotnet (#1431)
Bumps [PdfPig](https://github.com/UglyToad/PdfPig) from 0.1.8-alpha-20230529-6daa2 to 0.1.8.

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 18:07:02 -07:00
dependabot[bot] d30146ab39 Bump Microsoft.Identity.Web from 2.11.0 to 2.11.1 in /dotnet (#1430)
Bumps [Microsoft.Identity.Web](https://github.com/AzureAD/microsoft-identity-web) from 2.11.0 to 2.11.1.

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 17:58:36 -07:00
dependabot[bot] 01306c59d3 Bump torch from 2.0.0 to 2.0.1 in /python (#1432)
Bumps [torch](https://github.com/pytorch/pytorch) from 2.0.0 to 2.0.1.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 17:46:54 -07:00
dependabot[bot] 63b29f7389 Bump Microsoft.NET.Test.Sdk from 17.6.1 to 17.6.2 in /dotnet (#1429)
Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.6.1 to 17.6.2.

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 17:41:33 -07:00
dependabot[bot] fb4fa7eabe Bump transformers from 4.18.0 to 4.30.0 in /samples/apps/hugging-face-http-server (#1437)
Bumps [transformers](https://github.com/huggingface/transformers) from 4.18.0 to 4.30.0.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-06-12 17:35:24 -07:00
dependabot[bot]andShawn Callegari 2c365815f2 Bump transformers from 4.29.2 to 4.30.1 in /python (#1433)
Bumps [transformers](https://github.com/huggingface/transformers) from 4.29.2 to 4.30.1.

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Shawn Callegari <[email protected]>
2023-06-12 17:21:08 -07:00
dependabot[bot] 87ed8c6a83 Bump ipykernel from 6.23.1 to 6.23.2 in /python (#1435)
Bumps [ipykernel](https://github.com/ipython/ipykernel) from 6.23.1 to 6.23.2.
2023-06-12 16:53:02 -07:00
Shawn Callegari 34e94c1e2f Update dependabot.yml 2023-06-12 14:31:26 -07:00
Robin-Manuel Thiel eafe8c7625 Print Chat History at the end of Notebooks (#1412)
### Motivation and Context
When working through the notebooks, I had the feeling that printing the
chat history at the end, makes it much clearer how it actually looks
like after a bunch of chats. I would like to see this added for
everyone.


### Description
Printing the chat history in the Notebooks at the end of the _Planner_
section
2023-06-12 20:06:15 +00:00
SergeyMenshykh b703b514f3 OpenAPIDocumentParser class clean-up. (#1390)
### Description and Motivation 
The OpenAPIDocumentParser class has been updated to make it
kernel-agnostic and enable easy reuse in other components where the
conversion functionality may not be needed or may be different.

**Disclaimer**: The conversion logic has not been changed, and the
purpose of this pull request is solely to relocate the conversion logic
from the parser class and not to enhance the logic itself.
2023-06-12 12:45:21 -07:00
Teresa Hoang f175d03580 Enabling Plan Edits in Copilot (#1386)
### Motivation and Context
This PR enables user to edit a plan before approving or rejecting it:
- User can edit any of the input value fields
- User can delete step(s) (If SequentialPlanner is enabled). Deletion is
disabled when there is only one step.

When plan is returned to the Kernel, the chat message will be updated in
the history repository to reflect the new plan state.

### Description
This PR also contains optimizations for methods handling user actions on
proposed plan and plan schema changes to enable the above.

Chat History will also now reflect any actions the user took on the
plan.

Input Edit Mode:
<img width="665" alt="image"
src="https://github.com/microsoft/semantic-kernel/assets/125500434/31b7a5b5-9ca0-432a-bde1-3141e0e8e76f">

Editing Action Plan (inputs only):

![UserPlanEdits](https://github.com/microsoft/semantic-kernel/assets/125500434/66b8c022-dcaf-469f-9426-928fafac4742)

Editing SequentialPlanner (inputs and deleting step):

![SequentialPlannerEditsExample](https://github.com/microsoft/semantic-kernel/assets/125500434/0ae757b5-7767-46b0-977c-2f69dae133ba)

Added 'NoOp' Plan state, where proposedPlan becomes unactionable if app
state changes before user approves or rejects the plan. Potential
reasons for unstable state: required plug-in no longer enabled, access
permissions changed, etc.

![image](https://github.com/microsoft/semantic-kernel/assets/125500434/2af07534-4560-4e11-a8fc-4804d85a4717)


> Note: there's some hallucinations with SequentialPlanner, but planner
default is Action. SequentialPlanner stabilizations will continue in
another PR
2023-06-12 19:03:25 +00:00
Jadyn df07fc6f28 Update redis memory README.md (#1408)
### Motivation and Context
Fix #1404

### Description
Remove `using` from the code example and add some comments to
`ConnectionMultiplexer` to prevent exceptions due to some accidental
usage.
2023-06-12 17:09:57 +00:00
Devis Lucato 774254f902 New python release (#1425)
* [e4781e51] Add sample notebook to demo weaviate memory store (#1359)
* [dae1c167] Python: Added examples of using ChatCompletion models for
skill building in Jupyter Notebooks (#1242)
* [f4e92eb1] fix: Add Azure OpenAI support for
python/08-native-function-inline (#1365)
* [de746686] Fixing typos (#1377)
* [67aa7325] Python: Fix weaviate integration tests (#1422)
* [f60d7ba0] Fix functions_view.py (#1213)
* [b2e15483] Python: Multiple results per prompt (incl. streaming)
(#1316)
* [4c4670ac] Using dotenv instead of parsing keys ourselves (#1295)
* [05d9e723] Python: Sync pyproject.toml with requirements.txt (#1150)
* [6cbea85f] Python: Add additional_metadata field to MemoryRecord and
address TODOs in ChromaMemoryStore (#1323)
* [8947e684] Weaviate: Fix to be compatible with python 3.8 (#1349)
python-0.3.1.dev
2023-06-12 10:06:33 -07:00
Abby Harrison 67aa7325d8 Python: Fix weaviate integration tests (#1422)
### Motivation and Context
The addition of the field `additional metadata` to `MemoryRecord` was
not propagated to the weaviate integration tests. This PR ensures that
the fields are properly filled and aligned.


### Description
- Added an entry for `"additional info"` to the memory record test
fixtures for weaviate.
2023-06-12 09:51:15 -07:00
Lee Miller ca40feffbf Update typos config for jupyter and msbuild files (#1405)
This commit updates the .github/_typos.toml file to add some ignore
rules for jupyter and msbuild files. These rules prevent false positives
from cell id strings and package version numbers that are not actual
typos. The commit also reorganizes the file to use type-specific
sections instead of a default section.
2023-06-12 09:35:10 -07:00
markwallace-microsoft cf4d7b094b Merge remote-tracking branch 'origin/main' into experimental-java 2023-06-12 15:48:56 +01:00
Bruno BorgesandMark Wallace 165522cd46 No need to annotate primitive type with Nonnullable (#1395)
Primitive types can't be null anyways.

Co-authored-by: Mark Wallace <[email protected]>
2023-06-12 10:30:03 +01:00
Bruno BorgesandMark Wallace 825cbca6b1 Ensure the SK is built for JDK 8 release (#1394)
Co-authored-by: Mark Wallace <[email protected]>
2023-06-12 10:15:28 +01:00
Bruno Borges 9e404466a3 Delete unused project OpenAI Client from the Java folder (#1392)
This is a follow up on the PR #1197
2023-06-12 10:07:17 +01:00
ShukriandDan Dascalescu e4781e51d4 Add sample notebook to demo weaviate memory store (#1359)
### Motivation and Context
  1. Why is this change required?
      To show users how to use the WeaviateMemoryStore memory store
  2. What problem does it solve?
Users don't know how to config and use the WeaviateMemoryStore memory
store
  3. What scenario does it contribute to?
Users want to learn how to config and use the WeaviateMemoryStore memory
store
  4. If it fixes an open issue, please link to the issue here.
      NA

### Description
Add a notebook to show users how to config and use the
WeaviateMemoryStore memory store in a few examples.
---------

Co-authored-by: Dan Dascalescu <[email protected]>
2023-06-10 04:10:39 +00:00
f60d7ba0d7 Fix functions_view.py (#1213)
### Motivation and Context
#1212 

### Description
Fixed a bug in the process of checking native function.


---------

Co-authored-by: Abby Harrison <[email protected]>
Co-authored-by: Devis Lucato <[email protected]>
dotnet-0.15.230609.2-preview
2023-06-09 14:21:34 -07:00
Abby Harrison b2e1548379 Python: Multiple results per prompt (incl. streaming) (#1316)
### Motivation and Context
To take advantage of APIs offered by most LLMs and to be in sync with
.NET SK, this PR introduces the ability to generate multiple text
completions or chat completions from a single prompt.


![MultiChatCompletionStreamMulti](https://github.com/microsoft/semantic-kernel/assets/54643756/7bec03ec-0be2-40b0-b938-6ff71beac209)


### Description
- Return type hint for `complete_async` and `complete_chat_async`
changed from `str -> Union[str, List[str]]`. The use of `Union` is the
proper way to indicate multiple return types prior to Python 3.10+. 3.10
supports the use of the `|` symbol, but since the Python SK is supported
on 3.8 and 3.9, I did not adopt the newer standard.
- `complete_async`, `complete_stream_async`, `complete_chat_async`, and
`complete_chat_stream_async` now support settings field
`number_of_responses` greater than 1. Previously only a value of 1 was
supported.
- **Note: hf_text_completion does not support streaming multiple
responses due to a limitation of TextIteratorStreamer. This feature
requires the ability to parse distinct responses from
TextIteratorStreamer.**
- Fixed a bug where `complete_async` was streaming single responses as
1D arrays, content now is simply a string.

### Example Usage
#### Setup
```
    kernel = sk.Kernel()

    # 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")
  
    # Configure Prompt
    prompt = "what is the purpose of a rubber duck?"

    # Configure Request Settings
    text_request_settings_multi = CompleteRequestSettings(
        max_tokens=100,
        temperature=0.7,
        top_p=1,
        frequency_penalty=0.5,
        presence_penalty=0.8,
        number_of_responses=4
    )

    chat_request_settings_multi = ChatRequestSettings(
        max_tokens=100,
        temperature=0.7,
        top_p=1,
        frequency_penalty=0.5,
        presence_penalty=0.8,
        number_of_responses=4
    )
```

#### Text Completion (Standard)
```
    texts = await oai_text_service.complete_async(prompt, text_request_settings_multi)
    i = 0
    for text in texts:
        print("Option " + str(i) + ": " + text)
        i += 1
```

#### Streaming Text Completion
```
    multi_stream = oai_text_service.complete_stream_async(prompt, text_request_settings_multi)
    texts = [''] * text_request_settings_multi.number_of_responses
    async for text in multi_stream:
        i = 0
        os.system('cls' if os.name == 'nt' else 'clear') # clear the screen for a better experience
        print("PROMPT: " + prompt)
        for option in text:
            texts[i] = texts[i] + option
            print("{0}: {1}".format(i, texts[i]))
            i += 1
```

#### Chat Completion (Standard)
```
    texts = await oai_chat_service.complete_chat_async([("user",prompt)], chat_request_settings_multi)
    i = 0
    for text in texts:
        print("Option " + str(i) + ": " + text)
        i += 1
```

#### Streaming Chat Completion
```
    multi_stream = oai_chat_service.complete_chat_stream_async([("user",prompt)], chat_request_settings_multi)
    texts = [''] * chat_request_settings_multi.number_of_responses
    async for text in multi_stream:
        i = 0
        os.system('cls' if os.name == 'nt' else 'clear') # clear the screen for a better experience
        print("PROMPT: " + prompt)
        for option in text:
            texts[i] = texts[i] + option
            print("{0}: {1}".format(i, texts[i]))
            i += 1
```

#### HuggingFace Standard Completion
```
    texts = await hf_text_service.complete_async(prompt, request_settings_multi)
    i = 0
    for text in texts:
        print("-----------------------------------")
        print("Option " + str(i) + ": " + text)
        i += 1
```
2023-06-09 14:13:45 -07:00
Alex Chao dae1c16786 Python: Added examples of using ChatCompletion models for skill building in Jupyter Notebooks (#1242)
### Motivation and Context
Many people run into the issue of wanting to use ChatCompletion models
like gpt-35-turbo or gpt4 for building Semantic Skills but aren't aware
that they need to update the API to do so. This adds some examples in
the Jupyter notebooks to illustrate the concept.
2023-06-09 14:10:35 -07:00
Paul Koch 9ac958d556 fix text to reflect JSON nature of the output (#1333)
### Motivation and Context
Minor fix to the notebook text to fix discrepancy between XML and JSON.

### Description
It's just a small inconsistency that I noticed in the notebooks.
Presumably the notebook used to output XML plans, but the notebook now
outputs JSON plans, so the text should be updated to reflect that.
2023-06-09 20:43:50 +00:00
Tao Chen 5c9903439d Copilot Chat: Scenario Tests (#1376)
### Motivation and Context
We need a pipeline and tests to gate PRs coming into Copilot Chat.

### Description
1. Add a simple end to end test that simulates log in and sending a
message to the bot. Will add more tests in the future.
2. Add a new GitHub action that will run against PRs that modify the
Copilot sample app.
3. Fix a bug where the BackendProbe component doesn't automatically
retry.

Note: need to add a couple new GitHub secrets for the action to pass.
2023-06-09 20:14:31 +00:00
Desmond Howard 073cd02111 CopilotChat: Show uploaded documents in chat history (#1372)
### Motivation and Context
Now when uploading a file in the chat a card will be shown indicating a
success rather than the alert banner at the top.

### Description
- adds `type` to the `ChatMessage` model
- updates `ChatHistory` to render the new `ChatHistoryFileItem` or the
existing `ChatHistoryItem` based on the `type` of the message
- updates `ChatSkill` to not generate a bot response if the message
`type` is `ChatMessageType.Document`

### Preview

![gif](https://github.com/microsoft/semantic-kernel/assets/52973358/4cff7e57-7aa5-44bd-8864-80950a24a455)
2023-06-09 20:11:55 +00:00
SergeyMenshykh f7d42450d7 Http consistency: Qdrant (#1385)
### Description
This PR brings the following changes:

- The Qdrant-related classes, namely QdrantMemoryStore and
QdrantVectorDbClient, have extended support for various creation methods
based on Qdrant endpoint, HttpClient, or both.

- The KernelBuilder class has new extension methods called
"WithQdrantMemoryStore" that simplify the registration of the Qdrant
memory store. These methods align the registration process with other
connector registrations, enforce the use of a HttpClient with the
preconfigured retry handler, and allow the hosting application to
provide a custom HttpClient if needed.

- Minor bug fix.
2023-06-09 16:20:16 +00:00
JadynandDmytro Struk 5078c2f719 Redis connector for Semantic Memory (#1178)
### Motivation and Context
Redis supports cosine similarity search by the
[RediSearch](https://redis.io/docs/stack/search) module.

### Description
Add a new Semantic Memory Connector leveraging Redis with RediSearch
module. Update the syntax example to demonstrate how it is used.

Co-authored-by: Dmytro Struk <[email protected]>
2023-06-09 16:15:05 +00:00
471ec9c19a Add Azure Dall-E (#1209)
### Motivation and Context

Implement Azure OpenAI Dall E

### Description
Implement Azure OpenAI Image Generation according to the official
[documentation](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#image-generation)
and the examples provided by Azure OpenAI Studio, so that it can be used
in SK.

Due to the differences between the API of Azure OpenAI Dall-E and OpenAI
Dall-E, some modifications have been made to OpenAIClientBase under
CustomClient to ensure compatibility.

Co-authored-by: Lee Miller <[email protected]>
Co-authored-by: Shawn Callegari <[email protected]>
Co-authored-by: Dmytro Struk <[email protected]>
2023-06-09 15:10:28 +00:00
Lee Miller fa3eb272c0 Fix input handling and context passing in planners (#1380)
### Motivation and Context
This pull request fixes a bug in the sequential planner example and
improves the custom planner example by adding input reset and context
update steps. These changes ensure that the input and context are
consistent and up-to-date for each step of the plan execution.

### Description
- In the sequential planner example, add an input reset step after each
plan step execution. This prevents the input from accumulating and
interfering with the subsequent steps.
- In the custom planner example, update the context variables with the
input before invoking the plan. This ensures that the context query
skill can access the input as a variable and perform the appropriate
queries.
2023-06-09 14:42:36 +00:00
Lee Miller faeccf5f1e Add option to ignore identifiers by regex in typos.toml (#1383)
This commit adds a new option to the default section of the typos.toml
file, which allows users to specify a list of regular expressions that
match identifiers that should be ignored by the typos checker. This can
be useful for cases where some identifiers are intentionally spelled in
a non-standard way, or contain abbreviations or acronyms that are not
recognized by the dictionary.

One example of such a case is the Azure Graph Service, which uses the
abbreviation "ags" in some of its identifiers. To avoid false positives
from the typos checker, we can add "ags" to the extend-identifiers
section of the typos.toml file. However, this would also ignore any
other occurrences of "ags" in the codebase, which may not be desirable.

To address this issue, we can use the extend-ignore-identifiers-re
option to specify a regular expression that matches only the "ags"
identifiers that are part of the Azure Graph Service API, such as
"2021-03-01_ags". This way, we can fine-tune the typos checker to ignore
only the identifiers that we want, and still catch any other potential
spelling errors.
2023-06-09 14:27:14 +00:00
markwallace-microsoft 91e093757d Merge remote-tracking branch 'origin/main' into experimental-java 2023-06-09 10:16:36 +01:00
70d49fe36b Make use of OpenAI SDK directly (#1197)
This PR removes the Azure Open AI Client wrapper originally created as a
workaround.

---------

Co-authored-by: Luigi Montoya <[email protected]>
Co-authored-by: joe-braley <[email protected]>
Co-authored-by: Luigi96 <[email protected]>
Co-authored-by: Mark Wallace <[email protected]>
Co-authored-by: John Oliver <[email protected]>
Co-authored-by: David Grieve <[email protected]>
2023-06-09 10:13:05 +01:00
Matt Mazzola f4e92eb1de fix: Add Azure OpenAI support for python/08-native-function-inline (#1365)
### Motivation and Context

Other Semantic Kernal samples allow using both OpenAI and Azure OpenAI
by setting a different set of environment variables and toggling the
`useAzureOpenAI` bool value

### Description

Add the same snippet used in other notebooks such as
`02-running-prompts-from-file` to use Azure OpenAI to the
`08-native-function-inline`
2023-06-09 00:13:52 +00:00