MCPcopy Create free account
hub / github.com/alibaba/zvec / __init__

Method __init__

python/zvec/extension/openai_function.py:50–74  ·  view source on GitHub ↗

Initialize the base OpenAI functionality. Args: model (str): OpenAI model name. api_key (Optional[str]): API key or None to use environment variable. base_url (Optional[str]): Custom API base URL or None for default. Raises: ValueErro

(
        self,
        model: str,
        api_key: Optional[str] = None,
        base_url: Optional[str] = None,
    )

Source from the content-addressed store, hash-verified

48 }
49
50 def __init__(
51 self,
52 model: str,
53 api_key: Optional[str] = None,
54 base_url: Optional[str] = None,
55 ):
56 """Initialize the base OpenAI functionality.
57
58 Args:
59 model (str): OpenAI model name.
60 api_key (Optional[str]): API key or None to use environment variable.
61 base_url (Optional[str]): Custom API base URL or None for default.
62
63 Raises:
64 ValueError: If API key is not provided and not in environment.
65 """
66 self._model = model
67 self._api_key = api_key or os.environ.get("OPENAI_API_KEY")
68 self._base_url = base_url
69
70 if not self._api_key:
71 raise ValueError(
72 "OpenAI API key is required. Please provide 'api_key' parameter "
73 "or set the 'OPENAI_API_KEY' environment variable."
74 )
75
76 @property
77 def model(self) -> str:

Callers

nothing calls this directly

Calls 1

getMethod · 0.45

Tested by

no test coverage detected