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

updates for demo #46997

Merged
merged 7 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public readonly partial struct MessagingServices
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public void SendMessage(object serializable) { }
public void SendJson(object serializable) { }
public System.Threading.Tasks.Task SendJsonAsync(object serializable) { throw null; }
public void WhenMessageReceived(System.Action<string> received) { }
}
public partial class StorageFile
Expand All @@ -36,6 +37,7 @@ internal StorageFile() { }
public string Path { get { throw null; } }
public string RequestId { get { throw null; } }
public void Delete() { }
public System.Threading.Tasks.Task DeleteAsync() { throw null; }
public System.BinaryData Download() { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object obj) { throw null; }
Expand All @@ -50,14 +52,18 @@ public readonly partial struct StorageServices
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public void DeleteBlob(string path) { }
public System.BinaryData DownloadBlob(string path) { throw null; }
public string UploadBinaryData(System.BinaryData data, string name = null, bool overwrite = false) { throw null; }
public string UploadBytes(byte[] bytes, string name = null, bool overwrite = false) { throw null; }
public string UploadBytes(System.ReadOnlyMemory<byte> bytes, string name = null, bool overwrite = false) { throw null; }
public void Delete(string path) { }
public System.Threading.Tasks.Task DeleteAsync(string path) { throw null; }
public System.BinaryData Download(string path) { throw null; }
public System.Threading.Tasks.Task<System.BinaryData> DownloadAsync(string path) { throw null; }
public string Upload(System.BinaryData data, string name = null, bool overwrite = false) { throw null; }
public string Upload(System.IO.Stream fileStream, string name = null, string contentType = null, bool overwrite = false) { throw null; }
public System.Threading.Tasks.Task<string> UploadAsync(System.BinaryData data, string name = null, bool overwrite = false) { throw null; }
public System.Threading.Tasks.Task<string> UploadAsync(System.IO.Stream fileStream, string name = null, string contentType = null, bool overwrite = false) { throw null; }
public string UploadJson(object json, string name = null, bool overwrite = false) { throw null; }
public string UploadStream(System.IO.Stream fileStream, string name = null, bool overwrite = false) { throw null; }
public void WhenBlobUploaded(System.Action<Azure.CloudMachine.StorageFile> function) { }
public System.Threading.Tasks.Task<string> UploadJsonAsync(object json, string name = null, bool overwrite = false) { throw null; }
public void WhenUploaded(System.Action<Azure.CloudMachine.StorageFile> function) { }
public void WhenUploaded(System.Action<System.BinaryData> function) { }
}
}
namespace Azure.CloudMachine.KeyVault
Expand All @@ -71,12 +77,11 @@ namespace Azure.CloudMachine.OpenAI
{
public static partial class AzureOpenAIExtensions
{
public static void Add(this System.Collections.Generic.List<OpenAI.Chat.ChatMessage> messages, System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.VectorbaseEntry> entries) { }
public static OpenAI.Chat.ChatClient GetOpenAIChatClient(this Azure.Core.ClientWorkspace workspace) { throw null; }
public static OpenAI.Embeddings.EmbeddingClient GetOpenAIEmbeddingsClient(this Azure.Core.ClientWorkspace workspace) { throw null; }
public static void Trim(this System.Collections.Generic.List<OpenAI.Chat.ChatMessage> messages) { }
}
}
namespace Azure.CloudMachine.OpenAI.Chat
{
public partial class ChatTools
{
public ChatTools(params System.Type[] tools) { }
Expand All @@ -92,14 +97,12 @@ public void Add(System.Type functions) { }
protected virtual string GetMethodInfoToName(System.Reflection.MethodInfo function) { throw null; }
protected virtual string GetParameterInfoToDescription(System.Reflection.ParameterInfo parameter) { throw null; }
}
}
namespace Azure.CloudMachine.OpenAI.Embeddings
{
public partial class EmbeddingsVectorbase
{
public EmbeddingsVectorbase(OpenAI.Embeddings.EmbeddingClient client, Azure.CloudMachine.OpenAI.Embeddings.VectorbaseStore store = null, int factChunkSize = 0) { }
public EmbeddingsVectorbase(OpenAI.Embeddings.EmbeddingClient client, Azure.CloudMachine.OpenAI.VectorbaseStore store = null, int factChunkSize = 0) { }
public void Add(System.BinaryData data) { }
public void Add(string text) { }
public System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.Embeddings.VectorbaseEntry> Find(string text, Azure.CloudMachine.OpenAI.Embeddings.FindOptions options = null) { throw null; }
public System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.VectorbaseEntry> Find(string text, Azure.CloudMachine.OpenAI.FindOptions options = null) { throw null; }
}
public partial class FindOptions
{
Expand All @@ -120,10 +123,10 @@ public readonly partial struct VectorbaseEntry
public abstract partial class VectorbaseStore
{
protected VectorbaseStore() { }
public abstract int Add(Azure.CloudMachine.OpenAI.Embeddings.VectorbaseEntry entry);
public abstract void Add(System.Collections.Generic.IReadOnlyList<Azure.CloudMachine.OpenAI.Embeddings.VectorbaseEntry> entry);
public abstract int Add(Azure.CloudMachine.OpenAI.VectorbaseEntry entry);
public abstract void Add(System.Collections.Generic.IReadOnlyList<Azure.CloudMachine.OpenAI.VectorbaseEntry> entry);
public static float CosineSimilarity(System.ReadOnlySpan<float> x, System.ReadOnlySpan<float> y) { throw null; }
public abstract System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.Embeddings.VectorbaseEntry> Find(System.ReadOnlyMemory<float> vector, Azure.CloudMachine.OpenAI.Embeddings.FindOptions options);
public abstract System.Collections.Generic.IEnumerable<Azure.CloudMachine.OpenAI.VectorbaseEntry> Find(System.ReadOnlyMemory<float> vector, Azure.CloudMachine.OpenAI.FindOptions options);
}
}
namespace Azure.Core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<PackageReference Include="Azure.Security.KeyVault.Secrets" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" VersionOverride="8.0.0" />
<PackageReference Include="Microsoft.Bcl.Numerics" />
<PackageReference Include="System.Memory.Data" VersionOverride="8.0.0"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,24 @@ public readonly struct MessagingServices
/// Sends a message to the service bus.
/// </summary>
/// <param name="serializable"></param>
public void SendMessage(object serializable)
public void SendJson(object serializable)
{
#pragma warning disable AZC0102 // Do not use GetAwaiter().GetResult().
SendJsonAsync(serializable).GetAwaiter().GetResult();
#pragma warning restore AZC0102 // Do not use GetAwaiter().GetResult().
}

/// <summary>
/// Sends a message to the service bus.
/// </summary>
/// <param name="serializable"></param>
public async Task SendJsonAsync(object serializable)
{
ServiceBusSender sender = GetServiceBusSender();

BinaryData serialized = BinaryData.FromObjectAsJson(serializable);
ServiceBusMessage message = new(serialized);
#pragma warning disable AZC0102 // Do not use GetAwaiter().GetResult().
sender.SendMessageAsync(message).GetAwaiter().GetResult();
#pragma warning restore AZC0102 // Do not use GetAwaiter().GetResult().
await sender.SendMessageAsync(message).ConfigureAwait(false);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System;
using System.ComponentModel;
using System.Threading;
using System.Threading.Tasks;

namespace Azure.CloudMachine;

Expand Down Expand Up @@ -43,7 +44,7 @@ public class StorageFile
/// </summary>
/// <returns></returns>
public BinaryData Download()
=> _storage.DownloadBlob(Path);
=> _storage.Download(Path);

// public async Task<BinaryData> DownloadAsync()
// => await _storage.DownloadBlobAsync(Path).ConfigureAwait(false);
Expand All @@ -52,10 +53,14 @@ public BinaryData Download()
/// Deletes the file from the storage account.
/// </summary>
public void Delete()
=> _storage.DeleteBlob(Path);
=> _storage.Delete(Path);

// public async Task DeleteAsync()
// => await _storage.DeleteBlobAsync(Path).ConfigureAwait(false);
/// <summary>
/// Deletes the file from the storage account.
/// </summary>
/// <returns></returns>
public async Task DeleteAsync()
=> await _storage.DeleteAsync(Path).ConfigureAwait(false);

// public Uri ShareFolder(AccessPermissions permissions, TimeSpan expiresAfter)
// => _storage.ShareFolder(Path, permissions, expiresAfter);
Expand Down
Loading