{"id":22161137,"url":"https://github.com/mr-destructive/hugging-chat-go","last_synced_at":"2025-03-24T15:24:19.005Z","repository":{"id":166759183,"uuid":"641975915","full_name":"Mr-Destructive/hugging-chat-go","owner":"Mr-Destructive","description":null,"archived":false,"fork":false,"pushed_at":"2023-07-03T14:39:46.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T20:37:20.683Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Mr-Destructive.png","metadata":{"files":{"readme":"README.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-05-17T14:51:21.000Z","updated_at":"2023-05-17T14:51:44.000Z","dependencies_parsed_at":"2025-01-29T20:31:34.022Z","dependency_job_id":"d86dfcaf-9170-46c8-8f6d-ec5b0fd3b6ff","html_url":"https://github.com/Mr-Destructive/hugging-chat-go","commit_stats":null,"previous_names":["mr-destructive/hugging-chat-go"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-Destructive%2Fhugging-chat-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-Destructive%2Fhugging-chat-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-Destructive%2Fhugging-chat-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-Destructive%2Fhugging-chat-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mr-Destructive","download_url":"https://codeload.github.com/Mr-Destructive/hugging-chat-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245295607,"owners_count":20592070,"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":[],"created_at":"2024-12-02T04:13:20.409Z","updated_at":"2025-03-24T15:24:18.984Z","avatar_url":"https://github.com/Mr-Destructive.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hugging Face Chatbot Example\n\nThis is a basic example of using the HuggingFace Chat Client in Go.\n\n## Installation\n\n```\ngo get github.com/mr-destructive/hugging-chat-go\n```\n\n##  Usage\n\nAdd a `.env` file with the credentials of the hugchat application.\n\n```\nemail=abc@def.com\npassword=superSecret\n```\n\nUse the `hugchat.NewChatBot(email, password)` method to instantiate the chat bot object by authenticating the sesssion. Further with that object, request the api with the `Chat` method by fine tuning the parameters provided in the below example:\n\n\n```go\npackage main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/mr-destructive/hugging-chat-go/hugchat\"\n)\n\nfunc main() {\n\n    err := hugchat.LoadEnvFromFile(\".env\")\n\t//cookies_map := map[string]string{\"hf-chat\": os.Getenv(\"hf-chat\")}\n\temail := os.Getenv(\"email\")\n\tpassword := os.Getenv(\"password\")\n\tvar inp string\n\treader := bufio.NewReader(os.Stdin)\n\tfmt.Println(\"Enter the prompt:\")\n\tinp, _ = reader.ReadString('\\n')\n\tbot, err := hugchat.NewChatBot(email, password)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\ttext := inp\n\ttemperature := 0.9\n\ttopP := 0.95\n\trepetitionPenalty := 1.2\n\ttopK := 50\n\ttruncate := 1024\n\twatermark := false\n\tmaxNewTokens := 1024\n\tstop := []string{\"\u003c/s\u003e\"}\n\treturnFullText := false\n\tstream := true\n\tuseCache := false\n\tisRetry := false\n\tretryCount := 5\n\n\tresponse, err := bot.Chat(text, temperature, topP, repetitionPenalty, topK, truncate, watermark, maxNewTokens, stop, returnFullText, stream, useCache, isRetry, retryCount)\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %v\\n\", err)\n\t\treturn\n\t}\n\tfmt.Println(response)\n}\n```\n\nOR \n\n```go\npackage main\n\nimport (\n\t\"bufio\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/mr-destructive/hugging-chat-go/hugchat\"\n)\n\nfunc main() {\n\n    err := hugchat.LoadEnvFromFile(\".env\")\n\n\temail := os.Getenv(\"email\")\n\tpassword := os.Getenv(\"password\")\n    text = \"What is universe?\"\n\n\tbot, err := hugchat.NewChatBot(email, password)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\tresponse, err := bot.ChatPrompt(text)\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %v\\n\", err)\n\t\treturn\n\t}\n\tfmt.Println(response)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-destructive%2Fhugging-chat-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmr-destructive%2Fhugging-chat-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-destructive%2Fhugging-chat-go/lists"}