Skip to main content

llama-index llms palm integration

Project description

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

https://docs.llamaindex.ai/en/stable/examples/llm/palm/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_llms_palm-0.5.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_llms_palm-0.5.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_llms_palm-0.5.0.tar.gz.

File metadata

  • Download URL: llama_index_llms_palm-0.5.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for llama_index_llms_palm-0.5.0.tar.gz
Algorithm Hash digest
SHA256 05c89ae9f6b0338f2d310e108e5a285fe58e966b343fa7349a47812dc1f95ef8
MD5 a7f691102ce3bbc483f4165bc1d401a2
BLAKE2b-256 f867e1fa86ae0b1fee7a2964eaa4d01601eccbd41ae2d8a450359bc7d07810da

See more details on using hashes here.

File details

Details for the file llama_index_llms_palm-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_llms_palm-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for llama_index_llms_palm-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 83e2a33281df37be3bd1d610a2a903e37ef70ea6549508699300b758531ece46
MD5 c7a7131b61fd8d97ca5ce9cf3c67585d
BLAKE2b-256 629bdbe89bc88b66ff12032b47da5c3aa2381963045e0153da6e7c44b580e1e2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page