Comments (5)
@yiranwu0 this has been accidentally introduced by the last changes to the Gemini client, which were not yet released.
I have created a PR for this issue: #2906
The example from the comment above will have everything included in the input message, because the system role is mapped later to the user role, and consecutive messages with identical roles are concatenated. This way the behavior is identical to that of the latest release 🙂
Bonus question: currently, messages of identical roles are concatenated without any separator between them. Would perhaps the addition of a newline character be desired between concatenated messages to act as a separator?
from autogen.
@BeibinLi @davorrunje Can you maybe take a look?
from autogen.
Thanks @luxzoli! Yeah I think a newline character would be good for now. Is there a specific gemini document saying that there cannot be same consecutive roles?
from autogen.
Good point @yiranwu0! I will look into it then if the concatenation can be avoided, and update my PR accordingly
from autogen.
I am getting the following exception from the Google API using the Vertex AI client, when consecutive messages of the same type are not merged (I have removed some lines from the trace):
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.INVALID_ARGUMENT
details = "Please ensure that multiturn requests alternate between user and model."
debug_error_string = "UNKNOWN:Error received from peer ipv4:172.217.218.95:443 {grpc_message:"Please ensure that multiturn requests alternate between user and model.", grpc_status:3, created_time:"2024-06-10T21:03:18.368206063+00:00"}"
>
The above exception was the direct cause of the following exception:
...
google.api_core.exceptions.InvalidArgument: 400 Please ensure that multiturn requests alternate between user and model.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
...
File "/home/lux_zoltan_andras/.local/lib/python3.10/site-packages/autogen/oai/gemini.py", line 208, in create
raise RuntimeError(f"Google GenAI exception occurred while calling Gemini API: {e}")
RuntimeError: Google GenAI exception occurred while calling Gemini API: 400 Please ensure that multiturn requests alternate between user and model.
Interestingly, I was not getting this error with the google.generativeai.
For the VertexAI client this official notebook also writes that messages can be added with roles user and model alternately. I have modified the notebook to break this rule in the chat history, and got the following exception.
So maybe it is safer to keep merging consecutive messages with the same role?
However, it seems like we can avoid concatenating the actual text by adding a list of parts to the Content
object, which is what is utilized in the latest version of the PR
What do you think @yiranwu0 ?
from autogen.
Related Issues (20)
- [Issue]: How to force implementing a tool function registered for an agent? HOT 3
- [.Net][Feature Request]: Support prompt cache in claude HOT 1
- [Bug]: TypeError: unhashable type: 'ImportFromModule' for User Defined Functions
- [Issue]: Not able to import "cannot import name 'ConversableAgent' from 'autogen' (/home/lnx/Documents/Dump1/venv/lib/python3.10/site-packages/autogen/__init__.py)"
- [Bug]: Error in resuming groupchat. HOT 2
- [Feature Request]: Add ability to pass conversation history (messages) between group chats
- [Issue]: AWS Bedrock Function calling HOT 6
- [Bug]: Groq responses are dicts when strs are expected HOT 3
- [Bug]: Autogen streaming is returning only ASCII, how to switch it to broader scope of UTF-8? HOT 2
- [Bug]: 'NoneType' object is not iterable in a group_chat HOT 5
- [Feature Request]: clear the memory from some specific agents based on certain judgment conditions during groupchat
- [Bug]: LLM Configuration webpage is not linked in the Inntroduction to AutoGEN page
- "Max token was set to xxxxx , but gpt-3.5-turbo-0613 can only accept 4096 tokens. Capping it to 4096" while using a local model HOT 1
- [Feature Request]: Portkey Integration with Autogen
- [.Net][Feature Request]: Deprecate GPTAgent
- [Issue]: Add in Teachability function for agent in Autogen Studio
- [Bug]: Cannot resume groupchat with tool calls HOT 4
- [Feature Request]: Support Microsoft Identity access and eliminate password
- [.Net][Feature Request]: Support deepseek platform
- [Issue]: openai.BadRequestError: Error code: 400 - {'detail': '[address=0.0.0.0:49645, pid=65] Model not found, uid: qwen1.5-chat-1-0'}
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 autogen.