Skip to main content

PyPI version License: MIT Downloads LinkedIn

etoile_generate

etoile_generate is a Python package developed for the Mistral AI <> a16z London Hackathon held on 06/10/2024. This package facilitates the generation of structured data from natural language queries using machine learning models, integrating with LangChain and HuggingFace technologies to provide seamless experience in transforming text into actionable insights within knowledge graphs.

Installation

To install etoile_generate, use pip:

pip install etoile_generate

Usage

Here is a detailed example of using etoile_generate to extract nodes from natural language texts and transform them into structured JSON format:

Define the Model

from langchain_mistralai import ChatMistralAI

MODEL = "mistral-large-latest"
llm = ChatMistralAI(
    model=MODEL,
    temperature=0,
    max_retries=2
)

Define the Pydantic Models

from langchain_core.pydantic_v1 import BaseModel, Field
from typing import List

class Node(BaseModel):
    node_name: str = Field(..., title="Name of the node")

class Nodes(BaseModel):
    nodes: List[Node] = Field(..., title="List of nodes")

Generate Nodes

from etoile_generate import generate
from langchain_huggingface import HuggingFaceEmbeddings

texts = ["Your text data..."]
query = """
Generate nodes from the given texts.
Nodes are the basic building blocks of a knowledge graph.
The output will be a list of nodes.
Example:
{
    "nodes": [
        {
            "node_name": "Node 1"
        },
        {
            "node_name": "Node 2"
        }
    ]
}
Write the response in JSON format within ``` tags and provide the response only, without any additional explanation.
"""

# Invoke the generation function
result = generate(
    model=llm,
    embeddings=HuggingFaceEmbeddings(),
    pydantic_object=Nodes,
    texts=texts,
    query=query,
    chat_history=[]
)
print(result)
# Example Output: Nodes(nodes=[Node(node_name='Playwright'), ... (list all example nodes) ...])

Image Processing

etoile_generate can also process images by accepting image URLs as part of the input:

after_query = HumanMessage(content=[{
    "type": "image_url",
    "image_url": {"url": "https://example.com/path/to/image.jpg"}
}])

result = generate(
    model=llm,
    embeddings=HuggingFaceEmbeddings(),
    pydantic_object=TestContentSafety,
    texts=[],
    query="Query to analyze the image content for safety",
    chat_history=[],
    after_query=after_query,
    verbose=True
)
print(result)

Features

  • Generate structured JSON outputs from natural language inputs.
  • Integrated vector storage and retrieval through FAISS.
  • Utilizes state-of-the-art embeddings and LLMs from HuggingFace and LangChain.

Contributing

Contributions, issues, and feature requests are welcome! Please feel free to check the issues page.

License

etoile_generate is licensed under the MIT License.

Acknowledgements

This package was created by Evgenii (Eugene) Evstafev for the project Mistral Étoile at the Mistral AI <> a16z London Hackathon. More details about the event can be found here.

Metadata

Release files for etoile-generate 2025.5.160702

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for etoile-generate 2025.5.160702
File Size Uploaded Provenance Actions
etoile_generate-2025.5.160702.tar.gz 4.3 kB Without provenance Details for etoile_generate-2025.5.160702.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for etoile-generate 2025.5.160702
File Interpreter ABI Platform Actions
etoile_generate-2025.5.160702-py3-none-any.whl Python 3 none any Details for etoile_generate-2025.5.160702-py3-none-any.whl

Total release size: 8.6 kB

Release files / etoile_generate-2025.5.160702.tar.gz

Download URL etoile_generate-2025.5.160702.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
04d9a0ef6fe8336f0237e1cda72649eec08810b06486fc07226d30ed3ccb6151
BLAKE2b-256 checksum
How to use checksums
5c277226daf0f1def20f0ea7a2bc55b20fee30dc82cd3d99c98f93c5f4eb03af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Release files / etoile_generate-2025.5.160702-py3-none-any.whl

Download URL etoile_generate-2025.5.160702-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f25229450a9ba177a84e276bc5e2c27196cfeac9bb07496e8bbed517968e398b
BLAKE2b-256 checksum
How to use checksums
945f4dcefee78ebadcee77ec64343197b4baee34c41bbf8b83aaa5d48c7f3027
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Security for etoile-generate 2025.5.160702

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page