Comments (7)
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.
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.
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.
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:
- https://developers.generativeai.google/tutorials/chat_quickstart
- https://developers.generativeai.google/tutorials/text_quickstart
- https://developers.generativeai.google/tutorials/embedding_quickstart
from generative-ai-python.
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.
@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.
I asked Google Gemini in Cloud console and it gave me some fantasies, like:
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)
- RECITATION error when transcribe audio to text HOT 2
- response_schema parameter is not followed. HOT 2
- google.api_core.exceptions.Unknown: None Stream removed
- Content has no parts HOT 2
- stop_resaon is alwasy STOP, and usage_meta is consistently empty HOT 1
- BlockedPromptException: block_reason: OTHER HOT 3
- chat_session.send_message throw exception while using proxy config: raise ConnectionError(e, request=request) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='generativelanguage.googleapis.com', port=443) HOT 2
- glm.FileData issue? with uris HOT 1
- It appears as though `helper_types` is not included in the types file in the `v0.5.4` tag, but exists in `main` HOT 2
- Problem no attribute 'GenerativeModel' HOT 5
- [Bugs] protobuf bugs when importing generativeai module. HOT 2
- Unclear finish_reason HOT 3
- Can’t pip install python package in NVIDIA Omniverse
- The count tokens function generates an `google.api_core.exceptions.PermissionDenied` error when using an uploaded file in the prompt using the files api HOT 2
- Allow to modify multiple request options in Python SDK (similar to JavaScript SDK) HOT 1
- langchain_google_genai._common.GoogleGenerativeAIError: Error embedding content: 504 Deadline Exceeded HOT 5
- Tuned models return no content! HOT 4
- Finish reason should be text not a number HOT 3
- Can I live stream my web cam or live video ( HLS, RTSP and RTMP) to gemini vision api? HOT 3
- The `response.text` quick accessor only works when the response contains a valid `Part`, but none was returned. Check the `candidate.safety_ratings` to see if the response was blocked. HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from generative-ai-python.