Skip to content

Conversation

@arnavsinghvi11
Copy link
Collaborator

Fixed branch for #637

@arnavsinghvi11
Copy link
Collaborator Author

@someshfengde tagging you on this PR that fixes the poetry lock conflicts from #637 .

lmk if all the main file changes align with your changes from the original PR and I'll merge this one.
seems like some of the poetry.lock merge changes were messed up along the way but it should be good now!

@someshfengde
Copy link
Contributor

Thanks 👍🏻👍🏻

@ivarflakstad
Copy link
Contributor

Thanks a lot! 😊
And good job, @someshfengde

@arnavsinghvi11 I guess all that's left is including it in version 2.4.2, correct?

@CholoTook
Copy link

Many thanks for this PR / Merge. Unfortunately, I can't use main, it's giving me import errors. Any timeline on when this will be resolved?

@someshfengde
Copy link
Contributor

@CholoTook the PR is merged in the main of official dspy.

Can you elaborate or give stack trace of error you are facing?

@CholoTook
Copy link

Fairly sure this /should/ work...
https://asciinema.org/connect/95eebc73-612e-4ebc-9132-5513fac4aa8a

@CholoTook
Copy link

dan@gg:~
$ mkdir Testing123
dan@gg:~
$ cd Testing123/
dan@gg:~/Testing123
$ git clone git@github.com:stanfordnlp/dspy.git
Cloning into 'dspy'...
remote: Enumerating objects: 28650, done.
remote: Counting objects: 100% (515/515), done.
remote: Compressing objects: 100% (284/284), done.
remote: Total 28650 (delta 283), reused 397 (delta 226), pack-reused 28135
Receiving objects: 100% (28650/28650), 26.93 MiB | 11.65 MiB/s, done.
Resolving deltas: 100% (12663/12663), done.
dan@gg:~/Testing123
$ cd dspy/
dan@gg:~/Testing123/dspy
$ git log
commit 696f2d2e1f96f173abb36302c71a725d564dfadb (HEAD -> main, origin/main, origin/HEAD)
...
dan@gg:~/Testing123/dspy
$ git branch
* main
dan@gg:~/Testing123/dspy
$ cd ../
dan@gg:~/Testing123
$ python -m venv .venv
dan@gg:~/Testing123
$ source .venv/bin/activate
(.venv) dan@gg:~/Testing123
$ pip install -e dspy/
Obtaining file:///home/dan/Testing123/dspy
  Installing build dependencies ... done
  Checking if build backend supports build_editable ... done
  Getting requirements to build editable ... done
  Preparing editable metadata (pyproject.toml) ... done
Collecting ujson
  Using cached ujson-5.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (53 kB)
Collecting backoff~=2.2.1
  Using cached backoff-2.2.1-py3-none-any.whl (15 kB)
Collecting pandas
  Using cached pandas-2.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.0 MB)
Collecting openai<2.0.0,>=0.28.1
  Using cached openai-1.16.2-py3-none-any.whl (267 kB)
Collecting tqdm
  Using cached tqdm-4.66.2-py3-none-any.whl (78 kB)
Collecting regex
  Using cached regex-2023.12.25-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (773 kB)
Collecting pydantic<=2.7,>=2.5.0
  Using cached pydantic-2.6.4-py3-none-any.whl (394 kB)
Collecting datasets<3.0.0,~=2.14.6
  Using cached datasets-2.14.7-py3-none-any.whl (520 kB)
Collecting joblib~=1.3.2
  Using cached joblib-1.3.2-py3-none-any.whl (302 kB)
Collecting requests
  Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Collecting optuna
  Using cached optuna-3.6.1-py3-none-any.whl (380 kB)
Collecting pyyaml>=5.1
  Using cached PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (705 kB)
Collecting xxhash
  Using cached xxhash-3.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (194 kB)
Collecting fsspec[http]<=2023.10.0,>=2023.1.0
  Using cached fsspec-2023.10.0-py3-none-any.whl (166 kB)
Collecting dill<0.3.8,>=0.3.0
  Using cached dill-0.3.7-py3-none-any.whl (115 kB)
Collecting huggingface-hub<1.0.0,>=0.14.0
  Using cached huggingface_hub-0.22.2-py3-none-any.whl (388 kB)
Collecting numpy>=1.17
  Using cached numpy-1.26.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
Collecting multiprocess
  Using cached multiprocess-0.70.16-py310-none-any.whl (134 kB)
Collecting pyarrow>=8.0.0
  Using cached pyarrow-15.0.2-cp310-cp310-manylinux_2_28_x86_64.whl (38.3 MB)
Collecting aiohttp
  Using cached aiohttp-3.9.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.2 MB)
