title: fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that <class 'main.SoluteSolvent'> is a valid pydantic field type
body: <p>getting this error while executing the fast API code <code>fastapi.exceptions.FastAPIError: Invalid args for response field! Hint: check that &lt;class 'main.SoluteSolvent'&gt; is a valid pydantic field type</code></p>
  <pre class="lang-py prettyprint-override"><code>class SoluteSolvent():
      solvent: Text
      solute: Text
  
  response = {}
  @app.get('/predict')
  def predict(sol:SoluteSolvent):
      data = sol.dict()
      solute = data['solute']
      solvent = data['solvent']
      results = predictions(solute, solvent)
      print(results)
      response[&quot;predictions&quot;] = results[0].item()
      response[&quot;interaction_map&quot;] = (results[1].detach().numpy()).tolist()
      return {'result':response}
  </code></pre>
  <p>I was actually trying to replicate the code I have written for prediction in flask in fast API.</p>
  <pre class="lang-py prettyprint-override"><code>response = {}
  @app.route('/predict', methods=[&quot;POST&quot;, &quot;GET&quot;])
  def predict():
      if request.method=='POST':
          solute = request.form[&quot;solute&quot;]
          solvent = request.form[&quot;solvent&quot;]
  
      else:
          solute = request.args.get(&quot;solute&quot;)
          solvent = request.args.get(&quot;solvent&quot;)
  
      results = predictions(solute, solvent)
      
      response[&quot;predictions&quot;] = results[0].item()
      response[&quot;interaction_map&quot;] = (results[1].detach().numpy()).tolist()
      return flask.jsonify({'result': response})
  </code></pre>