Giter VIP home page Giter VIP logo

Comments (7)

pascalwhoop avatar pascalwhoop commented on July 29, 2024

Actually, can you help explain the relation to this framework?

https://pypi.org/project/google-cloud-aiplatform/

Given the GCP console gives me the below snippet to leverage PaLM, what is the purpose of this library (which apparently is used by the Langchain library as well)

import vertexai
from vertexai.preview.language_models import ChatModel, InputOutputTextPair

def predict_large_language_model_sample(
    project_id: str,
    model_name: str,
    temperature: float,
    max_output_tokens: int,
    top_p: float,
    top_k: int,
    location: str = "us-central1",
    ) :
    """Predict using a Large Language Model."""
    vertexai.init(project=project_id, location=location)

    chat_model = ChatModel.from_pretrained(model_name)
    parameters = {
      "temperature": temperature,
      "max_output_tokens": max_output_tokens,
      "top_p": top_p,
      "top_k": top_k,
    }

    chat = chat_model.start_chat(
      examples=[]
    )


predict_large_language_model_sample("3972195257", "chat-bison@001", 0.2, 256, 0.8, 40, "us-central1")

from generative-ai-python.

markmcd avatar markmcd commented on July 29, 2024

This is unfortunately a known issue with the underlying API. Thanks for reporting it, I'll pass it on to the API team.

The Vertex API is a different, complementary, product for Google Cloud.

from generative-ai-python.

pascalwhoop avatar pascalwhoop commented on July 29, 2024

Actually, we have early access to PaLM but are not able to make it work via API, would you mind sharing an example of how this library is supposed to be used (since langchain also builds on top of this it seems)

from generative-ai-python.

MarkDaoust avatar MarkDaoust commented on July 29, 2024

we have early access to PaLM but are not able to make it work via API

If the API is enabled for your project, and you've generated an API key, you can pass the key to palm.configure(api_key=...), or set it as the GOOGLE_API_KEY environment variable.

For examples of how to use this library see the tutorials on the site:

from generative-ai-python.

markmcd avatar markmcd commented on July 29, 2024

In addition to Mark's comment, to use application default credentials you can set it up like so:

gcloud config set account [email protected]
gcloud config set project name-of-your-cloud-project

gcloud auth application-default login --scopes="https://www.googleapis.com/auth/generative-language,https://www.googleapis.com/auth/cloud-platform"

After running the above, the client library/ies should work transparently. REST calls will need headers set:

curl -H "Authorization: Bearer $(gcloud auth application-default print-access-token)" \
     -H "X-Goog-User-Project: $(gcloud config get project)" -X GET \
     "https://generativelanguage.googleapis.com/v1beta2/models"

from generative-ai-python.

abitrolly avatar abitrolly commented on July 29, 2024

@markmcd if there a way to check which scopes are already enabled for ADc?

google.api_core.exceptions.PermissionDenied: 403 Request had insufficient authentication scopes. [reason: "ACCESS_TOKEN_SCOPE_INSUFFICIENT"
domain: "googleapis.com"
metadata {
  key: "service"
  value: "generativelanguage.googleapis.com"
}
metadata {
  key: "method"
  value: "google.ai.generativelanguage.v1beta.ModelService.ListModels"
}
]

from generative-ai-python.

abitrolly avatar abitrolly commented on July 29, 2024

I asked Google Gemini in Cloud console and it gave me some fantasies, like:

image

The problem is that command doesn't exist. Opened the issue here.

https://issuetracker.google.com/issues/335383223

Maybe there is another way to check?

from generative-ai-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.