Vik Paruchuri commited on
Commit
5e316bb
·
1 Parent(s): 2b17801
Files changed (1) hide show
  1. tests/services/test_service_init.py +39 -9
tests/services/test_service_init.py CHANGED
@@ -17,10 +17,8 @@ def test_empty_llm(pdf_converter: PdfConverter, temp_doc):
17
 
18
  def test_llm_no_keys(model_dict, config):
19
  with pytest.raises(AssertionError):
20
- PdfConverter(
21
- artifact_dict=model_dict,
22
- config={"use_llm": True}
23
- )
24
 
25
  @pytest.mark.output_format("markdown")
26
  @pytest.mark.config({"page_range": [0], "use_llm": True, "gemini_api_key": "test"})
@@ -30,26 +28,58 @@ def test_llm_gemini(pdf_converter: PdfConverter, temp_doc):
30
 
31
 
32
  @pytest.mark.output_format("markdown")
33
- @pytest.mark.config({"page_range": [0], "use_llm": True, "vertex_project_id": "test", "llm_service": "marker.services.vertex.GoogleVertexService"})
 
 
 
 
 
 
 
34
  def test_llm_vertex(pdf_converter: PdfConverter, temp_doc):
35
  assert pdf_converter.artifact_dict["llm_service"] is not None
36
  assert isinstance(pdf_converter.llm_service, GoogleVertexService)
37
 
38
 
39
  @pytest.mark.output_format("markdown")
40
- @pytest.mark.config({"page_range": [0], "use_llm": True, "llm_service": "marker.services.ollama.OllamaService"})
 
 
 
 
 
 
41
  def test_llm_ollama(pdf_converter: PdfConverter, temp_doc):
42
  assert pdf_converter.artifact_dict["llm_service"] is not None
43
  assert isinstance(pdf_converter.llm_service, OllamaService)
44
 
 
45
  @pytest.mark.output_format("markdown")
46
- @pytest.mark.config({"page_range": [0], "use_llm": True, "llm_service": "marker.services.openai.OpenAIService", "openai_api_key": "test"})
 
 
 
 
 
 
 
47
  def test_llm_openai(pdf_converter: PdfConverter, temp_doc):
48
  assert pdf_converter.artifact_dict["llm_service"] is not None
49
  assert isinstance(pdf_converter.llm_service, OpenAIService)
50
 
 
51
  @pytest.mark.output_format("markdown")
52
- @pytest.mark.config({"page_range": [0], "use_llm": True, "llm_service": "marker.services.azure_openai.AzureOpenAIService", "azure_endpoint": "https://example.openai.azure.com", "azure_api_key": "test", "deployment_name": "test-model"})
 
 
 
 
 
 
 
 
 
 
53
  def test_llm_azure_openai(pdf_converter: PdfConverter, temp_doc):
54
  assert pdf_converter.artifact_dict["llm_service"] is not None
55
- assert isinstance(pdf_converter.llm_service, AzureOpenAIService)
 
17
 
18
  def test_llm_no_keys(model_dict, config):
19
  with pytest.raises(AssertionError):
20
+ PdfConverter(artifact_dict=model_dict, config={"use_llm": True})
21
+
 
 
22
 
23
  @pytest.mark.output_format("markdown")
24
  @pytest.mark.config({"page_range": [0], "use_llm": True, "gemini_api_key": "test"})
 
28
 
29
 
30
  @pytest.mark.output_format("markdown")
31
+ @pytest.mark.config(
32
+ {
33
+ "page_range": [0],
34
+ "use_llm": True,
35
+ "vertex_project_id": "test",
36
+ "llm_service": "marker.services.vertex.GoogleVertexService",
37
+ }
38
+ )
39
  def test_llm_vertex(pdf_converter: PdfConverter, temp_doc):
40
  assert pdf_converter.artifact_dict["llm_service"] is not None
41
  assert isinstance(pdf_converter.llm_service, GoogleVertexService)
42
 
43
 
44
  @pytest.mark.output_format("markdown")
45
+ @pytest.mark.config(
46
+ {
47
+ "page_range": [0],
48
+ "use_llm": True,
49
+ "llm_service": "marker.services.ollama.OllamaService",
50
+ }
51
+ )
52
  def test_llm_ollama(pdf_converter: PdfConverter, temp_doc):
53
  assert pdf_converter.artifact_dict["llm_service"] is not None
54
  assert isinstance(pdf_converter.llm_service, OllamaService)
55
 
56
+
57
  @pytest.mark.output_format("markdown")
58
+ @pytest.mark.config(
59
+ {
60
+ "page_range": [0],
61
+ "use_llm": True,
62
+ "llm_service": "marker.services.openai.OpenAIService",
63
+ "openai_api_key": "test",
64
+ }
65
+ )
66
  def test_llm_openai(pdf_converter: PdfConverter, temp_doc):
67
  assert pdf_converter.artifact_dict["llm_service"] is not None
68
  assert isinstance(pdf_converter.llm_service, OpenAIService)
69
 
70
+
71
  @pytest.mark.output_format("markdown")
72
+ @pytest.mark.config(
73
+ {
74
+ "page_range": [0],
75
+ "use_llm": True,
76
+ "llm_service": "marker.services.azure_openai.AzureOpenAIService",
77
+ "azure_endpoint": "https://example.openai.azure.com",
78
+ "azure_api_key": "test",
79
+ "deployment_name": "test-model",
80
+ "azure_api_version": "1",
81
+ }
82
+ )
83
  def test_llm_azure_openai(pdf_converter: PdfConverter, temp_doc):
84
  assert pdf_converter.artifact_dict["llm_service"] is not None
85
+ assert isinstance(pdf_converter.llm_service, AzureOpenAIService)