Skip to content

armgit / dspy

Public Imported from GitHub
0

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

Python

Merge branch 'main' into hf_models

Keshav Santhanam8538bb797ae5
diff --cc dsp/modules/__init__.py
index 03171fc84,870bafa9e..5b5dda21d
--- a/dsp/modules/__init__.py
+++ b/dsp/modules/__init__.py
@@@ -1,4 -1,4 +1,4 @@@
from .cache_utils import *
from .gpt3 import *
-from .colbertv2 import *
-from .sentence_vectorizer import *
+from .hf import HFModel
- from .colbertv2 import *
++from .sentence_vectorizer import *
diff --cc dsp/modules/gpt3.py
index c379e63d5,cf798e952..8f828a31c
--- a/dsp/modules/gpt3.py
+++ b/dsp/modules/gpt3.py
@@@ -14,11 -13,13 +14,14 @@@ def backoff_hdlr(details)
"{kwargs}".format(**details))
-class GPT3:
+class GPT3(LM):
- def __init__(self, model='text-davinci-002', api_key=None):
+ def __init__(self, model='text-davinci-002', api_key=None, **kwargs):
+ super().__init__(model)
if api_key:
openai.api_key = api_key
-
++
+ self.kwargs = {'model': model, 'temperature': 0.0, 'max_tokens': 150, 'top_p': 1,
- 'frequency_penalty': 0, 'presence_penalty': 0, 'n': 1, **kwargs} # TODO: add kwargs above for </s>
++ 'frequency_penalty': 0, 'presence_penalty': 0, 'n': 1, **kwargs} # TODO: add kwargs above for
self.history = []