Skip to content

armgit / dspy

Public Imported from GitHub
0

DSPy: The framework for programming—not prompting—language models

Python

Give direct access to the openai client

Rick Battlecaa315c56bb1
diff --git a/dsp/modules/gpt3.py b/dsp/modules/gpt3.py
index 5677ec4ba..b2b1d297f 100644
--- a/dsp/modules/gpt3.py
+++ b/dsp/modules/gpt3.py
@@ -55,7 +55,7 @@ class GPT3(LM):
if api_key:
openai.api_key = api_key
-
+
if kwargs.get("api_base"):
openai.api_base = kwargs["api_base"]
@@ -72,6 +72,9 @@ class GPT3(LM):
self.kwargs["model"] = model
self.history: list[dict[str, Any]] = []
+ def _openai_client():
+ return openai
+
def basic_request(self, prompt: str, **kwargs) -> OpenAIObject:
raw_kwargs = kwargs