Collecting packaging
  Using cached packaging-24.0-py3-none-any.whl (53 kB)
Collecting pyarrow-hotfix
  Using cached pyarrow_hotfix-0.6-py3-none-any.whl (7.9 kB)
Collecting distro<2,>=1.7.0
  Using cached distro-1.9.0-py3-none-any.whl (20 kB)
Collecting typing-extensions<5,>=4.7
  Using cached typing_extensions-4.11.0-py3-none-any.whl (34 kB)
Collecting sniffio
  Using cached sniffio-1.3.1-py3-none-any.whl (10 kB)
Collecting anyio<5,>=3.5.0
  Using cached anyio-4.3.0-py3-none-any.whl (85 kB)
Collecting httpx<1,>=0.23.0
  Using cached httpx-0.27.0-py3-none-any.whl (75 kB)
Collecting pydantic-core==2.16.3
  Using cached pydantic_core-2.16.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB)
Collecting annotated-types>=0.4.0
  Using cached annotated_types-0.6.0-py3-none-any.whl (12 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.6-py3-none-any.whl (61 kB)
Collecting urllib3<3,>=1.21.1
  Using cached urllib3-2.2.1-py3-none-any.whl (121 kB)
Collecting certifi>=2017.4.17
  Using cached certifi-2024.2.2-py3-none-any.whl (163 kB)
Collecting charset-normalizer<4,>=2
  Using cached charset_normalizer-3.3.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (142 kB)
Collecting sqlalchemy>=1.3.0
  Using cached SQLAlchemy-2.0.29-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.1 MB)
Collecting colorlog
  Using cached colorlog-6.8.2-py3-none-any.whl (11 kB)
Collecting alembic>=1.5.0
  Using cached alembic-1.13.1-py3-none-any.whl (233 kB)
Collecting tzdata>=2022.7
  Using cached tzdata-2024.1-py2.py3-none-any.whl (345 kB)
Collecting python-dateutil>=2.8.2
  Using cached python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
Collecting pytz>=2020.1
  Using cached pytz-2024.1-py2.py3-none-any.whl (505 kB)
Collecting Mako
  Using cached Mako-1.3.2-py3-none-any.whl (78 kB)
Collecting exceptiongroup>=1.0.2
  Using cached exceptiongroup-1.2.0-py3-none-any.whl (16 kB)
Collecting multidict<7.0,>=4.5
  Using cached multidict-6.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (124 kB)
Collecting frozenlist>=1.1.1
  Using cached frozenlist-1.4.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (239 kB)
Collecting async-timeout<5.0,>=4.0
  Using cached async_timeout-4.0.3-py3-none-any.whl (5.7 kB)
Collecting attrs>=17.3.0
  Using cached attrs-23.2.0-py3-none-any.whl (60 kB)
Collecting aiosignal>=1.1.2
  Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)
Collecting yarl<2.0,>=1.0
  Using cached yarl-1.9.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (301 kB)
Collecting httpcore==1.*
  Using cached httpcore-1.0.5-py3-none-any.whl (77 kB)
Collecting h11<0.15,>=0.13
  Using cached h11-0.14.0-py3-none-any.whl (58 kB)
