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

[Bug]: 'Generation' (type=value_error.const; given=ChatGeneration; permitted=('Generation',)) #581

Open
z-sako opened this issue Nov 28, 2023 · 0 comments

Comments

@z-sako
Copy link

z-sako commented Nov 28, 2023

Current Behavior

def get_hashed_name(name):
    return hashlib.sha256(name.encode()).hexdigest()


def init_gptcache(cache_obj: Cache, llm: str):
    hashed_llm = get_hashed_name(llm)
    init_similar_cache(cache_obj=cache_obj, data_dir=f"similar_cache_{hashed_llm}")



llm = AzureChatOpenAI(deployment_name="gpt-4")
set_llm_cache(GPTCache(init_gptcache))
print(llm([HumanMessage(content="Who is it")]))

The first execution is successful, but after generating the cache, an error occurs when executing again.

pydantic.v1.error_wrappers.ValidationError: 1 validation error for Generation
type
  unexpected value; permitted: 'Generation' (type=value_error.const; given=ChatGeneration; permitted=('Generation',))

It seems that langchain.AzureChatOpenAI does not support

Looking forward to your help, thank you

Expected Behavior

No response

Steps To Reproduce

No response

Environment

langchain          0.0.340
openai             1.3.3
gptcache           0.1.42

Anything else?

No response

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

1 participant