Spaces:
Runtime error
Runtime error
Download code_snippets/03_custom_odm_example.py from purpleriann/LLM-Engineers-Handbook: direct link, hf CLI and curl.
- Browser
- Download file 473 Bytes
-
https://huggingface.co/spaces/purpleriann/LLM-Engineers-Handbook/resolve/main/code_snippets/03_custom_odm_example.py
- Command line
-
hf download hf://spaces/purpleriann/LLM-Engineers-Handbook/code_snippets/03_custom_odm_example.py
-
curl -L -o 03_custom_odm_example.py https://huggingface.co/spaces/purpleriann/LLM-Engineers-Handbook/resolve/main/code_snippets/03_custom_odm_example.py
473 Bytes
| from llm_engineering.domain.documents import ArticleDocument, UserDocument | |
| if __name__ == "__main__": | |
| user = UserDocument.get_or_create(first_name="Paul", last_name="Iusztin") | |
| articles = ArticleDocument.bulk_find(author_id=str(user.id)) | |
| print(f"User ID: {user.id}") # noqa | |
| print(f"User name: {user.first_name} {user.last_name}") # noqa | |
| print(f"Number of articles: {len(articles)}") # noqa | |
| print("First article link:", articles[0].link) # noqa | |