You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My LLM model is deployed in Azure Open AI and this is how I have set things up
token_provider = get_bearer_token_provider(DefaultAzureCredential(exclude_interactive_browser_credential=False), "https://cognitiveservices.azure.com/.default")
llm = AzureChatOpenAI(
api_version='<api_version>',
azure_endpoint="<azure_deployment_endpoint>",
azure_ad_token_provider=token_provider,
verbose = True
)
# Generate Cypher statement based on natural language input
cypher_template = """Based on the Neo4j graph schema below,
write a Cypher query that would answer the user's question.
Return only Cypher statement, no backticks, nothing else.
{schema}
Question: {question}
Cypher query:""" # noqa: E501
cypher_prompt = ChatPromptTemplate.from_messages(
[
(
"system",
"Given an input question, convert it to a Cypher query. No pre-amble.",
),
("human", cypher_template),
]
)
# https://python.langchain.com/docs/how_to/sequence/
cypher_chain = (
RunnablePassthrough.assign(
schema=lambda _: graph.get_schema,
)
| cypher_prompt
| llm.bind(stop=["\nCypherResult:"])
| StrOutputParser()
)
As you can see I am mostly following the notebook's structure for my work as i am new to Neo4j and using LLMs.
In the linked notebook, i see that CypherQueryCorrector is imported but not used. I need this now as some of my prompts are generating Cyphers with wrong syntax.
Can you advise how this can be inserted in the chain structure above?
The text was updated successfully, but these errors were encountered:
Hi ,
In one of my projects, I am intending to convert user's Natural Language questions into Cypher queries. I found this example to be really useful and mostly following the same structure - https://github.com/neo4j-labs/text2cypher/blob/main/evaluations/evaluating_cypher_jaccard.ipynb.
My LLM model is deployed in Azure Open AI and this is how I have set things up
As you can see I am mostly following the notebook's structure for my work as i am new to Neo4j and using LLMs.
In the linked notebook, i see that
CypherQueryCorrector
is imported but not used. I need this now as some of my prompts are generating Cyphers with wrong syntax.Can you advise how this can be inserted in the chain structure above?
The text was updated successfully, but these errors were encountered: