Closed jxnl closed 12 months ago
This update introduces a structured approach to handling knowledge graph data. It leverages the instructor
module and defines new data models for better organization and readability. The code is now more maintainable, with improved error handling and direct use of response data in Neo4j queries.
File | Summary |
---|---|
main.py |
Imported instructor module and KnowledgeGraph class. Patched instructor , updated variable annotations, and optimized data retrieval and usage in Neo4j queries. |
models.py |
Introduced new data models (Metadata , Node , Edge , KnowledgeGraph ) for structuring knowledge graph data. |
requirements.txt |
Added "instructor" package (version 0.2.8) to project dependencies. |
🐇💻
Code refined, structure defined,
With each line, clarity we find.
Instructor guides, models align,
In this codebase, order shines! 🌟
@jxnl nice PR!
so instructor is your module that allows this response_model
param? I was trying to figure that out. very neat!
https://github.com/jxnl/instructor
can i clarify what this does - use not only the KnowledgeGraph class, but also the subclasses, edge and node creates a JSON schema from those classes to pass to openAI? are all the docs/comments in the classes also passed to openAI as instructions?
is there anything like this for use with typescript, where the typings can be applied more rigorously?
This PR uses instructo to clean up the function calling api, now the models are easily editable, and we can get dict/model back out with more confidence.
Summary by CodeRabbit
Release Notes:
KnowledgeGraph
class to encapsulate knowledge graph data and operations.main.py
script to use the newKnowledgeGraph
class, improving code readability and maintainability.from
tofrom_
.