llama-index-llms-palm


Namellama-index-llms-palm JSON
Version 0.2.2 PyPI version JSON
download
home_pageNone
Summaryllama-index llms palm integration
upload_time2024-10-08 22:36:02
maintainerNone
docs_urlNone
authorYour Name
requires_python<4.0,>=3.9
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # LlamaIndex Llms Integration: Palm

## Installation

To install the required packages, run:

```bash
%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:
>
> ```bash
> pip install --upgrade pip
> ```

## Setup

### Import Libraries and Configure API Key

Import the necessary libraries and configure your PaLM API key:

```python
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:

```python
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:

```python
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/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llama-index-llms-palm",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Your Name",
    "author_email": "you@example.com",
    "download_url": "https://files.pythonhosted.org/packages/32/49/b3d71f366e3a741fd1d73c1d3bed75e47fe1c560815c39cd034df0845d21/llama_index_llms_palm-0.2.2.tar.gz",
    "platform": null,
    "description": "# LlamaIndex Llms Integration: Palm\n\n## Installation\n\nTo install the required packages, run:\n\n```bash\n%pip install llama-index-llms-palm\n!pip install llama-index\n!pip install -q google-generativeai\n```\n\n> **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:\n>\n> ```bash\n> pip install --upgrade pip\n> ```\n\n## Setup\n\n### Import Libraries and Configure API Key\n\nImport the necessary libraries and configure your PaLM API key:\n\n```python\nimport pprint\nimport google.generativeai as palm\n\npalm_api_key = \"\"  # Add your API key here\npalm.configure(api_key=palm_api_key)\n```\n\n### Define the Model\n\nList and select the available models that support text generation:\n\n```python\nmodels = [\n    m\n    for m in palm.list_models()\n    if \"generateText\" in m.supported_generation_methods\n]\n\nmodel = models[0].name\nprint(model)\n```\n\nYou should see output similar to:\n\n```\nmodels/text-bison-001\n```\n\n### Using the PaLM LLM Abstraction\n\nNow you can use the PaLM model to generate text. Here\u2019s how to complete a prompt:\n\n```python\nfrom llama_index.llms.palm import PaLM\n\nmodel = PaLM(api_key=palm_api_key)\n\n# Example prompt\nprompt = \"Once upon a time in a faraway land, there lived a\"\nresponse = model.complete(prompt)\nprint(response)\n```\n\n### LLM Implementation example\n\nhttps://docs.llamaindex.ai/en/stable/examples/llm/palm/\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "llama-index llms palm integration",
    "version": "0.2.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8a41fbfa6fb1c961ee5aee4e3ef90a4b9a6023a14cf2a101a5cc9c2cfb4d2548",
                "md5": "aae9931d0479f146860b60766bc32f93",
                "sha256": "8ec74d74647b0a43893f4db78796066c77ac947750175d68a3e33213281e698b"
            },
            "downloads": -1,
            "filename": "llama_index_llms_palm-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aae9931d0479f146860b60766bc32f93",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 3914,
            "upload_time": "2024-10-08T22:36:00",
            "upload_time_iso_8601": "2024-10-08T22:36:00.824714Z",
            "url": "https://files.pythonhosted.org/packages/8a/41/fbfa6fb1c961ee5aee4e3ef90a4b9a6023a14cf2a101a5cc9c2cfb4d2548/llama_index_llms_palm-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3249b3d71f366e3a741fd1d73c1d3bed75e47fe1c560815c39cd034df0845d21",
                "md5": "1be493ff23fce994d237759a0f1c59ac",
                "sha256": "a963102accf249e3e647b60fdd7d178306fd0fd04ff16deec4dbbe51aa0e3b2f"
            },
            "downloads": -1,
            "filename": "llama_index_llms_palm-0.2.2.tar.gz",
            "has_sig": false,
            "md5_digest": "1be493ff23fce994d237759a0f1c59ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 3544,
            "upload_time": "2024-10-08T22:36:02",
            "upload_time_iso_8601": "2024-10-08T22:36:02.712536Z",
            "url": "https://files.pythonhosted.org/packages/32/49/b3d71f366e3a741fd1d73c1d3bed75e47fe1c560815c39cd034df0845d21/llama_index_llms_palm-0.2.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-08 22:36:02",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "llama-index-llms-palm"
}
        
Elapsed time: 0.36072s