googleforgames / genai-quickstart Goto Github PK
View Code? Open in Web Editor NEWGoogle for Games Generative AI Quickstart
License: Apache License 2.0
Google for Games Generative AI Quickstart
License: Apache License 2.0
As is stands right now we don't have a way of passing the "messages" field with the chat history to the Vertex chat API.
GenAI-quickstart/genai/api/vertex_chat_api/src/main.py
Lines 86 to 97 in 24107ee
The current workaround is to pass the message history through as context.
GenAI-quickstart/examples/friendschat/src/main.py
Lines 71 to 83 in 24107ee
The most straightforward way to fix this is to add "messages" as an optional field to the Vertex Chat API module, so that the message history does not need to be sent as part of the context. This is in keeping with the Vertex Text Chat schema.
In the future the API should be updated to be endpoint agnostic, and use the OpenAI chat completion schema
What happened?
When running pytest -v
in a local virtualenv on the test_main.py
files:
pytest
because the OS environment variables are not in place.pytest
because there is no mock for Google_Cloud_GenAI
, so the test tries to connect to a real project and call a LLM in that project.expected_response
since they return a single text string response.text
and not a json object {'mocked_key': 'mocked_value'}
.What you expected to happen:
Running the unit tests should not require setting up environment variables or calls to an external service.
How to reproduce it (as minimally and precisely as possible):
For the genai_api test:
pytest
in (myvirtualenv) me@me:~/GenAI-quickstart/genai/api/genai_api/src$ pytest -v
For example on the vertex_chat_api test:
pytest
in (myvirtualenv) me@me:~/GenAI-quickstart/genai/api/vertex_chat_api/src$ pytest -v
(you'll notice this fails with warning that the 403 Vertex AI API has not been used in project
)project_id_response.text
to the name of your Google Cloud Project.
pytest
again in (myvirtualenv) me@me:~/GenAI-quickstart/genai/api/vertex_chat_api/src$ pytest -v
. Now the test fails with AssertionError: assert 'test response' == {'mocked_key': 'mocked_value'}
.Anything else we need to know?:
The value test response
is coming from the actual call to the LLM. If you run the GenAI Quickstart cluster and navigate to the http://${EXT_IP}/genai_docs (following instructions on the main readme) and enter the same payload prompt as the test "prompt": "test prompt"
, the response is test response
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.