{"id":15160121,"url":"https://github.com/johnmai-dev/TypeChat-Go","last_synced_at":"2025-03-08T12:34:39.111Z","repository":{"id":186383739,"uuid":"674099287","full_name":"johnmai-dev/TypeChat-Go","owner":"johnmai-dev","description":"🤖 This is the Go language implementation of microsoft/TypeChat. ","archived":false,"fork":false,"pushed_at":"2023-08-09T11:37:56.000Z","size":710,"stargazers_count":36,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T12:02:29.850Z","etag":null,"topics":["ai","chatgpt","go","golang","golang-library","golang-package","langchain","llm","microsoft","natural-language","typechat","types"],"latest_commit_sha":null,"homepage":"","language":"Go","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/johnmai-dev.png","metadata":{"files":{"readme":"README-zh_CN.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-08-03T06:24:42.000Z","updated_at":"2024-12-11T03:22:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"1da08ef0-bd13-49b4-8cb5-3556b215829c","html_url":"https://github.com/johnmai-dev/TypeChat-Go","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"4d6432bcda926ad71caaf9e8fa41d9c123f40185"},"previous_names":["maiqingqiang/typechat-go","johnmai-dev/typechat-go"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnmai-dev%2FTypeChat-Go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnmai-dev%2FTypeChat-Go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnmai-dev%2FTypeChat-Go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johnmai-dev%2FTypeChat-Go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johnmai-dev","download_url":"https://codeload.github.com/johnmai-dev/TypeChat-Go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242552823,"owners_count":20148252,"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","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":["ai","chatgpt","go","golang","golang-library","golang-package","langchain","llm","microsoft","natural-language","typechat","types"],"created_at":"2024-09-26T22:21:49.921Z","updated_at":"2025-03-08T12:34:38.796Z","avatar_url":"https://github.com/johnmai-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[English](./README.md) | 简体中文\n\n\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\n\u003c!-- PROJECT SHIELDS --\u003e\n\n[![go report card][go-report-card]][go-report-card-url]\n[![Go.Dev reference][go.dev-reference]][go.dev-reference-url]\n[![Go package][go-pacakge]][go-pacakge-url]\n[![MIT License][license-shield]][license-url]\n[![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n\n# TypeChat-Go\n\n这是 [microsoft/TypeChat](https://github.com/microsoft/TypeChat) 的 Go 语言实现。\n\nTypeChat-Go 是一个库，它通过 Schema 的方式实现 Prompt，以替代自然语言方式。\n\n⭐️ 点个star支持我们的工作吧！\n\n# 入门指南\n\n安装 TypeChat-Go:\n\n```bash \ngo get github.com/maiqingqiang/typechat-go\n```\n\n配置环境变量\n\n目前，示例可以使用 OpenAI 或 Azure OpenAI。\n要使用 OpenAI，请使用以下环境变量：\n\n| 环境变量                  | 值                                                                        |\n|-----------------------|--------------------------------------------------------------------------|\n| `OPENAI_MODEL`        | OpenAI 模型名称（例如 gpt-3.5-turbo 或 gpt-4）                                    |\n| `OPENAI_API_KEY`      | 你的 OpenAI 密钥                                                             |\n| `OPENAI_ENDPOINT`     | OpenAI API 节点 - *可选*,  默认 `\"https://api.openai.com/v1/chat/completions\"` |\n| `OPENAI_ORGANIZATION` | OpenAI Organization - *可选*, 默认 `\"\"`                                      |\n\n要使用 Azure OpenAI，请使用以下环境变量：\n\n| 环境变量                    | 值                                                                                                                                                                  |\n|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `AZURE_OPENAI_ENDPOINT` | Azure OpenAI REST API 的完整 URL (e.g. `https://YOUR_RESOURCE_NAME.openai.azure.com/openai/deployments/YOUR_DEPLOYMENT_NAME/chat/completions?api-version=2023-05-15`) |\n| `AZURE_OPENAI_API_KEY`  | 你的 Azure OpenAI 密钥                                                                                                                                                 |\n\n# 示例\n\n要了解 TypeChat-Go 的实际效果，请查看此[examples](./examples)目录中的示例。\n\n每个示例展示了 TypeChat-Go 如何处理自然语言输入，并将其映射为经过验证的 JSON 输出。大多数示例输入都适用于 GPT 3.5 和 GPT 4。\n\n| 示例名称                                                                             | 描述                                                                                                            |\n|----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|\n| [情感分析](https://github.com/maiqingqiang/TypeChat-Go/tree/main/examples/sentiment) | 一种情感分类器，将用户输入分类为负面、中性或积极。这是 TypeChat-Go 的 \"hello world!\"                                                      |\n| [咖啡店](https://github.com/maiqingqiang/TypeChat-Go/tree/main/examples/coffeeShop) | TODO                                                                                                          |\n| [日历](https://github.com/maiqingqiang/TypeChat-Go/tree/main/examples/calendar)    | 智能调度程序。此示例将用户意图转化为一系列的操作来修改日历。                                                                                |\n| [餐厅](https://github.com/maiqingqiang/TypeChat-Go/tree/main/examples/restaurant)  | 一个用于在餐厅接受订单的智能代理。类似于咖啡店示例，但使用了更复杂的架构来建模更复杂的语言输入。散文文件说明了在处理复合句、干扰和更正时，简单和高级语言模型之间的界限。此示例还展示了如何使用 Go 定义来描述用户意图。 |\n| [数学计算](https://github.com/maiqingqiang/TypeChat-Go/tree/main/examples/math)      | 将计算转化为可以执行四个基本数学运算符的 API 给定的简单程序。此示例突显了 TypeChat-Go 的程序生成能力。                                                  |\n| [音乐](https://github.com/maiqingqiang/TypeChat-Go/tree/main/examples/music)       | TODO                                                                                                          |\n\n## 运行示例\n\n运行其中一个示例，可以在其目录下运行 `go run . \u003cinput-file-path\u003e`。\nF例如，在 [math](./examples/math) 目录中，你可以运行：\n\n```\ngo run . /input.txt\n```\n\n![run.png](./examples/math/run.png)\n\n\u003c!-- MARKDOWN LINKS \u0026 IMAGES --\u003e\n\n[contributors-shield]: https://img.shields.io/github/contributors/maiqingqiang/TypeChat-Go.svg\n[contributors-url]: https://github.com/maiqingqiang/TypeChat-Go/graphs/contributors\n[forks-shield]: https://img.shields.io/github/forks/maiqingqiang/TypeChat-Go.svg\n[forks-url]: https://github.com/maiqingqiang/TypeChat-Go/network/members\n[stars-shield]: https://img.shields.io/github/stars/maiqingqiang/TypeChat-Go.svg\n[stars-url]: https://github.com/maiqingqiang/TypeChat-Go/stargazers\n[issues-shield]: https://img.shields.io/github/issues/maiqingqiang/TypeChat-Go.svg\n[issues-url]: https://github.com/maiqingqiang/TypeChat-Go/issues\n[license-shield]: https://img.shields.io/github/license/maiqingqiang/TypeChat-Go.svg\n[license-url]: https://github.com/maiqingqiang/TypeChat-Go/blob/main/LICENSE\n[go-report-card]: https://goreportcard.com/badge/github.com/maiqingqiang/typechat-go\n[go-report-card-url]: https://goreportcard.com/report/github.com/maiqingqiang/typechat-go\n[go.dev-reference]: https://img.shields.io/badge/go.dev-reference-blue?logo=go\u0026logoColor=white\n[go.dev-reference-url]: https://pkg.go.dev/github.com/maiqingqiang/typechat-go?tab=doc\n[go-pacakge]: https://github.com/maiqingqiang/TypeChat-Go/actions/workflows/test.yml/badge.svg?branch=main\n[go-pacakge-url]: https://github.com/maiqingqiang/TypeChat-Go/actions/workflows/test.yml","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnmai-dev%2FTypeChat-Go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnmai-dev%2FTypeChat-Go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnmai-dev%2FTypeChat-Go/lists"}