Comments (2)
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jpalvarezl @ralph-msft @trrwilson.
from azure-sdk-for-net.
Thank you for getting in touch, @raysuelzer!
You're absolutely right that this use of attachments with Assistants v2 and the new library is missing sample coverage at the moment; I'll ensure we get a work item filed to have the changes better documented.
As a direct answer, you can extend the pattern shown in this test code by using the Attachments
property of MessageCreationOptions
.
Here's a rough adaptation of the test to demonstrate:
[Test]
public void MessageWithAttachmentWorks()
{
AssistantClient client = GetTestClient();
FileClient fileClient = GetTestClient<FileClient>(TestScenario.Files);
OpenAIFileInfo numbersFile = fileClient.UploadFile(
BinaryData.FromString("""
15
20
22
12
20
""").ToStream(),
"text/plain",
FileUploadPurpose.Assistants);
Validate(numbersFile);
Assistant assistant = client.CreateAssistant(
"gpt-4o",
new AssistantCreationOptions()
{
Tools = { new CodeInterpreterToolDefinition() },
ToolResources = new()
{
CodeInterpreter = new()
{
FileIds = [numbersFile.Id],
}
}
});
AssistantThread thread = client.CreateThread();
Validate(thread);
ThreadMessage message = client.CreateMessage(
thread.Id,
MessageRole.User,
content:
[
MessageContent.FromText("What's the standard deviation of the numbers in the attached file?"),
],
new MessageCreationOptions()
{
Attachments =
{
new MessageCreationAttachment(
numbersFile.Id,
tools: [ new CodeInterpreterToolDefinition() ]),
}
});
Validate(message);
foreach (StreamingUpdate chunk in client.CreateRunStreaming(thread.Id, assistant.Id))
{
if (chunk is MessageContentUpdate contentUpdate)
{
Console.Write(contentUpdate.Text);
}
}
}
Which yields:
It appears that the file contains a single column of numbers. To calculate the standard deviation of these numbers, we can proceed with the computation.The standard deviation of the numbers in the file is approximately \(4.43\).
from azure-sdk-for-net.
Related Issues (20)
- Constructors table needs to be completed correctly. HOT 1
- [BUG] Inconsistent types between creating virtualMachineConfig with .Protocol.Models and BatchClient.PoolOperations.CreatePool HOT 1
- [BUG] CreateReceiveLinkException (Unauthorized access) - even though RBAC on topic subscription was configured HOT 4
- [QUERY] Why were index aliases removed from Azure.Search.Documents 11.6.0? HOT 3
- [BUG] New ServiceBusMessage Body empty if BinaryData created with FromObjectAsJson method HOT 3
- Observability: uber [Se] task
- [FEATURE REQ] Custom Resource Attributes are not exported
- [FEATURE REQ] Unable to override specific field in Application Insights schema HOT 4
- Use JsonMarshal.GetRawUtf8Value instead of JsonElement.GetRawText HOT 1
- Use Utf8JsonWriter.WriteRawValue instead of JsonSerializer.Serialize HOT 1
- [BUG] ResourceManager.MachineLearning parameter validation error - MachineLearningRegistryDataVersionResource HOT 1
- [QUERY] How to ignore / drop HealthCheck request samples in Application Insights HOT 12
- [QUERY] Sampling Ratio Issue: Unexpected Number of Samples HOT 4
- [FEATURE REQ] [REST API parity] Blob list support BlobTraits.Permissions HOT 1
- [BUG] Soft deleted blobs get returned as part of Find Blobs by Tags API results. HOT 1
- ServiceBusClient.AcceptNextSessionAsync logs ServiceBusException as "exception" (not as verbose) after ServiceTimeout HOT 8
- [QUERY] Files from the Blob are downloaded with file guid instead of actual file name HOT 2
- [FEATURE REQ] Add Live Metrics support for .NET console / worker apps HOT 2
- [BUG] Azure OpenAI client fails with 401 when throttling HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-sdk-for-net.