pinecone.data.import_error

 1class IndexClientInstantiationError(Exception):
 2    def __init__(self, index_args, index_kwargs) -> None:
 3        formatted_args = ", ".join(map(repr, index_args))
 4        formatted_kwargs = ", ".join(f"{key}={repr(value)}" for key, value in index_kwargs.items())
 5        combined_args = ", ".join([a for a in [formatted_args, formatted_kwargs] if a.strip()])
 6
 7        self.message = f"""You are attempting to access the Index client directly from the pinecone module. The Index client must be instantiated through the parent Pinecone client instance so that it can inherit shared configurations such as API key.
 8
 9    INCORRECT USAGE:
10        ```
11        import pinecone
12
13        pc = pinecone.Pinecone(api_key='your-api-key')
14        index = pinecone.Index({combined_args})
15        ```
16
17    CORRECT USAGE:
18        ```
19        from pinecone import Pinecone
20
21        pc = Pinecone(api_key='your-api-key')
22        index = pc.Index({combined_args})
23        ```
24        """
25        super().__init__(self.message)
26
27
28class InferenceInstantiationError(Exception):
29    def __init__(self) -> None:
30        self.message = """You are attempting to access the Inference client directly from the pinecone module. Inference functionality such as `embed` and `rerank` should only be accessed through the parent Pinecone client instance.
31
32    INCORRECT USAGE:
33        ```
34        import pinecone
35
36        pinecone.Inference().embed(...)
37        ```
38
39    CORRECT USAGE:
40        ```
41        from pinecone import Pinecone
42
43        pc = Pinecone(api_key='your-api-key')
44
45        embeddings = pc.inference.embed(
46            model='multilingual-e5-large',
47            inputs=["The quick brown fox jumps over the lazy dog.", "lorem ipsum"],
48            parameters={"input_type": "query", "truncate": "END"},
49        )
50        ```
51        """
52        super().__init__(self.message)
53
54
55class Index:
56    def __init__(self, *args, **kwargs) -> None:
57        raise IndexClientInstantiationError(args, kwargs)
58
59
60class Inference:
61    def __init__(self, *args, **kwargs) -> None:
62        raise InferenceInstantiationError()
class IndexClientInstantiationError(builtins.Exception):
 2class IndexClientInstantiationError(Exception):
 3    def __init__(self, index_args, index_kwargs) -> None:
 4        formatted_args = ", ".join(map(repr, index_args))
 5        formatted_kwargs = ", ".join(f"{key}={repr(value)}" for key, value in index_kwargs.items())
 6        combined_args = ", ".join([a for a in [formatted_args, formatted_kwargs] if a.strip()])
 7
 8        self.message = f"""You are attempting to access the Index client directly from the pinecone module. The Index client must be instantiated through the parent Pinecone client instance so that it can inherit shared configurations such as API key.
 9
10    INCORRECT USAGE:
11        ```
12        import pinecone
13
14        pc = pinecone.Pinecone(api_key='your-api-key')
15        index = pinecone.Index({combined_args})
16        ```
17
18    CORRECT USAGE:
19        ```
20        from pinecone import Pinecone
21
22        pc = Pinecone(api_key='your-api-key')
23        index = pc.Index({combined_args})
24        ```
25        """
26        super().__init__(self.message)

Common base class for all non-exit exceptions.

IndexClientInstantiationError(index_args, index_kwargs)
 3    def __init__(self, index_args, index_kwargs) -> None:
 4        formatted_args = ", ".join(map(repr, index_args))
 5        formatted_kwargs = ", ".join(f"{key}={repr(value)}" for key, value in index_kwargs.items())
 6        combined_args = ", ".join([a for a in [formatted_args, formatted_kwargs] if a.strip()])
 7
 8        self.message = f"""You are attempting to access the Index client directly from the pinecone module. The Index client must be instantiated through the parent Pinecone client instance so that it can inherit shared configurations such as API key.
 9
10    INCORRECT USAGE:
11        ```
12        import pinecone
13
14        pc = pinecone.Pinecone(api_key='your-api-key')
15        index = pinecone.Index({combined_args})
16        ```
17
18    CORRECT USAGE:
19        ```
20        from pinecone import Pinecone
21
22        pc = Pinecone(api_key='your-api-key')
23        index = pc.Index({combined_args})
24        ```
25        """
26        super().__init__(self.message)
message
Inherited Members
builtins.BaseException
with_traceback
add_note
args
class InferenceInstantiationError(builtins.Exception):
29class InferenceInstantiationError(Exception):
30    def __init__(self) -> None:
31        self.message = """You are attempting to access the Inference client directly from the pinecone module. Inference functionality such as `embed` and `rerank` should only be accessed through the parent Pinecone client instance.
32
33    INCORRECT USAGE:
34        ```
35        import pinecone
36
37        pinecone.Inference().embed(...)
38        ```
39
40    CORRECT USAGE:
41        ```
42        from pinecone import Pinecone
43
44        pc = Pinecone(api_key='your-api-key')
45
46        embeddings = pc.inference.embed(
47            model='multilingual-e5-large',
48            inputs=["The quick brown fox jumps over the lazy dog.", "lorem ipsum"],
49            parameters={"input_type": "query", "truncate": "END"},
50        )
51        ```
52        """
53        super().__init__(self.message)

Common base class for all non-exit exceptions.

message
Inherited Members
builtins.BaseException
with_traceback
add_note
args
class Index:
56class Index:
57    def __init__(self, *args, **kwargs) -> None:
58        raise IndexClientInstantiationError(args, kwargs)
Index(*args, **kwargs)
57    def __init__(self, *args, **kwargs) -> None:
58        raise IndexClientInstantiationError(args, kwargs)
class Inference:
61class Inference:
62    def __init__(self, *args, **kwargs) -> None:
63        raise InferenceInstantiationError()
Inference(*args, **kwargs)
62    def __init__(self, *args, **kwargs) -> None:
63        raise InferenceInstantiationError()