Conversation
NotBioWaste905
left a comment
There was a problem hiding this comment.
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.
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.
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.
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.
I would suggest renaming it to the helpers.py
There was a problem hiding this comment.
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.
Translate comments
No description provided.