dotnet run app.cs
. Đây là bước đột phá giúp các đại lý AI có thể viết - chạy - sửa lỗi ngay trong thời gian thực bằng các tập tin mã nhỏ gọn.Package Name | Phiên Bản |
---|---|
Azure.AI.OpenAI | Phiên bản mới nhất |
Microsoft.Extensions.AI | Phiên bản mới nhất |
Microsoft.Extensions.Logging.Console | 10.0.0-preview.5.25277.114 |
Microsoft.Extensions.AI.OpenAI | 9.5.0-preview.1.25265.7 |
dotnet run
trên file đó, bắt đầu một tiến trình mới và trả về kết quả đầu ra:var chatOptions = new ChatOptions{ Tools = [AIFunctionFactory.Create((string code) => { var logger = loggerFactory.CreateLogger("CodeExecution"); var codeFileName = @$"c:\temp\{DateTime.Now.ToString("HHmmssfff")}-{runId}.cs"; File.WriteAllText(codeFileName, code); var process = new Process { StartInfo = new ProcessStartInfo { FileName = "dotnet", Arguments = $"run {codeFileName}", RedirectStandardOutput = true } }; process.Start(); process.WaitForExit(TimeSpan.FromMinutes(1)); var output = process.StandardOutput.ReadToEnd(); logger.LogInformation("Code execution output: {Output}", output); return output; }, description: "Execute the provided code.")]};
using
statements và viết mã lệnh thẳng không cần Program
hay Main
method.Write code to answer the question. If you need to use a NuGet package, specify the package name in the code like this: #:package PackageName.
A code block should start with the required NuGet packages, if any, followed by one or more using statements, followed by the code.
You can directly write code statements without a program class with a main method.
### Example 1#:package [email protected]using System;Console.WriteLine("123".Humanize());
### Write and execute code to answer the question.Do not ask the user for any input, just complete all the steps below by writing and executing the code without asking for clarification or consent.
1. Fetch the csv file from the url 'https://raw.githubusercontent.com/fgeorges/star-wars-dataset/refs/heads/master/csv/films/films.csv'2. Analyze the content and determine the delimiter used in the csv file. Keep in mind that text columns may contain commas as well.3. Determine which columns are present in the csv file and what data the columns contain.4. Order the movies by release date, newest first.5. Write a .docx word document at 'c:\temp\star_wars_movie.docx' with one line per page with the following information: - release date - title - description
C:\Temp
theo tên kèm thời gian để phân biệt.Analysis and Results:Delimiter: The delimiter used in the CSV is a comma (,).Columns present: title, episode_id, opening_crawl, director, producer, release_date, created, edited, url, desc...File written: c:/temp/star_wars_movie.docxSummary: The document contains 7 movies, each on its own page, with release date, title and description.
.NET 10 là nền tảng đắc lực giúp hạ thấp rào cản tiếp cận và phát triển các đại lý đào tạo có khả năng viết code thực thi cực kỳ hiệu quả.