Closed AndyMik90 closed 2 months ago
To address the issue where Gemini models in Dify version 0.6.8 respond in JSON format or return errors, you can use the agent mode with plugins. This allows the model to use external tools to provide more accurate and contextually appropriate responses.
Here is how you can configure and use plugins to improve the conversation flow:
Use Plugins:
Configure Plugins:
Select Plugins Before Conversation:
Use Knowledge:
By configuring and using these plugins and knowledge bases, you can enhance the model's ability to provide natural and accurate responses, thereby improving the overall conversation flow [1].
Additionally, you can customize the response formats by composing system prompts and setting the context referenced in the prompts. This includes customizing the content of system prompts, user messages, and assistant messages, and inserting special variable blocks like "Conversation History" and "Context" to enrich conversational functionalities [2].
To continue the conversation, mention @dosu.
I also suggest setting HarmBlockThreshold to "BLOCK_ONLY_HIGH" as most will get "google.api_core.exceptions.InvalidArgument: 400 User has requested a restricted HarmBlockThreshold setting BLOCK_NONE."
system_instruction
is a valid parameter according to Google's latest API doc: https://cloud.google.com/python/docs/reference/aiplatform/latest/vertexai.generative_models.GenerativeModel. I suspect its a server side bug, there's also a similar issue raised with the vertex AI's nodeJS SDK: https://github.com/googleapis/nodejs-vertexai/issues/350.
Self Checks
Dify version
0.6.8
Cloud or Self Hosted
Cloud, Self Hosted (Docker), Self Hosted (Source)
Steps to reproduce
Use Gemini models and see response.
✔️ Expected Behavior
Normal response from Gemini models.
❌ Actual Behavior
Gemini 1.5 Flash and Pro answers back in json format. Gemini 1.0 Vision gave error: [vertex_ai] Bad Request Error, 400 The input system_instruction is not supported.