File tree Expand file tree Collapse file tree
sdks/python/apache_beam/ml Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3131from typing import Any
3232from typing import Optional
3333
34+ from openai import AsyncOpenAI
35+ from openai import OpenAI
36+
3437from apache_beam .io .filesystems import FileSystems
3538from apache_beam .ml .inference .base import ModelHandler
3639from apache_beam .ml .inference .base import PredictionResult
3740from apache_beam .utils import subprocess_server
38- from openai import AsyncOpenAI
39- from openai import OpenAI
4041
4142try :
4243 # VLLM logging config breaks beam logging.
Original file line number Diff line number Diff line change 2424
2525import apache_beam as beam
2626from apache_beam .ml .rag .embeddings .huggingface import HuggingfaceTextEmbeddings
27+ from apache_beam .ml .rag .embeddings .test_utils import chunk_approximately_equals
2728from apache_beam .ml .rag .types import Chunk
2829from apache_beam .ml .rag .types import Content
2930from apache_beam .ml .rag .types import Embedding
3031from apache_beam .ml .transforms .base import MLTransform
3132from apache_beam .testing .test_pipeline import TestPipeline
3233from apache_beam .testing .util import assert_that
3334from apache_beam .testing .util import equal_to
34- from apache_beam .ml .rag .embeddings .test_utils import chunk_approximately_equals
3535
3636# pylint: disable=unused-import
3737try :
Original file line number Diff line number Diff line change 2424from apache_beam .ml .rag .types import Chunk
2525from apache_beam .ml .transforms .base import EmbeddingsManager
2626from apache_beam .ml .transforms .base import _TextEmbeddingHandler
27- from apache_beam .ml .transforms .embeddings .open_ai import (
28- _OpenAITextEmbeddingHandler , )
27+ from apache_beam .ml .transforms .embeddings .open_ai import _OpenAITextEmbeddingHandler
2928
3029__all__ = ['OpenAITextEmbeddings' ]
3130
Original file line number Diff line number Diff line change 1919import unittest
2020
2121import apache_beam as beam
22+ from apache_beam .ml .rag .embeddings .open_ai import OpenAITextEmbeddings
23+ from apache_beam .ml .rag .embeddings .test_utils import chunk_approximately_equals
2224from apache_beam .ml .rag .types import Chunk
2325from apache_beam .ml .rag .types import Content
2426from apache_beam .ml .rag .types import Embedding
2527from apache_beam .ml .transforms .base import MLTransform
2628from apache_beam .testing .test_pipeline import TestPipeline
2729from apache_beam .testing .util import assert_that
2830from apache_beam .testing .util import equal_to
29- from apache_beam .ml .rag .embeddings .open_ai import OpenAITextEmbeddings
30- from apache_beam .ml .rag .embeddings .test_utils import chunk_approximately_equals
3131
3232
3333class OpenAITextEmbeddingsTest (unittest .TestCase ):
Original file line number Diff line number Diff line change 2121import unittest
2222
2323import apache_beam as beam
24+ from apache_beam .ml .rag .embeddings .test_utils import chunk_approximately_equals
2425from apache_beam .ml .rag .types import Chunk
2526from apache_beam .ml .rag .types import Content
2627from apache_beam .ml .rag .types import Embedding
2728from apache_beam .ml .transforms .base import MLTransform
2829from apache_beam .testing .test_pipeline import TestPipeline
2930from apache_beam .testing .util import assert_that
3031from apache_beam .testing .util import equal_to
31- from apache_beam .ml .rag .embeddings .test_utils import chunk_approximately_equals
3232
3333# pylint: disable=ungrouped-imports
3434try :
Original file line number Diff line number Diff line change 2121from typing import TypeVar
2222from typing import Union
2323
24- import apache_beam as beam
2524import openai
25+ from openai import APIError
26+ from openai import RateLimitError
27+
28+ import apache_beam as beam
2629from apache_beam .ml .inference .base import RemoteModelHandler
2730from apache_beam .ml .inference .base import RunInference
2831from apache_beam .ml .transforms .base import EmbeddingsManager
2932from apache_beam .ml .transforms .base import _TextEmbeddingHandler
3033from apache_beam .pvalue import PCollection
3134from apache_beam .pvalue import Row
32- from openai import APIError
33- from openai import RateLimitError
3435
3536__all__ = ["OpenAITextEmbeddings" ]
3637
You can’t perform that action at this time.
0 commit comments