Merged
Conversation
Member
|
Thanks for the contribution 👍 I'll take a look at the PR! |
kevinmessiaen
requested changes
Jun 12, 2024
Member
There was a problem hiding this comment.
The client is working properly however it doesn't integrate with the Giskard (scan, raget, ...).
The ChatMessage that are sent as input to the LLM client can have 3 roles (system, assistant and user).
In our case assistant should be mapped to model. For system we will need to map it to user with a custom format the that the model understand the importance of the system prompt: https://www.googlecloudcommunity.com/gc/AI-ML/Implementing-System-Prompts-in-Gemini-Pro-for-Chatbot-Creation/m-p/715501
let me know if you need help on this. You can take a look on our Bedrock client implementation.
PS: ideally this code snippet should be working:
client = GeminiClient()
response = client.complete(messages=[
ChatMessage(role='system', content='You are a "ping" service that always reply with "IT WORKS!"'),
ChatMessage(role='user', content='Hello, does it works?'),
ChatMessage(role='assistant', content='IT WORKS!'),
ChatMessage(role='user', content='What is your goal?'),
])
assert response.role == 'assistant' # model should be mapped to assistant in the response too
assert response.role == 'IT WORKS!'# Conflicts: # pdm.lock # tests/llm/test_llm_client.py
kevinmessiaen
approved these changes
Jun 24, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implement a Gemini LLMClient and test for it.
Related Issue
Implement a Gemini LLMClient #1901
Type of Change
Checklist
CODE_OF_CONDUCT.mddocument.CONTRIBUTING.mdguide.pdm.lockrunningpdm update-lock(only applicable whenpyproject.tomlhas beenmodified)