how to convert resp to dict or json?
Description of the feature request:
hi, i have a question i write this code but this 'resp' not JSON serializable
genai.configure(api_key=apiKey)
model = genai.GenerativeModel("gemini-pro")
resp = model.generate_content("tell me a joke")
b=resp.candidates
or resp._result
how to convert resp to dict or json? thanks for help ❤️
What problem are you trying to solve with this feature?
No response
Any other information you'd like to share?
No response
Yes, we need to do this.
I'll include it in the next patch version, 0.3.3. Planned for ~12 Jan.
Proto objects can be converted with type(obj).to_dict(obj) but GenerateContentResponse is not a proto class, it's a python wrapper.
All our python classes should have a standard method for converting to a json.
Thaks for answer 🙏, But I started to use your go lang sdk
Yes, we need to do this.
I'll include it in the next patch version,
0.3.3. Planned for ~12 Jan.Proto objects can be converted with
type(obj).to_dict(obj)butGenerateContentResponseis not a proto class, it's a python wrapper.All our python classes should have a standard method for converting to a json.
Do we have any workaround to achieve this until this is not available in a library?