code: def test_from_dict(self, monkeypatch):
      monkeypatch.setenv("OPENAI_API_KEY", "fake-api-key")
      data = {
          "type": "haystack.components.generators.openai.OpenAIGenerator",
          "init_parameters": {
              "model": "gpt-4",
              "system_prompt": None,
              "api_base_url": "test-base-url",
              "streaming_callback": "haystack.components.generators.utils.default_streaming_callback",
              "generation_kwargs": {
                  "max_tokens": 10,
                  "some_test_param": "test-params",
              },
          },
      }
      component = OpenAIGenerator.from_dict(data)
      assert component.model == "gpt-4"
      assert component.streaming_callback is default_streaming_callback
      assert component.api_base_url == "test-base-url"
      assert component.generation_kwargs == {
          "max_tokens": 10,
          "some_test_param": "test-params",
      }
  
imports: import os
  from typing import List
  import pytest
  from openai import OpenAIError
  from haystack.components.generators import OpenAIGenerator
  from haystack.components.generators.utils import default_streaming_callback
  from haystack.dataclasses import StreamingChunk, ChatMessage
label_desc: Use image node_id 7 for calling the TestOpenAIGenerator obj's underlying member method code with example usage: obj.test_from_dict(monkeypatch) without return types