Skip to content

Conversation

@mary-silence
Copy link
Contributor

No description provided.

Copy link
Collaborator

@NotBioWaste905 NotBioWaste905 left a 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

Copy link
Collaborator

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(
Copy link
Collaborator

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:
Copy link
Collaborator

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")

Copy link
Collaborator

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

Copy link
Collaborator

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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Translate comments

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

Successfully merging this pull request may close these issues.

3 participants