LlamaIndex Llms Integration: Palm
Installation
To install the required packages, run:
%pip install llama-index-llms-palm
!pip install llama-index
!pip install -q google-generativeai
Note: If you're using Colab, the above commands will install the necessary packages. If you see a notice about updating
pip, you can do so with:pip install --upgrade pip
Setup
Import Libraries and Configure API Key
Import the necessary libraries and configure your PaLM API key:
import pprint
import google.generativeai as palm
palm_api_key = "" # Add your API key here
palm.configure(api_key=palm_api_key)
Define the Model
List and select the available models that support text generation:
models = [
m
for m in palm.list_models()
if "generateText" in m.supported_generation_methods
]
model = models[0].name
print(model)
You should see output similar to:
models/text-bison-001
Using the PaLM LLM Abstraction
Now you can use the PaLM model to generate text. Here’s how to complete a prompt:
from llama_index.llms.palm import PaLM
model = PaLM(api_key=palm_api_key)
# Example prompt
prompt = "Once upon a time in a faraway land, there lived a"
response = model.complete(prompt)
print(response)
LLM Implementation example
Metadata
Release files for llama-index-llms-palm 0.5.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llama_index_llms_palm-0.5.0.tar.gz | 5.1 kB | Without provenance | Details for llama_index_llms_palm-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llama_index_llms_palm-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for llama_index_llms_palm-0.5.0-py3-none-any.whl |
Total release size: 9.8 kB
Release files / llama_index_llms_palm-0.5.0.tar.gz
| Download URL | llama_index_llms_palm-0.5.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
05c89ae9f6b0338f2d310e108e5a285fe58e966b343fa7349a47812dc1f95ef8
|
|
BLAKE2b-256 checksum How to use checksums |
f867e1fa86ae0b1fee7a2964eaa4d01601eccbd41ae2d8a450359bc7d07810da
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / llama_index_llms_palm-0.5.0-py3-none-any.whl
| Download URL | llama_index_llms_palm-0.5.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83e2a33281df37be3bd1d610a2a903e37ef70ea6549508699300b758531ece46
|
|
BLAKE2b-256 checksum How to use checksums |
629bdbe89bc88b66ff12032b47da5c3aa2381963045e0153da6e7c44b580e1e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for llama-index-llms-palm 0.5.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.