Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hey i am new to this #5

Open
Gameatiks opened this issue Jun 7, 2024 · 1 comment
Open

hey i am new to this #5

Gameatiks opened this issue Jun 7, 2024 · 1 comment

Comments

@Gameatiks
Copy link

Hello,
I am new to coding, have some patience with me.

i followed your steps and get this error, can somebody help me, i changed nothing on your Assistant.py file
i have a .env file with an open.ai api.
i installed all req. python libs

This is my output in widows:

Traceback (most recent call last):
File "C:\assistant\assistant.py", line 8, in
from langchain.prompts import ChatPromptTemplate, MessagesPlaceholder
File "D:\Python\Lib\site-packages\langchain\prompts_init_.py", line 32, in
from langchain_core.example_selectors import (
File "D:\Python\Lib\site-packages\langchain_core\example_selectors_init_.py", line 6, in
from langchain_core.example_selectors.length_based import (
File "D:\Python\Lib\site-packages\langchain_core\example_selectors\length_based.py", line 6, in
from langchain_core.prompts.prompt import PromptTemplate
File "D:\Python\Lib\site-packages\langchain_core\prompts_init_.py", line 27, in
from langchain_core.prompts.base import (
File "D:\Python\Lib\site-packages\langchain_core\prompts\base.py", line 22, in
from langchain_core.output_parsers.base import BaseOutputParser
File "D:\Python\Lib\site-packages\langchain_core\output_parsers_init_.py", line 15, in
from langchain_core.output_parsers.base import (
File "D:\Python\Lib\site-packages\langchain_core\output_parsers\base.py", line 18, in
from langchain_core.language_models import LanguageModelOutput
File "D:\Python\Lib\site-packages\langchain_core\language_models_init_.py", line 25, in
from langchain_core.language_models.base import (
File "D:\Python\Lib\site-packages\langchain_core\language_models\base.py", line 75, in
class BaseLanguageModel(
File "D:\Python\Lib\site-packages\pydantic\v1\main.py", line 286, in new
cls.try_update_forward_refs()
File "D:\Python\Lib\site-packages\pydantic\v1\main.py", line 807, in try_update_forward_refs
update_model_forward_refs(cls, cls.fields.values(), cls.config.json_encoders, localns, (NameError,))
File "D:\Python\Lib\site-packages\pydantic\v1\typing.py", line 554, in update_model_forward_refs
update_field_forward_refs(f, globalns=globalns, localns=localns)
File "D:\Python\Lib\site-packages\pydantic\v1\typing.py", line 520, in update_field_forward_refs
field.type_ = evaluate_forwardref(field.type_, globalns, localns or None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Python\Lib\site-packages\pydantic\v1\typing.py", line 66, in evaluate_forwardref
return cast(Any, type_)._evaluate(globalns, localns, set())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard'

so, yeah, i would be glad if you can provide help

@CodeBerserkers888
Copy link

This is typical of a problem with Pydantic's unstable version 1 bibnlioeka.
Specifically, TypeError: ForwardRef._evaluate() missing 1 required keyword-only argument: 'recursive_guard' indicates a problem with the use of ForwardRef in Pydantic.
probably sounds like spaghetti with marmalade, well let's humanely write it.

  • First, make sure you have the latest version of Pydantic. Just fire up this command in the terminal:
pip install --upgrade pydantic

next....

pip install --upgrade langchain

After updating, fire up your script again to see if the problem has disappeared. I'm keeping my fingers crossed! ✊

If the problem still exists:

Create a new virtual environment:

Sometimes creating a new virtual environment can work wonders.

python -m venv myenv

Activate the virtual environment:

On Windows:

.```myenvScriptsactivate

On macOS/Linux:

```source myenv/bin/activate

Install the required libraries:

Now install the required libraries in the new environment:

pip install pydantic langchain openai

Fire up the script in the new virtual environment and see if the problem has disappeared. If not, you may have to ask the universe for a little more patience.... Or reset your computer, it always works! 😜

Good luck! 🚀

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

No branches or pull requests

2 participants