txtai is an all-in-one AI framework for semantic search, LLM orchestration and language model workflows.
Retrieval Augmented Generation (RAG) is one of the most popular techniques in the AI space today. RAG takes a user request, retrieves the best matching content and then plugs that context into an LLM prompt to generate an answer. When otherwise not mentioned, most assume the context is generated using a vector database query. But there is no rule that says context can't be generated with other methods. It could be a simple web query, SQL query, text index search or other traditional search.
We also often hear the term GraphRAG. GraphRAG means different things to different people. Here we're going to build an example that uses txtai
, wikipedia and gpt-oss to research a specific topic with graphs. txtai
has a built-in graph component that automatically generates a graph network over the data loaded into an embeddings database. We'll use a pre-built embeddings database hosted on the Hugging Face Hub, txtai-wikipedia-slim.
Install dependencies
Install txtai
and all dependencies.
pip install txtai[graph,pipeline-llm]
Load txtai-wikipedia-slim
Next, we'll load the embeddings database. This database is the top 100K most viewed Wikipedia articles with both a dense vector index and graph network enabled.
from txtai import Embeddings
embeddings = Embeddings().load(provider="huggingface-hub", container="neuml/txtai-wikipedia-slim")
Build context with a graph query
The txtai
graph component supports the openCypher query language via the GrandCypher library.
openCypher is a language for expressive and efficient data querying of a property graph. In this example, we'll traverse the embeddings database graph looking for paths between nodes similar to chatgpt
and anthropic
.
g = embeddings.search("""
MATCH P=(A)-[]->(B)
WHERE SIMILAR(A, 'chatgpt') AND SIMILAR(B, 'anthropic')
RETURN P
LIMIT 10
""", graph=True)
The query above is an extremely powerful combination of an vector similarity node search and a graph traversal query that walks the paths between nodes. It's much more expressive than simply saying find nodes similar to each of the concepts independently. It can be considered a deep graph search
.
Plot the context network
Let's show the context as a graph plot!
import matplotlib.pyplot as plt
import networkx as nx
def plot(graph):
labels = {x: f"{graph.attribute(x, 'id')}" for x in graph.scan()}
colors = ["#D32F2F", "#0277bd", "#7e57c2", "#757575"]
results = embeddings.batchsimilarity(labels.values(), ["Anthropic Claude", "Google Gemini", "OpenAI GPT"])
colors = [colors[x[0][0]] for x in results]
options = {
"node_size": 1000,
"node_color": colors,
"edge_color": "#454545",
"font_color": "#efefef",
"font_size": 10,
"alpha": 1.0,
}
fig, ax = plt.subplots(figsize=(20, 9))
pos = nx.spring_layout(graph.backend, seed=0, k=0.9, iterations=50)
nx.draw_networkx(graph.backend, pos=pos, labels=labels, **options)
ax.set_facecolor("#303030")
ax.axis("off")
fig.set_facecolor("#303030")
plt.show()
plot(g)
Print the context as text
Let's further inspect the graph nodes.
context = ""
for x in g.scan():
uid = g.attribute(x, "id")
context += f"- id: {uid}\n"
context += f" url: https://en.wikipedia.org/wiki/{uid.replace(' ', '_')}\n"
context += f" text: {g.attribute(x, 'text')}\n"
context += f" links: {[g.attribute(n, 'id') for n in g.edges(x)]}\n"
print(context)
- id: ChatGPT
url: https://en.wikipedia.org/wiki/ChatGPT
text: ChatGPT is a generative artificial intelligence chatbot developed by OpenAI and released on November 30, 2022. It uses large language models (LLMs) such as GPT-4o as well as other multimodal models to create human-like responses in text, speech, and images. It has access to features such as searching the web, using apps, and running programs. It is credited with accelerating the AI boom, an ongoing period of rapid investment in and public attention to the field of artificial intelligence (AI). Some observers have raised concern about the potential of ChatGPT and similar programs to displace human intelligence, enable plagiarism, or fuel misinformation.
links: ['GPT-4', 'GPT-4.5', 'OpenAI', 'Gemini (chatbot)', 'GPT-3', 'GPT-4.1', 'Gemini (language model)', 'Anthropic', 'Claude (language model)']
- id: GPT-4
url: https://en.wikipedia.org/wiki/GPT-4
text: Generative Pre-trained Transformer 4 (GPT-4) is a multimodal large language model trained and created by OpenAI and the fourth in its series of GPT foundation models. It was launched on March 14, 2023, and made publicly available via the paid chatbot product ChatGPT Plus until being replaced in 2025, via OpenAI's API, and via the free chatbot Microsoft Copilot.
links: ['ChatGPT', 'GPT-3', 'GPT-4.5', 'GPT-4.1', 'OpenAI', 'Gemini (chatbot)', 'Gemini (language model)', 'Claude (language model)']
- id: GPT-4.5
url: https://en.wikipedia.org/wiki/GPT-4.5
text: GPT-4.5 (codenamed "Orion") is a large language model developed by OpenAI as part of the GPT series. Officially released on February 27, 2025, GPT-4.5 is available to users subscribed to the ChatGPT Plus and Pro plans across web, mobile, and desktop platforms. Access is also provided through the OpenAI API and the OpenAI Developer Playground, but the company plans to phase out API access to the model in July.
links: ['GPT-4.1', 'GPT-4', 'ChatGPT', 'GPT-3', 'OpenAI', 'Claude (language model)', 'Gemini (language model)', 'Anthropic', 'Gemini (chatbot)']
- id: OpenAI
url: https://en.wikipedia.org/wiki/OpenAI
text: OpenAI, Inc. is an American artificial intelligence (AI) organization founded in December 2015 and headquartered in San Francisco, California. It aims to develop "safe and beneficial" artificial general intelligence (AGI), which it defines as "highly autonomous systems that outperform humans at most economically valuable work". As a leading organization in the ongoing AI boom, OpenAI is known for the GPT family of large language models, the DALL-E series of text-to-image models, and a text-to-video model named Sora. Its release of ChatGPT in November 2022 has been credited with catalyzing widespread interest in generative AI.
links: ['ChatGPT', 'GPT-4', 'GPT-3', 'GPT-4.5', 'Anthropic', 'GPT-4.1', 'Gemini (chatbot)', 'Gemini (language model)']
- id: Gemini (chatbot)
url: https://en.wikipedia.org/wiki/Gemini_(chatbot)
text: Gemini, formerly known as Bard, is a generative artificial intelligence chatbot developed by Google. Based on the large language model (LLM) of the same name, it was launched in 2023 in response to the rise of OpenAI's ChatGPT. It was previously based on the LaMDA and PaLM LLMs.
links: ['Gemini (language model)', 'ChatGPT', 'GPT-4', 'Anthropic', 'OpenAI', 'GPT-4.5']
- id: GPT-3
url: https://en.wikipedia.org/wiki/GPT-3
text: Generative Pre-trained Transformer 3 (GPT-3) is a large language model released by OpenAI in 2020.
links: ['GPT-4', 'GPT-4.1', 'ChatGPT', 'OpenAI', 'GPT-4.5', 'Claude (language model)', 'Gemini (language model)']
- id: GPT-4.1
url: https://en.wikipedia.org/wiki/GPT-4.1
text: GPT-4.1 is a large language model within OpenAI's GPT series. It was released on April 14, 2025. GPT-4.1 can be accessed through the OpenAI API or the OpenAI Developer Playground. Three different models were simultaneously released: GPT-4.1, GPT-4.1 mini, and GPT-4.1 nano.
links: ['GPT-4.5', 'GPT-4', 'GPT-3', 'ChatGPT', 'OpenAI', 'Gemini (language model)', 'Claude (language model)']
- id: Gemini (language model)
url: https://en.wikipedia.org/wiki/Gemini_(language_model)
text: Gemini is a family of multimodal large language models (LLMs) developed by Google DeepMind, and the successor to LaMDA and PaLM 2. Comprising Gemini Ultra, Gemini Pro, Gemini Flash, and Gemini Nano, it was announced on December 6, 2023, positioned as a competitor to OpenAI's GPT-4. It powers the chatbot of the same name. In March 2025, Gemini 2.5 Pro Experimental was rated as highly competitive.
links: ['Gemini (chatbot)', 'GPT-4', 'ChatGPT', 'GPT-4.5', 'GPT-4.1', 'GPT-3', 'OpenAI', 'Anthropic']
- id: Anthropic
url: https://en.wikipedia.org/wiki/Anthropic
text: Anthropic PBC is an American artificial intelligence (AI) startup company founded in 2021. Anthropic has developed a family of large language models (LLMs) named Claude as a competitor to OpenAI's ChatGPT and Google's Gemini. According to the company, it researches and develops AI to "study their safety properties at the technological frontier" and use this research to deploy safe models for the public.
links: ['Claude (language model)', 'OpenAI', 'ChatGPT', 'Gemini (chatbot)', 'GPT-4.5', 'Gemini (language model)']
- id: Claude (language model)
url: https://en.wikipedia.org/wiki/Claude_(language_model)
text: Claude is a family of large language models developed by Anthropic. The first model was released in March 2023.
links: ['Anthropic', 'GPT-3', 'GPT-4.5', 'GPT-4', 'ChatGPT', 'GPT-4.1']
GraphRAG
Now that we have our graph context, we'll plug that into an LLM prompt.
from txtai import LLM
llm = LLM("unsloth/gpt-oss-20b-GGUF/gpt-oss-20b-Q4_K_M.gguf", n_ctx=20000)
from IPython.display import display, Markdown
out = llm(f"""
Analyze the following context and write an article about it
{context}
""", defaultrole="user", maxlength=20000, stripthink=True)
display(Markdown(out))
Report Output Below
ChatGPT, GPT‑4, and the New Generation of Generative AI: A Timeline of Innovation and Impact
By [Your Name]
Published: 2025‑09‑03
1. The Dawn of Generative AI
The field of artificial intelligence (AI) has long promised “highly autonomous systems that outperform humans at most economically valuable work.” In practice, the most visible manifestation of that promise has been the rapid rise of large language models (LLMs) that can generate text, speech, and even images that read like they were written by a human. The most influential of these models has come from a handful of companies—OpenAI, Google DeepMind, and Anthropic—each building a family of models that have pushed the boundaries of what machines can do.
2. OpenAI’s GPT Series
Model | Release | Key Features | Notes |
---|---|---|---|
GPT‑3 | 2020 | 175 billion parameters; first public GPT model | Laid the groundwork for conversational AI |
ChatGPT | 2022‑11‑30 | Uses GPT‑4o and multimodal models; web‑search, app‑integration, program execution | Sparked the “AI boom” and widespread public interest |
GPT‑4 | 2023‑03‑14 | Multimodal; released via ChatGPT Plus, API, Microsoft Copilot | Became the de‑facto standard for LLM‑based chat |
GPT‑4.1 | 2025‑04‑14 | Three variants (mini, nano) released simultaneously | Improved safety and performance |
GPT‑4.5 | 2025‑02‑27 | Codename “Orion”; API access to be phased out in July | Highest‑performance model in the GPT line |
OpenAI’s mission—“safe and beneficial” artificial general intelligence—has guided the evolution of these models. The company’s public releases have been accompanied by a steady stream of research papers, API documentation, and developer playgrounds that allow researchers and businesses to experiment with the models at scale.
3. Google DeepMind’s Gemini
Google’s response to the GPT wave came in 2023 with Gemini (chatbot), a generative AI chatbot that replaced the earlier Bard. Gemini is powered by the Gemini (language model) family, which includes Gemini Ultra, Pro, Flash, and Nano. The models were announced on 2023‑12‑06 and positioned as direct competitors to GPT‑4. In March 2025, Gemini 2.5 Pro Experimental was rated as “highly competitive,” underscoring the rapid parity between the two ecosystems.
4. Anthropic’s Claude
Founded in 2021, Anthropic PBC has focused on the safety properties of AI. Their flagship LLM family, Claude, was first released in March 2023. Claude is marketed as a competitor to both ChatGPT and Gemini, with a particular emphasis on “safe models for the public.” Anthropic’s research agenda—studying safety at the technological frontier—has positioned it as a counter‑balance to the commercial focus of OpenAI and Google.
5. The Feature Set that Changed the Game
ChatGPT’s launch was not just a new model; it was a new feature set:
- Web Search – The ability to query up‑to‑date information in real time.
- App Integration – Running third‑party applications directly from the chat interface.
- Program Execution – The capacity to run code snippets and return results.
These capabilities turned a simple chatbot into a digital assistant that can browse, compute, and even generate images (via DALL‑E) or video (via Sora). The result was a surge in both consumer and enterprise adoption.
6. Societal Impact and Concerns
The rapid adoption of generative AI has accelerated the AI boom—a period of intense investment and public attention. Yet it has also raised legitimate concerns:
- Displacement of Human Intelligence – Critics worry that advanced LLMs could replace human expertise in fields ranging from journalism to law.
- Plagiarism and Academic Integrity – The ease of producing high‑quality text has made it harder to detect original work.
- Misinformation – Models can generate plausible but false narratives, amplifying the spread of fake news.
OpenAI, Google, and Anthropic have all invested in safety research, but the debate continues over how best to balance innovation with responsibility.
7. Looking Ahead
The trajectory of generative AI suggests a few key trends:
- Continued Model Scaling – GPT‑4.5 and GPT‑4.1 demonstrate that larger models still deliver incremental gains.
- Multimodal Integration – Future releases will likely blend text, image, audio, and video more tightly.
- Regulatory Engagement – Governments and industry groups are beginning to draft guidelines for AI safety and transparency.
- Democratization of Access – APIs and developer playgrounds are making advanced AI available to a broader audience, from hobbyists to large enterprises.
8. Conclusion
From GPT‑3’s 175 billion parameters to GPT‑4.5’s “Orion” codename, the generative AI landscape has evolved at a breakneck pace. OpenAI’s ChatGPT catalyzed a wave of public fascination, while Google’s Gemini and Anthropic’s Claude have kept the competition fierce. As these models become more capable, the conversation around safety, ethics, and societal impact will only grow more urgent. The next few years will likely see generative AI move from a novelty to a foundational technology—one that will shape how we write, compute, and even think.
References
- ChatGPT – https://en.wikipedia.org/wiki/ChatGPT
- GPT‑4 – https://en.wikipedia.org/wiki/GPT-4
- GPT‑4.5 – https://en.wikipedia.org/wiki/GPT-4.5
- OpenAI – https://en.wikipedia.org/wiki/OpenAI
- Gemini (chatbot) – https://en.wikipedia.org/wiki/Gemini_(chatbot)
- GPT‑3 – https://en.wikipedia.org/wiki/GPT-3
- GPT‑4.1 – https://en.wikipedia.org/wiki/GPT-4.1
- Gemini (language model) – https://en.wikipedia.org/wiki/Gemini_(language_model)
- Anthropic – https://en.wikipedia.org/wiki/Anthropic
- Claude (language model) – https://en.wikipedia.org/wiki/Claude_(language_model)
Wrapping up
There we have it, GraphRAG in a very straightforward and easy-to-understand manner. The best ideas often are the simple ones!
Top comments (0)