Collecting filelock
  Using cached filelock-3.13.3-py3-none-any.whl (11 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting greenlet!=0.4.17
  Using cached greenlet-3.0.3-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (616 kB)
Collecting multiprocess
  Using cached multiprocess-0.70.15-py310-none-any.whl (134 kB)
Collecting MarkupSafe>=0.9.2
  Using cached MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (25 kB)
Building wheels for collected packages: dspy-ai
  Building editable for dspy-ai (pyproject.toml) ... done
  Created wheel for dspy-ai: filename=dspy_ai-2.4.3-0.editable-py3-none-any.whl size=17087 sha256=05c1c72965a59e2f6261b2af410474540a75b3584a953bec1e761457b51c61b8
  Stored in directory: /tmp/pip-ephem-wheel-cache-5yzbdr00/wheels/ed/63/55/2a1fe32b39c9a1086b66bb58ab082045c458dbe86646d4e9b6
Successfully built dspy-ai
Installing collected packages: pytz, xxhash, urllib3, ujson, tzdata, typing-extensions, tqdm, sniffio, six, regex, pyyaml, pyarrow-hotfix, packaging, numpy, multidict, MarkupSafe, joblib, idna, h11, greenlet, fsspec, frozenlist, filelock, exceptiongroup, distro, dill, colorlog, charset-normalizer, certifi, backoff, attrs, async-timeout, annotated-types, yarl, sqlalchemy, requests, python-dateutil, pydantic-core, pyarrow, multiprocess, Mako, httpcore, anyio, aiosignal, pydantic, pandas, huggingface-hub, httpx, alembic, aiohttp, optuna, openai, datasets, dspy-ai
Successfully installed Mako-1.3.2 MarkupSafe-2.1.5 aiohttp-3.9.3 aiosignal-1.3.1 alembic-1.13.1 annotated-types-0.6.0 anyio-4.3.0 async-timeout-4.0.3 attrs-23.2.0 backoff-2.2.1 certifi-2024.2.2 charset-normalizer-3.3.2 colorlog-6.8.2 datasets-2.14.7 dill-0.3.7 distro-1.9.0 dspy-ai-2.4.3 exceptiongroup-1.2.0 filelock-3.13.3 frozenlist-1.4.1 fsspec-2023.10.0 greenlet-3.0.3 h11-0.14.0 httpcore-1.0.5 httpx-0.27.0 huggingface-hub-0.22.2 idna-3.6 joblib-1.3.2 multidict-6.0.5 multiprocess-0.70.15 numpy-1.26.4 openai-1.16.2 optuna-3.6.1 packaging-24.0 pandas-2.2.1 pyarrow-15.0.2 pyarrow-hotfix-0.6 pydantic-2.6.4 pydantic-core-2.16.3 python-dateutil-2.9.0.post0 pytz-2024.1 pyyaml-6.0.1 regex-2023.12.25 requests-2.31.0 six-1.16.0 sniffio-1.3.1 sqlalchemy-2.0.29 tqdm-4.66.2 typing-extensions-4.11.0 tzdata-2024.1 ujson-5.9.0 urllib3-2.2.1 xxhash-3.4.1 yarl-1.9.4
(.venv) dan@gg:~/Testing123
$ 
(.venv) dan@gg:~/Testing123
$ 
(.venv) dan@gg:~/Testing123
$ 
(.venv) dan@gg:~/Testing123
$ pip freeze | grep dspy
-e git+ssh://git@github.com/stanfordnlp/dspy.git@696f2d2e1f96f173abb36302c71a725d564dfadb#egg=dspy_ai
(.venv) dan@gg:~/Testing123
$ python
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dspy
>>> dspy.OpenAI()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'dspy' has no attribute 'OpenAI'
>>> import dsp
>>> dsp.openai.OpenAI()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dan/Testing123/.venv/lib/python3.10/site-packages/openai/_client.py", line 98, in __init__
    raise OpenAIError(
openai.OpenAIError: The api_key client option must be set either by passing api_key to the client or by setting the OPENAI_API_KEY environment variable
>>> dsp.groq_client.GroqLM()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: GroqLM.__init__() missing 1 required positional argument: 'api_key'
>>> 
(.venv) dan@gg:~/Testing123
$ 

@someshfengde
Copy link
Contributor

You've to provide api_key as a positional argument. while defining the LM

@CholoTook
Copy link

CholoTook commented Apr 9, 2024 via email

@CholoTook
Copy link

CholoTook commented Apr 9, 2024

AttributeError: module 'dspy' has no attribute 'OpenAI'

@CholoTook
Copy link

Am I doing something obviously wrong? (sorry!)

@someshfengde
Copy link
Contributor

Am I doing something obviously wrong? (sorry!)

I think there is something wrong with the installation. Try to follow the instructions over documentation.

@CholoTook
Copy link

I think there is something wrong with the installation. Try to follow the instructions over documentation.

The install instructions use pip, which works fine, but doesn't include this PR (i.e. no Groq).

I saw there were some changes, but now I see:

$ python 
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dspy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dan/Geromics/PatentBot5000/.venv/lib/python3.10/site-packages/dspy/__init__.py", line 11, in <module>
    from .utils.logging import logger, set_log_level, set_log_output
  File "/home/dan/Geromics/PatentBot5000/.venv/lib/python3.10/site-packages/dspy/utils/__init__.py", line 2, in <module>
    from .logging import *
  File "/home/dan/Geromics/PatentBot5000/.venv/lib/python3.10/site-packages/dspy/utils/logging.py", line 7, in <module>
    import structlog
ModuleNotFoundError: No module named 'structlog'

@CholoTook
Copy link

I guess this should be a new issue? Does CI/CD pipeline include packaging steps?

@someshfengde
Copy link
Contributor

someshfengde commented Apr 9, 2024

Yes there seems to be issue in current main.

you can resolve the issue just by simply installing structlog with pip install structlog . I think someone forgot to update pyproject file @CholoTook

@arnavsinghvi11
Copy link
Collaborator Author

@CholoTook are you seeing the structlog import error when doing pip install -e .? Seems like we need to handle add that dependency outside of the poetry dependencies as well.

@CholoTook
Copy link

CholoTook commented Apr 10, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants