Closed Rmaram07 closed 1 year ago
@Rmaram07 this does not seem like a kor issue. If you look at the stack trace it's coming from OpenAIEmbeddings class in langchain.
Looks like it's related to this issues:
https://github.com/hwchase17/langchain/issues/7522 https://github.com/hwchase17/langchain/issues/7548
@eyurtsev I tried updating the Pydantic version and now it works fine. Thanks for looking into this.
OK Great! I'll close this issue. :) Happy data extractions!
I'm trying to run the below code provided in the github repo.
`from langchain.chat_models import ChatOpenAI from kor import create_extraction_chain, Object, Text
llm = ChatOpenAI( model_name="gpt-3.5-turbo", temperature=0, max_tokens=2000, frequency_penalty=0, presence_penalty=0, top_p=1.0, )
schema = Object( id="player", description=( "User is controlling a music player to select songs, pause or start them or play" " music by a particular artist." ), attributes=[ Text( id="song", description="User wants to play this song", examples=[], many=True, ), Text( id="album", description="User wants to play this album", examples=[], many=True, ), Text( id="artist", description="Music by the given artist", examples=[("Songs by paul simon", "paul simon")], many=True, ), Text( id="action", description="Action to take one of:
play
,stop
,next
,previous
.", examples=[ ("Please stop the music", "stop"), ("play something", "play"), ("play a song", "play"), ("next song", "next"), ], ), ], many=False, )chain = create_extraction_chain(llm, schema, encoder_or_encoder_class='json') chain.run("play songs by paul simon and led zeppelin and the doors")['data']`
I was able to run this with chain.predict_and_parse() but not with chain.run(). Below is the trace: