{"id":32372095,"url":"https://github.com/devlooped/smith","last_synced_at":"2025-10-24T21:50:07.383Z","repository":{"id":296800502,"uuid":"994518444","full_name":"devlooped/smith","owner":"devlooped","description":"An opinionated meta-package for implementing agents using Microsoft.Extensions.AI","archived":false,"fork":false,"pushed_at":"2025-09-30T00:34:29.000Z","size":248,"stargazers_count":1,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-30T02:34:59.712Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devlooped.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"devlooped"}},"created_at":"2025-06-02T04:14:18.000Z","updated_at":"2025-07-16T23:32:05.000Z","dependencies_parsed_at":"2025-07-31T02:16:26.763Z","dependency_job_id":"23ec1a30-4911-4271-9966-f0bc9b825041","html_url":"https://github.com/devlooped/smith","commit_stats":null,"previous_names":["devlooped/smith"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/devlooped/smith","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlooped%2Fsmith","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlooped%2Fsmith/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlooped%2Fsmith/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlooped%2Fsmith/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlooped","download_url":"https://codeload.github.com/devlooped/smith/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlooped%2Fsmith/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280872028,"owners_count":26405606,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-24T21:50:06.488Z","updated_at":"2025-10-24T21:50:07.378Z","avatar_url":"https://github.com/devlooped.png","language":"C#","funding_links":["https://github.com/sponsors/devlooped","https://github.com/sponsors"],"categories":[],"sub_categories":[],"readme":"![Icon](assets/icon.png) Smith\n============\n\n[![Version](https://img.shields.io/nuget/vpre/Smith.svg?color=royalblue)](https://www.nuget.org/packages/Smith)\n[![Downloads](https://img.shields.io/nuget/dt/Smith.svg?color=green)](https://www.nuget.org/packages/Smith)\n[![License](https://img.shields.io/github/license/devlooped/smith.svg?color=blue)](https://github.com//devlooped/smith/blob/main/license.txt)\n[![Build](https://github.com/devlooped/smith/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/devlooped/smith/actions)\n\n\u003c!-- #content --\u003e\nRun AI-powered C# files using Microsoft.Extensions.AI and Devlooped.Extensions.AI\n\nExample leveraging [Grok](https://console.x.ai/):\n\n```csharp\n#:package Smith@0.*\n\n// Sample X.AI client usage with .NET\nvar messages = new Chat()\n{\n    { \"system\", \"You are a highly intelligent AI assistant.\" },\n    { \"user\", \"What is 101*3?\" },\n};\n\nIChatClient grok = new GrokClient(Throw.IfNullOrEmpty(Env.Get(\"XAI_API_KEY\")))\n    .GetChatClient(\"grok-3-mini\")\n    .AsIChatClient();\n\nvar options = new GrokChatOptions\n{\n    ReasoningEffort = ReasoningEffort.High, // or ReasoningEffort.Low\n    Search = GrokSearch.Auto,               // or GrokSearch.On/GrokSearch.Off\n};\n\nvar response = await grok.GetResponseAsync(messages, options);\n\nAnsiConsole.MarkupLine($\":robot: {response.Text}\");\n```\n\n\u003e [!NOTE]\n\u003e The most useful namespaces and dependencies for developing Microsoft.Extensions.AI-powered \n\u003e applications are automatically referenced and imported when using this package.\n\nExample using Claude:\n\n![](https://raw.githubusercontent.com/devlooped/smith/main/assets/run.png)\n\n```csharp\n#:package Smith@0.*\n\nvar client = new Anthropic.AnthropicClient(Throw.\n    Env.Get(\"Claude:Key\") ?? throw new InvalidOperationException(\"Missing Claude:Key configuration.\"),\n    services.GetRequiredService\u003cIHttpClientFactory\u003e().CreateClient(\"ai\")))\n    .UseLogging()\n    .UseFunctionInvocation();\n\nvar builder = App.CreateBuilder(args);\nbuilder.Services.AddChatClient(new );\n\nvar app = builder.Build();\n\nvar history = new List\u003cChatMessage\u003e { new ChatMessage(ChatRole.System, Prompts.System) };\nvar chat = app.Services.GetRequiredService\u003cIChatClient\u003e();\n\nvar options = new ChatOptions\n{\n    ModelId = \"claude-sonnet-4-20250514\",\n    MaxOutputTokens = 1000,\n    Temperature = 0.7f,\n    Tools = [AIFunctionFactory.Create(() =\u003e DateTime.Now, \"get_datetime\", \"Gets the current date and time on the user's local machine.\")]\n};\n\nAnsiConsole.MarkupLine($\":robot: Ready v{ThisAssembly.Info.Version}\");\nAnsiConsole.Markup($\":person_beard: \");\nwhile (true)\n{\n    var input = Console.ReadLine()?.Trim();\n    if (string.IsNullOrEmpty(input))\n        continue;\n\n    history.Add(new ChatMessage(ChatRole.User, input));\n\n    try\n    {\n        var response = await AnsiConsole.Status().StartAsync(\":robot: Thinking...\",\n            ctx =\u003e chat.GetResponseAsync(input, options));\n\n        history.AddRange(response.Messages);\n        // Try rendering as formatted markup\n        try\n        {\n            if (response.Text is { Length: \u003e 0 })\n                AnsiConsole.MarkupLine($\":robot: {response.Text}\");\n        }\n        catch (Exception)\n        {\n            // Fallback to escaped markup text if rendering fails\n            AnsiConsole.MarkupInterpolated($\":robot: {response.Text}\");\n        }\n\n        AnsiConsole.WriteLine();\n        AnsiConsole.Markup($\":person_beard: \");\n    }\n    catch (Exception e)\n    {\n        AnsiConsole.WriteException(e);\n    }\n}\n\nstatic class Prompts\n{\n    public const string System =\n        \"\"\"\n        Your responses will be rendered using Spectre.Console.AnsiConsole.Write(new Markup(string text))). \n        This means that you can use rich text formatting, colors, and styles in your responses, but you must \n        ensure that the text is valid markup syntax. \n        \"\"\";\n}\n```\n\n\n## Configuration / Environment Variables\n\nThe `Env` class provides access to the following variables/configuration automatically: \n\n* `.env` files: in local and parent directories\n* `~/.env` file: in the user's home directory (`%userprofile%\\.env` on Windows)\n* All default configuration sources from [App Builder](https://learn.microsoft.com/en-us/dotnet/core/extensions/generic-host?tabs=appbuilder#host-builder-settings): \n    * Environment variables prefixed with DOTNET_.\n    * Command-line arguments.\n    * appsettings.json.\n    * appsettings.{Environment}.json.\n    * Secret Manager when the app runs in the Development environment.\n    * Environment variables.\n    * Command-line arguments.\n\n\n\u003c!-- #content --\u003e\n\u003c!-- include https://github.com/devlooped/sponsors/raw/main/footer.md --\u003e\n# Sponsors \n\n\u003c!-- sponsors.md --\u003e\n[![Clarius Org](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/clarius.png \"Clarius Org\")](https://github.com/clarius)\n[![MFB Technologies, Inc.](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/MFB-Technologies-Inc.png \"MFB Technologies, Inc.\")](https://github.com/MFB-Technologies-Inc)\n[![Torutek](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/torutek-gh.png \"Torutek\")](https://github.com/torutek-gh)\n[![DRIVE.NET, Inc.](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/drivenet.png \"DRIVE.NET, Inc.\")](https://github.com/drivenet)\n[![Keith Pickford](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/Keflon.png \"Keith Pickford\")](https://github.com/Keflon)\n[![Thomas Bolon](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/tbolon.png \"Thomas Bolon\")](https://github.com/tbolon)\n[![Kori Francis](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/kfrancis.png \"Kori Francis\")](https://github.com/kfrancis)\n[![Toni Wenzel](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/twenzel.png \"Toni Wenzel\")](https://github.com/twenzel)\n[![Uno Platform](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/unoplatform.png \"Uno Platform\")](https://github.com/unoplatform)\n[![Reuben Swartz](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/rbnswartz.png \"Reuben Swartz\")](https://github.com/rbnswartz)\n[![Jacob Foshee](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/jfoshee.png \"Jacob Foshee\")](https://github.com/jfoshee)\n[![](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/Mrxx99.png \"\")](https://github.com/Mrxx99)\n[![Eric Johnson](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/eajhnsn1.png \"Eric Johnson\")](https://github.com/eajhnsn1)\n[![David JENNI](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/davidjenni.png \"David JENNI\")](https://github.com/davidjenni)\n[![Jonathan ](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/Jonathan-Hickey.png \"Jonathan \")](https://github.com/Jonathan-Hickey)\n[![Charley Wu](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/akunzai.png \"Charley Wu\")](https://github.com/akunzai)\n[![Ken Bonny](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/KenBonny.png \"Ken Bonny\")](https://github.com/KenBonny)\n[![Simon Cropp](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/SimonCropp.png \"Simon Cropp\")](https://github.com/SimonCropp)\n[![agileworks-eu](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/agileworks-eu.png \"agileworks-eu\")](https://github.com/agileworks-eu)\n[![Zheyu Shen](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/arsdragonfly.png \"Zheyu Shen\")](https://github.com/arsdragonfly)\n[![Vezel](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/vezel-dev.png \"Vezel\")](https://github.com/vezel-dev)\n[![ChilliCream](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/ChilliCream.png \"ChilliCream\")](https://github.com/ChilliCream)\n[![4OTC](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/4OTC.png \"4OTC\")](https://github.com/4OTC)\n[![Vincent Limo](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/v-limo.png \"Vincent Limo\")](https://github.com/v-limo)\n[![Jordan S. Jones](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/jordansjones.png \"Jordan S. Jones\")](https://github.com/jordansjones)\n[![domischell](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/DominicSchell.png \"domischell\")](https://github.com/DominicSchell)\n[![Justin Wendlandt](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/jwendl.png \"Justin Wendlandt\")](https://github.com/jwendl)\n[![Adrian Alonso](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/adalon.png \"Adrian Alonso\")](https://github.com/adalon)\n[![Michael Hagedorn](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/Eule02.png \"Michael Hagedorn\")](https://github.com/Eule02)\n[![Alex Rønne Petersen](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/alexrp.png \"Alex Rønne Petersen\")](https://github.com/alexrp)\n\n\n\u003c!-- sponsors.md --\u003e\n\n[![Sponsor this project](https://raw.githubusercontent.com/devlooped/sponsors/main/sponsor.png \"Sponsor this project\")](https://github.com/sponsors/devlooped)\n\u0026nbsp;\n\n[Learn more about GitHub Sponsors](https://github.com/sponsors)\n\n\u003c!-- https://github.com/devlooped/sponsors/raw/main/footer.md --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlooped%2Fsmith","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlooped%2Fsmith","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlooped%2Fsmith/lists"}