-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/create graphs by keys #58
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
base: dev
Are you sure you want to change the base?
Conversation
NotBioWaste905
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no problems with the code itself, but it should be reformatted to match other dialog2graph pipelines. Take dialog2graph/pipelines/d2g_llm module for reference, it will drastically simplify your pipeline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move all the configuration to the pipeline.py
| from .config import FIX_ATTEMPTS | ||
|
|
||
|
|
||
| def generate_new_dialog_graph_from_annotation( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a KeysGraphGenerator (or something like this) class, a child of dialog2graph.pipelines.core.algorithms.GraphGenerator and put this logic into the .invoke() method
|
|
||
| _client = OpenAI(api_key=api_key, base_url=base_url) | ||
|
|
||
| def _embed(text: str, model: str) -> np.ndarray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Langchain embedders like these:
import getpass
import os
if not os.environ.get("OPENAI_API_KEY"):
os.environ["OPENAI_API_KEY"] = getpass.getpass("Enter API key for OpenAI: ")
from langchain_openai import OpenAIEmbeddings
embeddings_model = OpenAIEmbeddings(model="text-embedding-3-large")There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest renaming it to the helpers.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use Langchain's ChatOpenAI that is much simpler to configure, please
| "Here are the definitions of the used keys from the annotation instructions:\n\n" | ||
| ) | ||
|
|
||
| # Перечисляем определения только для тех ключей, которые есть в keys_dict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Translate comments
No description provided.