Closed
Description
Description
I found the return body of google adk is slightly different than other AI providers' endpoints. The content contains an array of parts and the role is inside the content
[
{
"content": {
"parts": [
{
"text": "Okay! 😊\n\nEaster is on April 25th or 26th. Christmas is on December 25th."
}
],
"role": "model"
},
"partial": false,
"invocation_id": "e-73a5d2be-d454-4696-bf7a-86b831f0f7e1",
"author": "ollama_agent",
"actions": {
"state_delta": {},
"artifact_delta": {},
"requested_auth_configs": {}
},
"id": "PgjeZkgs",
"timestamp": 1745205698.571864
}
]
Besides, I have some troubles to put the input to the useChat as it requires a body of
body: {
app_name: "ollama_agent",
user_id: "u_123",
session_id: "s_123",
new_message: {
role: "user",
parts: [{
text: input
}]
},
"streaming": false
},
I am using react native. seems the handleInputChange handleSubmit do not put the input text to the body
<TextInput
style={{ backgroundColor: 'white', padding: 8 }}
placeholder="Say something..."
value={input}
onChange={e =>
handleInputChange({
...e,
target: {
...e.target,
value: e.nativeEvent.text,
},
} as unknown as React.ChangeEvent<HTMLInputElement>)
}
onSubmitEditing={e => {
//console.log('Submit', e);
handleSubmit(e);
e.preventDefault();
}}
autoFocus={true}
/>