Skip to content

Commit 83509fd

Browse files
authored
Refactor OpenAI extensions into new package (Azure#47471)
1 parent ddfe185 commit 83509fd

21 files changed

+248
-149
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Release History
2+
3+
## 1.0.0-beta.1 (Unreleased)
4+
5+
### Features Added
6+
7+
### Breaking Changes
8+
9+
### Bugs Fixed
10+
11+
### Other Changes
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# AI extensions for Azure CloudMachine client library for .NET
2+
3+
TODO
4+
5+
## Getting started
6+
7+
### Install the package
8+
9+
Install the client library for .NET with [NuGet](https://www.nuget.org/ ):
10+
11+
```dotnetcli
12+
dotnet add package Azure.CloudMachine --prerelease
13+
```
14+
15+
### Prerequisites
16+
17+
> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/).
18+
19+
### Authenticate the Client
20+
21+
## Key concepts
22+
23+
TODO.
24+
25+
## Examples
26+
27+
## Troubleshooting
28+
29+
- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues).
30+
- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags.
31+
32+
## Next steps
33+
34+
## Contributing
35+
36+
For details on contributing to this repository, see the [contributing
37+
guide][cg].
38+
39+
This project welcomes contributions and suggestions. Most contributions
40+
require you to agree to a Contributor License Agreement (CLA) declaring
41+
that you have the right to, and actually do, grant us the rights to use
42+
your contribution. For details, visit <https://cla.microsoft.com>.
43+
44+
When you submit a pull request, a CLA-bot will automatically determine
45+
whether you need to provide a CLA and decorate the PR appropriately
46+
(for example, label, comment). Follow the instructions provided by the
47+
bot. You'll only need to do this action once across all repositories
48+
using our CLA.
49+
50+
This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For
51+
more information, see the [Code of Conduct FAQ][coc_faq] or contact
52+
<[email protected]> with any other questions or comments.
53+
54+
<!-- LINKS -->
55+
[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md
56+
[coc]: https://opensource.microsoft.com/codeofconduct/
57+
[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
namespace Azure.CloudMachine.OpenAI
2+
{
3+
public static partial class AzureOpenAIExtensions
4+
{
5+
public static void Add(this System.Collections.Generic.List<OpenAI.Chat.ChatMessage> messages, OpenAI.Chat.ChatCompletion completion) { }
6+
public static void Add(this System.Collections.Generic.List<OpenAI.Chat.ChatMessage> messages, System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.VectorbaseEntry> entries) { }
7+
public static string AsText(this OpenAI.Chat.ChatCompletion completion) { throw null; }
8+
public static string AsText(this OpenAI.Chat.ChatMessageContent content) { throw null; }
9+
public static string AsText(this System.ClientModel.ClientResult<OpenAI.Chat.ChatCompletion> completionResult) { throw null; }
10+
public static OpenAI.Chat.ChatClient GetOpenAIChatClient(this Azure.Core.ClientWorkspace workspace) { throw null; }
11+
public static OpenAI.Embeddings.EmbeddingClient GetOpenAIEmbeddingsClient(this Azure.Core.ClientWorkspace workspace) { throw null; }
12+
public static void Trim(this System.Collections.Generic.List<OpenAI.Chat.ChatMessage> messages) { }
13+
}
14+
public partial class ChatTools
15+
{
16+
public ChatTools(params System.Type[] tools) { }
17+
public System.Collections.Generic.IList<OpenAI.Chat.ChatTool> Definitions { get { throw null; } }
18+
public void Add(System.Reflection.MethodInfo function) { }
19+
public void Add(System.Type functions) { }
20+
public string Call(OpenAI.Chat.ChatToolCall call) { throw null; }
21+
public string Call(string name, object[] arguments) { throw null; }
22+
public System.Collections.Generic.IEnumerable<OpenAI.Chat.ToolChatMessage> CallAll(System.Collections.Generic.IEnumerable<OpenAI.Chat.ChatToolCall> toolCalls) { throw null; }
23+
public static implicit operator OpenAI.Chat.ChatCompletionOptions (Azure.CloudMachine.OpenAI.ChatTools tools) { throw null; }
24+
}
25+
public partial class EmbeddingsVectorbase
26+
{
27+
public EmbeddingsVectorbase(OpenAI.Embeddings.EmbeddingClient client, Azure.CloudMachine.OpenAI.VectorbaseStore store = null, int factChunkSize = 1000) { }
28+
public void Add(System.BinaryData data) { }
29+
public void Add(string text) { }
30+
public System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.VectorbaseEntry> Find(string text, Azure.CloudMachine.OpenAI.FindOptions options = null) { throw null; }
31+
}
32+
public partial class FindOptions
33+
{
34+
public FindOptions() { }
35+
public int MaxEntries { get { throw null; } set { } }
36+
public float Threshold { get { throw null; } set { } }
37+
}
38+
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
39+
public readonly partial struct VectorbaseEntry
40+
{
41+
private readonly object _dummy;
42+
private readonly int _dummyPrimitive;
43+
public VectorbaseEntry(System.ReadOnlyMemory<float> vector, System.BinaryData data, int? id = default(int?)) { throw null; }
44+
public System.BinaryData Data { get { throw null; } }
45+
public int? Id { get { throw null; } }
46+
public System.ReadOnlyMemory<float> Vector { get { throw null; } }
47+
}
48+
public abstract partial class VectorbaseStore
49+
{
50+
protected VectorbaseStore() { }
51+
public abstract int Add(Azure.CloudMachine.OpenAI.VectorbaseEntry entry);
52+
public abstract void Add(System.Collections.Generic.IReadOnlyList<Azure.CloudMachine.OpenAI.VectorbaseEntry> entry);
53+
public static float CosineSimilarity(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y) { throw null; }
54+
public abstract System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.VectorbaseEntry> Find(System.ReadOnlyMemory<float> vector, Azure.CloudMachine.OpenAI.FindOptions options);
55+
}
56+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
namespace Azure.CloudMachine.OpenAI
2+
{
3+
public static partial class AzureOpenAIExtensions
4+
{
5+
public static void Add(this System.Collections.Generic.List<OpenAI.Chat.ChatMessage> messages, OpenAI.Chat.ChatCompletion completion) { }
6+
public static void Add(this System.Collections.Generic.List<OpenAI.Chat.ChatMessage> messages, System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.VectorbaseEntry> entries) { }
7+
public static string AsText(this OpenAI.Chat.ChatCompletion completion) { throw null; }
8+
public static string AsText(this OpenAI.Chat.ChatMessageContent content) { throw null; }
9+
public static string AsText(this System.ClientModel.ClientResult<OpenAI.Chat.ChatCompletion> completionResult) { throw null; }
10+
public static OpenAI.Chat.ChatClient GetOpenAIChatClient(this Azure.Core.ClientWorkspace workspace) { throw null; }
11+
public static OpenAI.Embeddings.EmbeddingClient GetOpenAIEmbeddingsClient(this Azure.Core.ClientWorkspace workspace) { throw null; }
12+
public static void Trim(this System.Collections.Generic.List<OpenAI.Chat.ChatMessage> messages) { }
13+
}
14+
public partial class ChatTools
15+
{
16+
public ChatTools(params System.Type[] tools) { }
17+
public System.Collections.Generic.IList<OpenAI.Chat.ChatTool> Definitions { get { throw null; } }
18+
public void Add(System.Reflection.MethodInfo function) { }
19+
public void Add(System.Type functions) { }
20+
public string Call(OpenAI.Chat.ChatToolCall call) { throw null; }
21+
public string Call(string name, object[] arguments) { throw null; }
22+
public System.Collections.Generic.IEnumerable<OpenAI.Chat.ToolChatMessage> CallAll(System.Collections.Generic.IEnumerable<OpenAI.Chat.ChatToolCall> toolCalls) { throw null; }
23+
public static implicit operator OpenAI.Chat.ChatCompletionOptions (Azure.CloudMachine.OpenAI.ChatTools tools) { throw null; }
24+
}
25+
public partial class EmbeddingsVectorbase
26+
{
27+
public EmbeddingsVectorbase(OpenAI.Embeddings.EmbeddingClient client, Azure.CloudMachine.OpenAI.VectorbaseStore store = null, int factChunkSize = 1000) { }
28+
public void Add(System.BinaryData data) { }
29+
public void Add(string text) { }
30+
public System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.VectorbaseEntry> Find(string text, Azure.CloudMachine.OpenAI.FindOptions options = null) { throw null; }
31+
}
32+
public partial class FindOptions
33+
{
34+
public FindOptions() { }
35+
public int MaxEntries { get { throw null; } set { } }
36+
public float Threshold { get { throw null; } set { } }
37+
}
38+
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
39+
public readonly partial struct VectorbaseEntry
40+
{
41+
private readonly object _dummy;
42+
private readonly int _dummyPrimitive;
43+
public VectorbaseEntry(System.ReadOnlyMemory<float> vector, System.BinaryData data, int? id = default(int?)) { throw null; }
44+
public System.BinaryData Data { get { throw null; } }
45+
public int? Id { get { throw null; } }
46+
public System.ReadOnlyMemory<float> Vector { get { throw null; } }
47+
}
48+
public abstract partial class VectorbaseStore
49+
{
50+
protected VectorbaseStore() { }
51+
public abstract int Add(Azure.CloudMachine.OpenAI.VectorbaseEntry entry);
52+
public abstract void Add(System.Collections.Generic.IReadOnlyList<Azure.CloudMachine.OpenAI.VectorbaseEntry> entry);
53+
public static float CosineSimilarity(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y) { throw null; }
54+
public abstract System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.VectorbaseEntry> Find(System.ReadOnlyMemory<float> vector, Azure.CloudMachine.OpenAI.FindOptions options);
55+
}
56+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<Description>AI extensions for Azure.CloudMachine</Description>
5+
<Version>1.0.0-beta.1</Version>
6+
<TargetFrameworks>$(RequiredTargetFrameworks)</TargetFrameworks>
7+
<LangVersion>12</LangVersion>
8+
9+
<!-- Disable warning CS1591: Missing XML comment for publicly visible type or member -->
10+
<NoWarn>CS1591</NoWarn>
11+
<NoWarn>OPENAI001</NoWarn>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\..\Azure.CloudMachine\src\Azure.CloudMachine.csproj" />
16+
<PackageReference Include="Azure.AI.OpenAI" />
17+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" VersionOverride="8.0.0" />
18+
<PackageReference Include="Microsoft.Bcl.Numerics" />
19+
<PackageReference Include="System.Memory.Data" VersionOverride="8.0.0"/>
20+
</ItemGroup>
21+
22+
</Project>

0 commit comments

Comments
 (0)