{"id":22161119,"url":"https://github.com/mr-destructive/palm","last_synced_at":"2025-10-11T18:33:10.681Z","repository":{"id":176690118,"uuid":"657622159","full_name":"Mr-Destructive/palm","owner":"Mr-Destructive","description":"PaLM API Golang Client","archived":false,"fork":false,"pushed_at":"2023-09-23T11:21:37.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-29T20:37:18.381Z","etag":null,"topics":["api-client","palm-api"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/mr-destructive/palm","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}},"created_at":"2023-06-23T13:13:19.000Z","updated_at":"2023-10-09T11:44:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"783af666-2197-4f6b-a607-8ed4ae43928f","html_url":"https://github.com/Mr-Destructive/palm","commit_stats":null,"previous_names":["mr-destructive/palm"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-Destructive%2Fpalm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-Destructive%2Fpalm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-Destructive%2Fpalm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mr-Destructive%2Fpalm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mr-Destructive","download_url":"https://codeload.github.com/Mr-Destructive/palm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245295606,"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":["api-client","palm-api"],"created_at":"2024-12-02T04:13:14.381Z","updated_at":"2025-10-11T18:33:05.631Z","avatar_url":"https://github.com/Mr-Destructive.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Palm API Go Client\n\nThis package provides a Go client for the Palm API. The PaLM API allows developers to build generative AI applications using the PaLM model.\n\n## Installation\n\nInstall the package on your system\n\n```\ngo get github.com/mr-destructive/palm\n```\n\n## Usage\n\nTo use this package, you'll need a Palm API key. You can get one from the Google Cloud Console.\n\nSet your API key in an .env file:\n\n```\nPALM_API_KEY=YOUR_KEY_HERE\n```\n\nor in the shell:\n\n```\nexport PALM_API_KEY=YOUR_KEY_HERE\n```\n\nImport the packge with the name `github.com/mr-destructive/palm` as :\n\n```go\npackage main\n\nimport (\n  \"github.com/mr-destructive/palm\"\n)\n\n```\n\n### Creating a Client\n\nCreate a client with `NewClient(string)` by passing your API key. Access the methods like `ChatPrompt(string)`, `Chat(ChatConfig)`, or `EmbedText(string)` with the client.\n\n```go\nclient := palm.NewClient(\"PALM_API_KEY\")\nclient.ChatPrompt(\"what are you?\")\n```\n\n### Models\n\nThen you can list models with `ListModels()`:\n\n```go\nmodels, err := palm.ListModels()\nif err != nil {\n    log.Fatal(err)\n}\nfmt.Println(models)\n```\n\nAnd get a single model by name with `GetModel(name)`, there are three model names as :\n\n- models/chat-bison-001\n- models/text-bison-001\n- models/embedding-gecko-001\n\n```go\nmodel, err := palm.GetModel(\"model/chat-bison-001\")\nif err != nil {\n    log.Fatal(err)\n}\nfmt.Println(model)\n```\n\n### Chat\n\nGet a quick conversation prompt with `ChatPrompt(string)` and further prompts with `Reply(string)` method\n\n```go\nchat, err := palm.ChatPrompt(\"what are you?\")\nif err != nil {\n    panic(err)\n}\nfmt.Println(chat.Last)\nchat.Reply(\"what can you do!\")\nfmt.Println(chat.Last)\n```\n\nOR fine-tune the `ChatConfig` to the `Chat` method.\n\n```go\nchatConfig := palm.ChatConfig{\n    Prompt: palm.TextPrompt{\n        Text: \"what are you?\",\n    }\n    Messages: []palm.Message{\n        palm.Message{\n            Author: \"bot\",\n            Content: \"hello world!\",\n        },\n    },\n    Model: \"string\"\n    Context: \"string\",\n    Examples: []palm.Example{\n        palm.Example{\n            Input: \"what are you?\",\n            Output: \"I am a bot\",\n        }, \n    },\n    Temperature: 0.5,\n    CandidateCount: 10,\n    TopP: 0.5,\n    TopK: 10,\n}\n\nchat, err := palm.Chat(chatConfig)\nif err != nil {\n    panic(err)\n}\nchat.Reply(\"what can you do!\")\n```\n\n### Generation\n\nUse the underlying method in the `Chat` methods to get a `ResponseMessage`.\n\n```go\nmessage := palm.MessagePrompt{\n    Messages: []palm.Message{\n        palm.Message{\n            Content: \"what is the meaning of life\",\n        },\n    },\n}\nmsgConfig := MessageConfig{\n    Prompt: message,\n}\nm, err := palm.GenerateMessage(msgConfig)\nif err != nil {\n    fmt.Println(err)\n}\nfmt.Println(m)\n\n```\n\n## Contributing\n\nContributions are welcome! Open an issue or submit a PR.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-destructive%2Fpalm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmr-destructive%2Fpalm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmr-destructive%2Fpalm/lists"}