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

AttributeError: 'dict' object has no attribute 'model_json_schema' #89

Open
jakubLangr opened this issue Jul 2, 2024 · 0 comments
Open

Comments

@jakubLangr
Copy link

When running

class MachineUtilizationModel(ZepModel):
    action_txt: str = Field(default=None, description="Action text")
    action: bool = Field(default=False, description="Action flag")
    response: dict = Field(default=None, description="Response text")

    class Config:
        arbitrary_types_allowed = True

def sanitize_json_string(json_string):
    client = Zep()
    session_id = str(uuid.uuid4())

    print(f"Sanitizing JSON string: {json_string} in zep session: {session_id}")
    # Define the model schema
    model_schema = MachineUtilizationModel.schema()
    extracted_data = client.memory.extract(
        session_id=session_id,
        model=model_schema,
        last_n=1,  # Assuming the JSON string is the last message
        validate=True,  # Enable validation for better accuracy
        current_date_time='2024-07-02T07:46:49Z'  # Current date and time in ISO 8601 format
    )
    import ipdb; ipdb.set_trace()
    return extracted_data

I get

    extracted_data = client.memory.extract(
  File "/Users/jlangr/anaconda3/anaconda3/envs/b310/lib/python3.10/site-packages/zep_cloud/external_clients/memory.py", line 68, in extract
    model_schema = json.dumps(model.model_json_schema())
AttributeError: 'dict' object has no attribute 'model_json_schema'
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