instructor icon indicating copy to clipboard operation
instructor copied to clipboard

A warning will appear in version 1.4.0 but not in version 1.3.7

Open windy opened this issue 1 year ago • 7 comments

At 1.4.0 version, The following warning appear:

site-packages/pydantic/_internal/_config.py:341: UserWarning: Valid config keys have changed in V2:

  • 'allow_population_by_field_name' has been renamed to 'populate_by_name'
  • 'smart_union' has been removed warnings.warn(message, UserWarning

windy avatar Aug 25 '24 03:08 windy

Hey @windy , which clients are you currently using? I tried to install instructor at 1.4.0 and reproduced it only when

  1. Install instructor==1.4.0
  2. install Cohere
  3. run the following script
import instructor
import openai
from pydantic import BaseModel

client = instructor.from_openai(openai.OpenAI())


class User(BaseModel):
    name: str
    age: str


resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {
            "role": "user",
            "content": "Ivan is a 27 year old software engineer in Singapore",
        }
    ],
    response_model=User,
)

print(resp)

This will cause the error you've logged out to appear. Just wanted to confirm if you're using cohere?

ivanleomk avatar Aug 31 '24 15:08 ivanleomk

My project's toml config has pydantic = "^2.8.2", maybe it is the reason.

windy avatar Sep 01 '24 06:09 windy

Add one more thing, 1.3.x will also have similar prompts, which seems to be caused by the upgrade of the pydantic version. However, I have ruled out other libraries and can confirm that it is due to our library.

windy avatar Sep 01 '24 06:09 windy

Yeap it’s due to pydantic’s upgrade of its config keys but we don’t use those in instructor as far as I know.

Could I know what other packages you have installed in your project?

On Sun, 1 Sep 2024 at 2:13 PM, yafei lee @.***> wrote:

Add one more thing, 1.3.x will also have similar prompts, which seems to be caused by the upgrade of the pydantic version. However, I have ruled out other libraries and can confirm that it is due to our library.

— Reply to this email directly, view it on GitHub https://github.com/jxnl/instructor/issues/949#issuecomment-2323186425, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5D6RRK62VVALNIEZKXHMTZUKV7LAVCNFSM6AAAAABNCE725OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRTGE4DMNBSGU . You are receiving this because you commented.Message ID: @.***>

ivanleomk avatar Sep 01 '24 06:09 ivanleomk

The issue might be due to other libraries that the instructor relies on. When I remove the instructor, the warning disappears, and when I add it back, it' back, so it is definitely related to our instructor.

windy avatar Sep 01 '24 06:09 windy

Could I see the packages and their versions that get installed when you install 1.4.0 on your application?

I’ll try to reproduce it if possible locally

On Sun, 1 Sep 2024 at 2:19 PM, yafei lee @.***> wrote:

The issue might be due to other libraries that the instructor relies on. When I remove the instructor, the warning disappears, and when I add it back, there's no problem, so it is definitely related to our instructor.

— Reply to this email directly, view it on GitHub https://github.com/jxnl/instructor/issues/949#issuecomment-2323188208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK5D6RUNFG7XY5VOCN7V6FDZUKWYHAVCNFSM6AAAAABNCE725OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRTGE4DQMRQHA . You are receiving this because you commented.Message ID: @.***>

ivanleomk avatar Sep 01 '24 06:09 ivanleomk

I'm sorry, the company needs to keep this information confidential, but it seems like it can be reproduced with the information I provided. You can try it out.

windy avatar Sep 02 '24 06:09 windy

Haven't seen any updates so closing the issue due to inactivity for now. Feel free to open it if the problem persists.

ivanleomk avatar Oct 10 '24 15:10 ivanleomk