neo4j / neo4j/neo4j-graphrag-python
[FEATURE]: Add MistralAI Structured Output feature
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 246
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 11
Description
Description
Description
MistralAI supports custom structured output. It would be useful to also implement it in neo4j-graphrag. How to use it with mistralai python package:
import os
from mistralai.client import Mistral
from pydantic import BaseModel
api_key = os.environ["MISTRAL_API_KEY"]
model = "ministral-8b-latest"
client = Mistral(api_key=api_key)
class Book(BaseModel):
name: str
authors: list[str]
chat_response = client.chat.parse(
model=model,
messages=[
{
"role": "system",
"content": "Extract the books information."
},
{
"role": "user",
"content": "I recently read 'To Kill a Mockingbird' by Harper Lee."
},
],
response_format=Book,
max_tokens=256,
temperature=0
)
print(chat_response.choices[0].message.content) // for JSON output
print(chat_response.choices[0].message.parsed) // for Pydantic model output
Additional Info
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no repository files, entry points, or tests. Start by locating existing structured-output integrations and compare them with the MistralAI Python example; done means supporting custom response formats and validating the behavior with tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100