prvi rag
Browse files- .chainlit/config.toml +84 -0
- .env +2 -0
- Dockerfile +11 -0
- README copy.md +190 -0
- __pycache__/app.cpython-311.pyc +0 -0
- aimakerspace/__init__.py +0 -0
- aimakerspace/__pycache__/__init__.cpython-311.pyc +0 -0
- aimakerspace/__pycache__/text_utils.cpython-311.pyc +0 -0
- aimakerspace/__pycache__/vectordatabase.cpython-311.pyc +0 -0
- aimakerspace/openai_utils/__init__.py +0 -0
- aimakerspace/openai_utils/__pycache__/__init__.cpython-311.pyc +0 -0
- aimakerspace/openai_utils/__pycache__/chatmodel.cpython-311.pyc +0 -0
- aimakerspace/openai_utils/__pycache__/embedding.cpython-311.pyc +0 -0
- aimakerspace/openai_utils/__pycache__/prompts.cpython-311.pyc +0 -0
- aimakerspace/openai_utils/chatmodel.py +27 -0
- aimakerspace/openai_utils/embedding.py +59 -0
- aimakerspace/openai_utils/prompts.py +78 -0
- aimakerspace/rag_utils/__pycache__/raqa.cpython-311.pyc +0 -0
- aimakerspace/rag_utils/raqa.py +50 -0
- aimakerspace/text_utils.py +105 -0
- aimakerspace/vectordatabase.py +81 -0
- app.py +100 -0
- chainlit.md +3 -0
- data/PMarcaBlogs.txt +0 -0
- data/UEFA_European_Championship.pdf +0 -0
- data/UEFA_European_Championship.txt +735 -0
- requirements.txt +7 -0
.chainlit/config.toml
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[project]
|
2 |
+
# Whether to enable telemetry (default: true). No personal data is collected.
|
3 |
+
enable_telemetry = true
|
4 |
+
|
5 |
+
# List of environment variables to be provided by each user to use the app.
|
6 |
+
user_env = []
|
7 |
+
|
8 |
+
# Duration (in seconds) during which the session is saved when the connection is lost
|
9 |
+
session_timeout = 3600
|
10 |
+
|
11 |
+
# Enable third parties caching (e.g LangChain cache)
|
12 |
+
cache = false
|
13 |
+
|
14 |
+
# Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317)
|
15 |
+
# follow_symlink = false
|
16 |
+
|
17 |
+
[features]
|
18 |
+
# Show the prompt playground
|
19 |
+
prompt_playground = true
|
20 |
+
|
21 |
+
# Process and display HTML in messages. This can be a security risk (see https://stackoverflow.com/questions/19603097/why-is-it-dangerous-to-render-user-generated-html-or-javascript)
|
22 |
+
unsafe_allow_html = false
|
23 |
+
|
24 |
+
# Process and display mathematical expressions. This can clash with "$" characters in messages.
|
25 |
+
latex = false
|
26 |
+
|
27 |
+
# Authorize users to upload files with messages
|
28 |
+
multi_modal = true
|
29 |
+
|
30 |
+
# Allows user to use speech to text
|
31 |
+
[features.speech_to_text]
|
32 |
+
enabled = false
|
33 |
+
# See all languages here https://github.com/JamesBrill/react-speech-recognition/blob/HEAD/docs/API.md#language-string
|
34 |
+
# language = "en-US"
|
35 |
+
|
36 |
+
[UI]
|
37 |
+
# Name of the app and chatbot.
|
38 |
+
name = "Chatbot"
|
39 |
+
|
40 |
+
# Show the readme while the conversation is empty.
|
41 |
+
show_readme_as_default = true
|
42 |
+
|
43 |
+
# Description of the app and chatbot. This is used for HTML tags.
|
44 |
+
# description = ""
|
45 |
+
|
46 |
+
# Large size content are by default collapsed for a cleaner ui
|
47 |
+
default_collapse_content = true
|
48 |
+
|
49 |
+
# The default value for the expand messages settings.
|
50 |
+
default_expand_messages = false
|
51 |
+
|
52 |
+
# Hide the chain of thought details from the user in the UI.
|
53 |
+
hide_cot = false
|
54 |
+
|
55 |
+
# Link to your github repo. This will add a github button in the UI's header.
|
56 |
+
# github = ""
|
57 |
+
|
58 |
+
# Specify a CSS file that can be used to customize the user interface.
|
59 |
+
# The CSS file can be served from the public directory or via an external link.
|
60 |
+
# custom_css = "/public/test.css"
|
61 |
+
|
62 |
+
# Override default MUI light theme. (Check theme.ts)
|
63 |
+
[UI.theme.light]
|
64 |
+
#background = "#FAFAFA"
|
65 |
+
#paper = "#FFFFFF"
|
66 |
+
|
67 |
+
[UI.theme.light.primary]
|
68 |
+
#main = "#F80061"
|
69 |
+
#dark = "#980039"
|
70 |
+
#light = "#FFE7EB"
|
71 |
+
|
72 |
+
# Override default MUI dark theme. (Check theme.ts)
|
73 |
+
[UI.theme.dark]
|
74 |
+
#background = "#FAFAFA"
|
75 |
+
#paper = "#FFFFFF"
|
76 |
+
|
77 |
+
[UI.theme.dark.primary]
|
78 |
+
#main = "#F80061"
|
79 |
+
#dark = "#980039"
|
80 |
+
#light = "#FFE7EB"
|
81 |
+
|
82 |
+
|
83 |
+
[meta]
|
84 |
+
generated_by = "0.7.700"
|
.env
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
OPENAI_API_KEY=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
|
2 |
+
WANDB_API_KEY=825feb2d7343df911a0da7fc8775e2a1b15c6e84
|
Dockerfile
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM python:3.9
|
2 |
+
RUN useradd -m -u 1000 user
|
3 |
+
USER user
|
4 |
+
ENV HOME=/home/user \
|
5 |
+
PATH=/home/user/.local/bin:$PATH
|
6 |
+
WORKDIR $HOME/app
|
7 |
+
COPY --chown=user . $HOME/app
|
8 |
+
COPY ./requirements.txt ~/app/requirements.txt
|
9 |
+
RUN pip install -r requirements.txt
|
10 |
+
COPY . .
|
11 |
+
CMD ["chainlit", "run", "app.py", "--port", "7860"]
|
README copy.md
ADDED
@@ -0,0 +1,190 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: BeyondChatGPT Demo
|
3 |
+
emoji: 📉
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: yellow
|
6 |
+
sdk: docker
|
7 |
+
pinned: false
|
8 |
+
app_port: 7860
|
9 |
+
---
|
10 |
+
|
11 |
+
<p align = "center" draggable=”false” ><img src="https://github.com/AI-Maker-Space/LLM-Dev-101/assets/37101144/d1343317-fa2f-41e1-8af1-1dbb18399719"
|
12 |
+
width="200px"
|
13 |
+
height="auto"/>
|
14 |
+
</p>
|
15 |
+
|
16 |
+
|
17 |
+
## <h1 align="center" id="heading">:wave: Welcome to Beyond ChatGPT!!</h1>
|
18 |
+
|
19 |
+
For a step-by-step YouTube video walkthrough, watch this! [Deploying Chainlit app on Hugging Face](https://www.youtube.com/live/pRbbZcL0NMI?si=NAYhMZ_suAY84f06&t=2119)
|
20 |
+
|
21 |
+

|
22 |
+
|
23 |
+
## 🤖 Your First LLM App
|
24 |
+
|
25 |
+
> If you need an introduction to `git`, or information on how to set up API keys for the tools we'll be using in this repository - check out our [Interactive Dev Environment for LLM Development](https://github.com/AI-Maker-Space/Interactive-Dev-Environment-for-LLM-Development/tree/main) which has everything you'd need to get started in this repository!
|
26 |
+
|
27 |
+
In this repository, we'll walk you through the steps to create a Large Language Model (LLM) application using Chainlit, then containerize it using Docker, and finally deploy it on Huggingface Spaces.
|
28 |
+
|
29 |
+
Are you ready? Let's get started!
|
30 |
+
|
31 |
+
<details>
|
32 |
+
<summary>🖥️ Accessing "gpt-3.5-turbo" (ChatGPT) like a developer</summary>
|
33 |
+
|
34 |
+
1. Head to [this notebook](https://colab.research.google.com/drive/1mOzbgf4a2SP5qQj33ZxTz2a01-5eXqk2?usp=sharing) and follow along with the instructions!
|
35 |
+
|
36 |
+
2. Complete the notebook and try out your own system/assistant messages!
|
37 |
+
|
38 |
+
That's it! Head to the next step and start building your application!
|
39 |
+
|
40 |
+
</details>
|
41 |
+
|
42 |
+
|
43 |
+
<details>
|
44 |
+
<summary>🏗️ Building Your First LLM App</summary>
|
45 |
+
|
46 |
+
1. Clone [this](https://github.com/AI-Maker-Space/Beyond-ChatGPT/tree/main) repo.
|
47 |
+
|
48 |
+
``` bash
|
49 |
+
git clone https://github.com/AI-Maker-Space/Beyond-ChatGPT.git
|
50 |
+
```
|
51 |
+
|
52 |
+
2. Navigate inside this repo
|
53 |
+
``` bash
|
54 |
+
cd Beyond-ChatGPT
|
55 |
+
```
|
56 |
+
|
57 |
+
3. Install the packages required for this python envirnoment in `requirements.txt`.
|
58 |
+
``` bash
|
59 |
+
pip install -r requirements.txt
|
60 |
+
```
|
61 |
+
|
62 |
+
4. Open your `.env` file. Replace the `###` in your `.env` file with your OpenAI Key and save the file.
|
63 |
+
``` bash
|
64 |
+
OPENAI_API_KEY=sk-###
|
65 |
+
```
|
66 |
+
|
67 |
+
5. Let's try deploying it locally. Make sure you're in the python environment where you installed Chainlit and OpenAI. Run the app using Chainlit. This may take a minute to run.
|
68 |
+
``` bash
|
69 |
+
chainlit run app.py -w
|
70 |
+
```
|
71 |
+
|
72 |
+
<p align = "center" draggable=”false”>
|
73 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/54bcccf9-12e2-4cef-ab53-585c1e2b0fb5">
|
74 |
+
</p>
|
75 |
+
|
76 |
+
Great work! Let's see if we can interact with our chatbot.
|
77 |
+
|
78 |
+
<p align = "center" draggable=”false”>
|
79 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/854e4435-1dee-438a-9146-7174b39f7c61">
|
80 |
+
</p>
|
81 |
+
|
82 |
+
Awesome! Time to throw it into a docker container and prepare it for shipping!
|
83 |
+
</details>
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
<details>
|
88 |
+
<summary>🐳 Containerizing our App</summary>
|
89 |
+
|
90 |
+
1. Let's build the Docker image. We'll tag our image as `llm-app` using the `-t` parameter. The `.` at the end means we want all of the files in our current directory to be added to our image.
|
91 |
+
|
92 |
+
``` bash
|
93 |
+
docker build -t llm-app .
|
94 |
+
```
|
95 |
+
|
96 |
+
2. Run and test the Docker image locally using the `run` command. The `-p`parameter connects our **host port #** to the left of the `:` to our **container port #** on the right.
|
97 |
+
|
98 |
+
``` bash
|
99 |
+
docker run -p 7860:7860 llm-app
|
100 |
+
```
|
101 |
+
|
102 |
+
3. Visit http://localhost:7860 in your browser to see if the app runs correctly.
|
103 |
+
|
104 |
+
<p align = "center" draggable=”false”>
|
105 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/2c764f25-09a0-431b-8d28-32246e0ca1b7">
|
106 |
+
</p>
|
107 |
+
|
108 |
+
Great! Time to ship!
|
109 |
+
</details>
|
110 |
+
|
111 |
+
|
112 |
+
<details>
|
113 |
+
<summary>🚀 Deploying Your First LLM App</summary>
|
114 |
+
|
115 |
+
1. Let's create a new Huggingface Space. Navigate to [Huggingface](https://huggingface.co) and click on your profile picture on the top right. Then click on `New Space`.
|
116 |
+
|
117 |
+
<p align = "center" draggable=”false”>
|
118 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/f0656408-28b8-4876-9887-8f0c4b882bae">
|
119 |
+
</p>
|
120 |
+
|
121 |
+
2. Setup your space as shown below:
|
122 |
+
|
123 |
+
- Owner: Your username
|
124 |
+
- Space Name: `llm-app`
|
125 |
+
- License: `Openrail`
|
126 |
+
- Select the Space SDK: `Docker`
|
127 |
+
- Docker Template: `Blank`
|
128 |
+
- Space Hardware: `CPU basic - 2 vCPU - 16 GB - Free`
|
129 |
+
- Repo type: `Public`
|
130 |
+
|
131 |
+
<p align = "center" draggable=”false”>
|
132 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/8f16afd1-6b46-4d9f-b642-8fefe355c5c9">
|
133 |
+
</p>
|
134 |
+
|
135 |
+
3. You should see something like this. We're now ready to send our files to our Huggingface Space. After cloning, move your files to this repo and push it along with your docker file. You DO NOT need to create a Dockerfile. Make sure NOT TO push your `.env` file. This should automatically be ignored.
|
136 |
+
|
137 |
+
<p align = "center" draggable=”false”>
|
138 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/cbf366e2-7613-4223-932a-72c67a73f9c6">
|
139 |
+
</p>
|
140 |
+
|
141 |
+
4. After pushing all files, navigate to the settings in the top right to add your OpenAI API key.
|
142 |
+
|
143 |
+
<p align = "center" draggable=”false”>
|
144 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/a1123a6f-abdd-4f76-bea4-39acf9928762">
|
145 |
+
</p>
|
146 |
+
|
147 |
+
5. Scroll down to `Variables and secrets` and click on `New secret` on the top right.
|
148 |
+
|
149 |
+
<p align = "center" draggable=”false”>
|
150 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/a8a4a25d-752b-4036-b572-93381370c2db">
|
151 |
+
</p>
|
152 |
+
|
153 |
+
6. Set the name to `OPENAI_API_KEY` and add your OpenAI key under `Value`. Click save.
|
154 |
+
|
155 |
+
<p align = "center" draggable=”false”>
|
156 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/0a897538-1779-48ff-bcb4-486af30f7a14">
|
157 |
+
</p>
|
158 |
+
|
159 |
+
7. To ensure your key is being used, we recommend you `Restart this Space`.
|
160 |
+
|
161 |
+
<p align = "center" draggable=”false”>
|
162 |
+
<img src="https://github.com/AI-Maker-Space/LLMOps-Dev-101/assets/37101144/fb1d83af-6ebe-4676-8bf5-b6d88f07c583">
|
163 |
+
</p>
|
164 |
+
|
165 |
+
8. Congratulations! You just deployed your first LLM! 🚀🚀🚀 Get on linkedin and post your results and experience! Make sure to tag us at #AIMakerspace !
|
166 |
+
|
167 |
+
Here's a template to get your post started!
|
168 |
+
|
169 |
+
```
|
170 |
+
🚀🎉 Exciting News! 🎉🚀
|
171 |
+
|
172 |
+
🏗️ Today, I'm thrilled to announce that I've successfully built and shipped my first-ever LLM using the powerful combination of Chainlit, Docker, and the OpenAI API! 🖥️
|
173 |
+
|
174 |
+
Check it out 👇
|
175 |
+
[LINK TO APP]
|
176 |
+
|
177 |
+
A big shoutout to the @**AI Makerspace** for all making this possible. Couldn't have done it without the incredible community there. 🤗🙏
|
178 |
+
|
179 |
+
Looking forward to building with the community! 🙌✨ Here's to many more creations ahead! 🥂🎉
|
180 |
+
|
181 |
+
Who else is diving into the world of AI? Let's connect! 🌐💡
|
182 |
+
|
183 |
+
#FirstLLM #Chainlit #Docker #OpenAI #AIMakerspace
|
184 |
+
```
|
185 |
+
|
186 |
+
</details>
|
187 |
+
|
188 |
+
<p></p>
|
189 |
+
|
190 |
+
### That's it for now! And so it begins.... :)
|
__pycache__/app.cpython-311.pyc
ADDED
Binary file (4.45 kB). View file
|
|
aimakerspace/__init__.py
ADDED
File without changes
|
aimakerspace/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (174 Bytes). View file
|
|
aimakerspace/__pycache__/text_utils.cpython-311.pyc
ADDED
Binary file (6.74 kB). View file
|
|
aimakerspace/__pycache__/vectordatabase.cpython-311.pyc
ADDED
Binary file (5.7 kB). View file
|
|
aimakerspace/openai_utils/__init__.py
ADDED
File without changes
|
aimakerspace/openai_utils/__pycache__/__init__.cpython-311.pyc
ADDED
Binary file (187 Bytes). View file
|
|
aimakerspace/openai_utils/__pycache__/chatmodel.cpython-311.pyc
ADDED
Binary file (1.72 kB). View file
|
|
aimakerspace/openai_utils/__pycache__/embedding.cpython-311.pyc
ADDED
Binary file (4.11 kB). View file
|
|
aimakerspace/openai_utils/__pycache__/prompts.cpython-311.pyc
ADDED
Binary file (5.5 kB). View file
|
|
aimakerspace/openai_utils/chatmodel.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from openai import OpenAI
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
import os
|
4 |
+
|
5 |
+
load_dotenv()
|
6 |
+
|
7 |
+
|
8 |
+
class ChatOpenAI:
|
9 |
+
def __init__(self, model_name: str = "gpt-3.5-turbo"):
|
10 |
+
self.model_name = model_name
|
11 |
+
self.openai_api_key = os.getenv("OPENAI_API_KEY")
|
12 |
+
if self.openai_api_key is None:
|
13 |
+
raise ValueError("OPENAI_API_KEY is not set")
|
14 |
+
|
15 |
+
def run(self, messages, text_only: bool = True, **kwargs):
|
16 |
+
if not isinstance(messages, list):
|
17 |
+
raise ValueError("messages must be a list")
|
18 |
+
|
19 |
+
client = OpenAI()
|
20 |
+
response = client.chat.completions.create(
|
21 |
+
model=self.model_name, messages=messages, **kwargs
|
22 |
+
)
|
23 |
+
|
24 |
+
if text_only:
|
25 |
+
return response.choices[0].message.content
|
26 |
+
|
27 |
+
return response
|
aimakerspace/openai_utils/embedding.py
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dotenv import load_dotenv
|
2 |
+
from openai import AsyncOpenAI, OpenAI
|
3 |
+
import openai
|
4 |
+
from typing import List
|
5 |
+
import os
|
6 |
+
import asyncio
|
7 |
+
|
8 |
+
|
9 |
+
class EmbeddingModel:
|
10 |
+
def __init__(self, embeddings_model_name: str = "text-embedding-3-small"):
|
11 |
+
load_dotenv()
|
12 |
+
self.openai_api_key = os.getenv("OPENAI_API_KEY")
|
13 |
+
self.async_client = AsyncOpenAI()
|
14 |
+
self.client = OpenAI()
|
15 |
+
|
16 |
+
if self.openai_api_key is None:
|
17 |
+
raise ValueError(
|
18 |
+
"OPENAI_API_KEY environment variable is not set. Please set it to your OpenAI API key."
|
19 |
+
)
|
20 |
+
openai.api_key = self.openai_api_key
|
21 |
+
self.embeddings_model_name = embeddings_model_name
|
22 |
+
|
23 |
+
async def async_get_embeddings(self, list_of_text: List[str]) -> List[List[float]]:
|
24 |
+
embedding_response = await self.async_client.embeddings.create(
|
25 |
+
input=list_of_text, model=self.embeddings_model_name
|
26 |
+
)
|
27 |
+
|
28 |
+
return [embeddings.embedding for embeddings in embedding_response.data]
|
29 |
+
|
30 |
+
async def async_get_embedding(self, text: str) -> List[float]:
|
31 |
+
embedding = await self.async_client.embeddings.create(
|
32 |
+
input=text, model=self.embeddings_model_name
|
33 |
+
)
|
34 |
+
|
35 |
+
return embedding.data[0].embedding
|
36 |
+
|
37 |
+
def get_embeddings(self, list_of_text: List[str]) -> List[List[float]]:
|
38 |
+
embedding_response = self.client.embeddings.create(
|
39 |
+
input=list_of_text, model=self.embeddings_model_name
|
40 |
+
)
|
41 |
+
|
42 |
+
return [embeddings.embedding for embeddings in embedding_response.data]
|
43 |
+
|
44 |
+
def get_embedding(self, text: str) -> List[float]:
|
45 |
+
embedding = self.client.embeddings.create(
|
46 |
+
input=text, model=self.embeddings_model_name
|
47 |
+
)
|
48 |
+
|
49 |
+
return embedding.data[0].embedding
|
50 |
+
|
51 |
+
|
52 |
+
if __name__ == "__main__":
|
53 |
+
embedding_model = EmbeddingModel()
|
54 |
+
print(asyncio.run(embedding_model.async_get_embedding("Hello, world!")))
|
55 |
+
print(
|
56 |
+
asyncio.run(
|
57 |
+
embedding_model.async_get_embeddings(["Hello, world!", "Goodbye, world!"])
|
58 |
+
)
|
59 |
+
)
|
aimakerspace/openai_utils/prompts.py
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
|
3 |
+
|
4 |
+
class BasePrompt:
|
5 |
+
def __init__(self, prompt):
|
6 |
+
"""
|
7 |
+
Initializes the BasePrompt object with a prompt template.
|
8 |
+
|
9 |
+
:param prompt: A string that can contain placeholders within curly braces
|
10 |
+
"""
|
11 |
+
self.prompt = prompt
|
12 |
+
self._pattern = re.compile(r"\{([^}]+)\}")
|
13 |
+
|
14 |
+
def format_prompt(self, **kwargs):
|
15 |
+
"""
|
16 |
+
Formats the prompt string using the keyword arguments provided.
|
17 |
+
|
18 |
+
:param kwargs: The values to substitute into the prompt string
|
19 |
+
:return: The formatted prompt string
|
20 |
+
"""
|
21 |
+
matches = self._pattern.findall(self.prompt)
|
22 |
+
return self.prompt.format(**{match: kwargs.get(match, "") for match in matches})
|
23 |
+
|
24 |
+
def get_input_variables(self):
|
25 |
+
"""
|
26 |
+
Gets the list of input variable names from the prompt string.
|
27 |
+
|
28 |
+
:return: List of input variable names
|
29 |
+
"""
|
30 |
+
return self._pattern.findall(self.prompt)
|
31 |
+
|
32 |
+
|
33 |
+
class RolePrompt(BasePrompt):
|
34 |
+
def __init__(self, prompt, role: str):
|
35 |
+
"""
|
36 |
+
Initializes the RolePrompt object with a prompt template and a role.
|
37 |
+
|
38 |
+
:param prompt: A string that can contain placeholders within curly braces
|
39 |
+
:param role: The role for the message ('system', 'user', or 'assistant')
|
40 |
+
"""
|
41 |
+
super().__init__(prompt)
|
42 |
+
self.role = role
|
43 |
+
|
44 |
+
def create_message(self, format=True, **kwargs):
|
45 |
+
"""
|
46 |
+
Creates a message dictionary with a role and a formatted message.
|
47 |
+
|
48 |
+
:param kwargs: The values to substitute into the prompt string
|
49 |
+
:return: Dictionary containing the role and the formatted message
|
50 |
+
"""
|
51 |
+
if format:
|
52 |
+
return {"role": self.role, "content": self.format_prompt(**kwargs)}
|
53 |
+
|
54 |
+
return {"role": self.role, "content": self.prompt}
|
55 |
+
|
56 |
+
|
57 |
+
class SystemRolePrompt(RolePrompt):
|
58 |
+
def __init__(self, prompt: str):
|
59 |
+
super().__init__(prompt, "system")
|
60 |
+
|
61 |
+
|
62 |
+
class UserRolePrompt(RolePrompt):
|
63 |
+
def __init__(self, prompt: str):
|
64 |
+
super().__init__(prompt, "user")
|
65 |
+
|
66 |
+
|
67 |
+
class AssistantRolePrompt(RolePrompt):
|
68 |
+
def __init__(self, prompt: str):
|
69 |
+
super().__init__(prompt, "assistant")
|
70 |
+
|
71 |
+
|
72 |
+
if __name__ == "__main__":
|
73 |
+
prompt = BasePrompt("Hello {name}, you are {age} years old")
|
74 |
+
print(prompt.format_prompt(name="John", age=30))
|
75 |
+
|
76 |
+
prompt = SystemRolePrompt("Hello {name}, you are {age} years old")
|
77 |
+
print(prompt.create_message(name="John", age=30))
|
78 |
+
print(prompt.get_input_variables())
|
aimakerspace/rag_utils/__pycache__/raqa.cpython-311.pyc
ADDED
Binary file (2.53 kB). View file
|
|
aimakerspace/rag_utils/raqa.py
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from aimakerspace.text_utils import TextFileLoader, CharacterTextSplitter
|
2 |
+
from aimakerspace.vectordatabase import VectorDatabase
|
3 |
+
import asyncio
|
4 |
+
|
5 |
+
from aimakerspace.openai_utils.prompts import (
|
6 |
+
UserRolePrompt,
|
7 |
+
SystemRolePrompt,
|
8 |
+
AssistantRolePrompt,
|
9 |
+
)
|
10 |
+
|
11 |
+
from aimakerspace.openai_utils.chatmodel import ChatOpenAI
|
12 |
+
|
13 |
+
RAG_PROMPT_TEMPLATE = """ \
|
14 |
+
Use the provided context to answer the user's query.
|
15 |
+
|
16 |
+
You may not answer the user's query unless there is specific context in the following text.
|
17 |
+
|
18 |
+
If you do not know the answer, or cannot answer, please respond with "I don't know".
|
19 |
+
"""
|
20 |
+
|
21 |
+
rag_prompt = SystemRolePrompt(RAG_PROMPT_TEMPLATE)
|
22 |
+
|
23 |
+
USER_PROMPT_TEMPLATE = """ \
|
24 |
+
Context:
|
25 |
+
{context}
|
26 |
+
|
27 |
+
User Query:
|
28 |
+
{user_query}
|
29 |
+
"""
|
30 |
+
|
31 |
+
|
32 |
+
user_prompt = UserRolePrompt(USER_PROMPT_TEMPLATE)
|
33 |
+
|
34 |
+
class RetrievalAugmentedQAPipeline:
|
35 |
+
def __init__(self, llm: ChatOpenAI(), vector_db_retriever: VectorDatabase) -> None:
|
36 |
+
self.llm = llm
|
37 |
+
self.vector_db_retriever = vector_db_retriever
|
38 |
+
|
39 |
+
def run_pipeline(self, user_query: str) -> str:
|
40 |
+
context_list = self.vector_db_retriever.search_by_text(user_query, k=4)
|
41 |
+
|
42 |
+
context_prompt = ""
|
43 |
+
for context in context_list:
|
44 |
+
context_prompt += context[0] + "\n"
|
45 |
+
|
46 |
+
formatted_system_prompt = rag_prompt.create_message()
|
47 |
+
|
48 |
+
formatted_user_prompt = user_prompt.create_message(user_query=user_query, context=context_prompt)
|
49 |
+
|
50 |
+
return {"response" : self.llm.run([formatted_user_prompt, formatted_system_prompt]), "context" : context_list}
|
aimakerspace/text_utils.py
ADDED
@@ -0,0 +1,105 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
from typing import List
|
3 |
+
from pypdf import PdfReader
|
4 |
+
|
5 |
+
|
6 |
+
class TextFileLoader:
|
7 |
+
def __init__(self, path: str, encoding: str = "utf-8"):
|
8 |
+
self.documents = []
|
9 |
+
self.path = path
|
10 |
+
self.encoding = encoding
|
11 |
+
|
12 |
+
# transform pdf to text and return text
|
13 |
+
|
14 |
+
def load_pdf_file(self):
|
15 |
+
# read from path
|
16 |
+
read_pdf = PdfReader(self.path)
|
17 |
+
|
18 |
+
# extract text for all the pages
|
19 |
+
text_list = [i.extract_text() for i in read_pdf.pages]
|
20 |
+
txt_document = "\n\n".join(text_list)
|
21 |
+
|
22 |
+
# name the file
|
23 |
+
output_name = "{}.txt".format(self.path[:-4])
|
24 |
+
|
25 |
+
# write file
|
26 |
+
f = open(output_name, "w")
|
27 |
+
f.write(txt_document)
|
28 |
+
f.close()
|
29 |
+
|
30 |
+
return output_name
|
31 |
+
|
32 |
+
def load(self):
|
33 |
+
if self.path.endswith((".pdf","")):
|
34 |
+
self.path=self.load_pdf_file()
|
35 |
+
|
36 |
+
if os.path.isdir(self.path):
|
37 |
+
self.load_directory()
|
38 |
+
elif os.path.isfile(self.path) and self.path.endswith(".txt"):
|
39 |
+
self.load_file()
|
40 |
+
self.load_file()
|
41 |
+
else:
|
42 |
+
raise ValueError(
|
43 |
+
"Provided path is neither a valid directory nor a .txt file."
|
44 |
+
)
|
45 |
+
|
46 |
+
def load_file(self):
|
47 |
+
with open(self.path, "r", encoding=self.encoding) as f:
|
48 |
+
self.documents.append(f.read())
|
49 |
+
|
50 |
+
def load_directory(self):
|
51 |
+
for root, _, files in os.walk(self.path):
|
52 |
+
for file in files:
|
53 |
+
if file.endswith(".pdf"):
|
54 |
+
file=self.load_pdf_file()
|
55 |
+
|
56 |
+
if file.endswith(".txt"):
|
57 |
+
with open(
|
58 |
+
os.path.join(root, file), "r", encoding=self.encoding
|
59 |
+
) as f:
|
60 |
+
self.documents.append(f.read())
|
61 |
+
|
62 |
+
def load_documents(self):
|
63 |
+
self.load()
|
64 |
+
return self.documents
|
65 |
+
|
66 |
+
|
67 |
+
class CharacterTextSplitter:
|
68 |
+
def __init__(
|
69 |
+
self,
|
70 |
+
chunk_size: int = 1000,
|
71 |
+
chunk_overlap: int = 200,
|
72 |
+
):
|
73 |
+
assert (
|
74 |
+
chunk_size > chunk_overlap
|
75 |
+
), "Chunk size must be greater than chunk overlap"
|
76 |
+
|
77 |
+
self.chunk_size = chunk_size
|
78 |
+
self.chunk_overlap = chunk_overlap
|
79 |
+
|
80 |
+
def split(self, text: str) -> List[str]:
|
81 |
+
chunks = []
|
82 |
+
for i in range(0, len(text), self.chunk_size - self.chunk_overlap):
|
83 |
+
chunks.append(text[i : i + self.chunk_size])
|
84 |
+
return chunks
|
85 |
+
|
86 |
+
def split_texts(self, texts: List[str]) -> List[str]:
|
87 |
+
chunks = []
|
88 |
+
for text in texts:
|
89 |
+
chunks.extend(self.split(text))
|
90 |
+
return chunks
|
91 |
+
|
92 |
+
|
93 |
+
if __name__ == "__main__":
|
94 |
+
loader = TextFileLoader("data/KingLear.txt")
|
95 |
+
loader.load()
|
96 |
+
splitter = CharacterTextSplitter()
|
97 |
+
chunks = splitter.split_texts(loader.documents)
|
98 |
+
print(len(chunks))
|
99 |
+
print(chunks[0])
|
100 |
+
print("--------")
|
101 |
+
print(chunks[1])
|
102 |
+
print("--------")
|
103 |
+
print(chunks[-2])
|
104 |
+
print("--------")
|
105 |
+
print(chunks[-1])
|
aimakerspace/vectordatabase.py
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
from collections import defaultdict
|
3 |
+
from typing import List, Tuple, Callable
|
4 |
+
from aimakerspace.openai_utils.embedding import EmbeddingModel
|
5 |
+
import asyncio
|
6 |
+
|
7 |
+
|
8 |
+
def cosine_similarity(vector_a: np.array, vector_b: np.array) -> float:
|
9 |
+
"""Computes the cosine similarity between two vectors."""
|
10 |
+
dot_product = np.dot(vector_a, vector_b)
|
11 |
+
norm_a = np.linalg.norm(vector_a)
|
12 |
+
norm_b = np.linalg.norm(vector_b)
|
13 |
+
return dot_product / (norm_a * norm_b)
|
14 |
+
|
15 |
+
|
16 |
+
class VectorDatabase:
|
17 |
+
def __init__(self, embedding_model: EmbeddingModel = None):
|
18 |
+
self.vectors = defaultdict(np.array)
|
19 |
+
self.embedding_model = embedding_model or EmbeddingModel()
|
20 |
+
|
21 |
+
def insert(self, key: str, vector: np.array) -> None:
|
22 |
+
self.vectors[key] = vector
|
23 |
+
|
24 |
+
def search(
|
25 |
+
self,
|
26 |
+
query_vector: np.array,
|
27 |
+
k: int,
|
28 |
+
distance_measure: Callable = cosine_similarity,
|
29 |
+
) -> List[Tuple[str, float]]:
|
30 |
+
scores = [
|
31 |
+
(key, distance_measure(query_vector, vector))
|
32 |
+
for key, vector in self.vectors.items()
|
33 |
+
]
|
34 |
+
return sorted(scores, key=lambda x: x[1], reverse=True)[:k]
|
35 |
+
|
36 |
+
def search_by_text(
|
37 |
+
self,
|
38 |
+
query_text: str,
|
39 |
+
k: int,
|
40 |
+
distance_measure: Callable = cosine_similarity,
|
41 |
+
return_as_text: bool = False,
|
42 |
+
) -> List[Tuple[str, float]]:
|
43 |
+
query_vector = self.embedding_model.get_embedding(query_text)
|
44 |
+
results = self.search(query_vector, k, distance_measure)
|
45 |
+
return [result[0] for result in results] if return_as_text else results
|
46 |
+
|
47 |
+
def retrieve_from_key(self, key: str) -> np.array:
|
48 |
+
return self.vectors.get(key, None)
|
49 |
+
|
50 |
+
async def abuild_from_list(self, list_of_text: List[str]) -> "VectorDatabase":
|
51 |
+
embeddings = await self.embedding_model.async_get_embeddings(list_of_text)
|
52 |
+
for text, embedding in zip(list_of_text, embeddings):
|
53 |
+
self.insert(text, np.array(embedding))
|
54 |
+
return self
|
55 |
+
|
56 |
+
|
57 |
+
if __name__ == "__main__":
|
58 |
+
list_of_text = [
|
59 |
+
"I like to eat broccoli and bananas.",
|
60 |
+
"I ate a banana and spinach smoothie for breakfast.",
|
61 |
+
"Chinchillas and kittens are cute.",
|
62 |
+
"My sister adopted a kitten yesterday.",
|
63 |
+
"Look at this cute hamster munching on a piece of broccoli.",
|
64 |
+
]
|
65 |
+
|
66 |
+
vector_db = VectorDatabase()
|
67 |
+
vector_db = asyncio.run(vector_db.abuild_from_list(list_of_text))
|
68 |
+
k = 2
|
69 |
+
|
70 |
+
searched_vector = vector_db.search_by_text("I think fruit is awesome!", k=k)
|
71 |
+
print(f"Closest {k} vector(s):", searched_vector)
|
72 |
+
|
73 |
+
retrieved_vector = vector_db.retrieve_from_key(
|
74 |
+
"I like to eat broccoli and bananas."
|
75 |
+
)
|
76 |
+
print("Retrieved vector:", retrieved_vector)
|
77 |
+
|
78 |
+
relevant_texts = vector_db.search_by_text(
|
79 |
+
"I think fruit is awesome!", k=k, return_as_text=True
|
80 |
+
)
|
81 |
+
print(f"Closest {k} text(s):", relevant_texts)
|
app.py
ADDED
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# You can find this code for Chainlit python streaming here (https://docs.chainlit.io/concepts/streaming/python)
|
2 |
+
|
3 |
+
# OpenAI Chat completion
|
4 |
+
import os
|
5 |
+
from openai import AsyncOpenAI # importing openai for API usage
|
6 |
+
import chainlit as cl # importing chainlit for our app
|
7 |
+
from chainlit.prompt import Prompt, PromptMessage # importing prompt tools
|
8 |
+
#from chainlit.playground.providers import ChatOpenAI # importing ChatOpenAI tools
|
9 |
+
from aimakerspace.openai_utils.chatmodel import ChatOpenAI
|
10 |
+
from dotenv import load_dotenv
|
11 |
+
from chainlit.types import AskFileResponse
|
12 |
+
|
13 |
+
from aimakerspace.text_utils import TextFileLoader, CharacterTextSplitter
|
14 |
+
from aimakerspace.vectordatabase import VectorDatabase
|
15 |
+
import asyncio
|
16 |
+
from aimakerspace.rag_utils.raqa import RetrievalAugmentedQAPipeline
|
17 |
+
|
18 |
+
load_dotenv()
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
# ChatOpenAI Templates
|
24 |
+
system_template = """You are a helpful assistant who always speaks in a pleasant tone!
|
25 |
+
"""
|
26 |
+
|
27 |
+
user_template = """{input}
|
28 |
+
Think through your response step by step.
|
29 |
+
"""
|
30 |
+
|
31 |
+
def transform_file(file: AskFileResponse):
|
32 |
+
|
33 |
+
import tempfile
|
34 |
+
|
35 |
+
with tempfile.NamedTemporaryFile(mode="w", delete=False) as tempfile:
|
36 |
+
with open(tempfile.name, "wb") as f:
|
37 |
+
f.write(file.content)
|
38 |
+
# load the file
|
39 |
+
|
40 |
+
print(tempfile.name)
|
41 |
+
text_loader_pdf = TextFileLoader(tempfile.name)
|
42 |
+
documents = text_loader_pdf.load_documents()
|
43 |
+
|
44 |
+
text_splitter = CharacterTextSplitter()
|
45 |
+
split_documents = text_splitter.split_texts(documents)
|
46 |
+
|
47 |
+
return split_documents
|
48 |
+
|
49 |
+
|
50 |
+
@cl.on_chat_start # marks a function that will be executed at the start of a user session
|
51 |
+
async def start_chat():
|
52 |
+
files = None
|
53 |
+
|
54 |
+
while files == None:
|
55 |
+
files = await cl.AskFileMessage(
|
56 |
+
content="Please upload a PDF file to begin!",
|
57 |
+
accept=["application/pdf"],
|
58 |
+
max_size_mb=20,
|
59 |
+
timeout=180,
|
60 |
+
).send()
|
61 |
+
|
62 |
+
file = files[0]
|
63 |
+
|
64 |
+
msg = cl.Message(
|
65 |
+
content=f"Processing `{file.name}`...", disable_human_feedback=True
|
66 |
+
)
|
67 |
+
await msg.send()
|
68 |
+
|
69 |
+
# load the file
|
70 |
+
documents = transform_file(file)
|
71 |
+
|
72 |
+
vector_uefa_db = VectorDatabase()
|
73 |
+
vector_uefa_db = asyncio.run(vector_uefa_db.abuild_from_list(documents))
|
74 |
+
|
75 |
+
retrieval_augmented_qa_pipeline = RetrievalAugmentedQAPipeline(
|
76 |
+
vector_db_retriever=vector_uefa_db,
|
77 |
+
llm=ChatOpenAI()
|
78 |
+
)
|
79 |
+
|
80 |
+
|
81 |
+
# Let the user know that the system is ready
|
82 |
+
msg.content = f"Processing `{file.name}` done. You can now ask questions!"
|
83 |
+
await msg.update()
|
84 |
+
|
85 |
+
|
86 |
+
cl.user_session.set("chain", retrieval_augmented_qa_pipeline)
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
@cl.on_message # marks a function that should be run each time the chatbot receives a message from a user
|
93 |
+
async def main(message: cl.Message):
|
94 |
+
chain = cl.user_session.get("chain")
|
95 |
+
|
96 |
+
resp = chain.run_pipeline(message.content)
|
97 |
+
|
98 |
+
msg = cl.Message(content=resp["response"])
|
99 |
+
|
100 |
+
await msg.send()
|
chainlit.md
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
# Beyond ChatGPT
|
2 |
+
|
3 |
+
This Chainlit app was created following instructions from [this repository!](https://github.com/AI-Maker-Space/Beyond-ChatGPT)
|
data/PMarcaBlogs.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
data/UEFA_European_Championship.pdf
ADDED
Binary file (676 kB). View file
|
|
data/UEFA_European_Championship.txt
ADDED
@@ -0,0 +1,735 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
UEFA European
|
2 |
+
Championship
|
3 |
+
The UEFA European Championship
|
4 |
+
trophy
|
5 |
+
Organising
|
6 |
+
bodyUEFA
|
7 |
+
Founded 1958
|
8 |
+
Region Europe
|
9 |
+
Number of
|
10 |
+
teams24 (finals)
|
11 |
+
55 (eligible to enter
|
12 |
+
qualification)
|
13 |
+
Qualifier forCONMEBOL–UEFA
|
14 |
+
Cup of Champions
|
15 |
+
Current
|
16 |
+
champions
|
17 |
+
Italy (2nd title)
|
18 |
+
Most
|
19 |
+
successful
|
20 |
+
team(s)
|
21 |
+
Germany
|
22 |
+
Spain
|
23 |
+
(3 titles each)
|
24 |
+
Website uefa.com/euro2024
|
25 |
+
(https://www.uefa.co
|
26 |
+
m/euro2024)
|
27 |
+
UEFA Euro 2024
|
28 |
+
UEFA European Championship
|
29 |
+
The UEFA European Football Championship,[1] less formally the European Championship
|
30 |
+
and informally the Euros,[2][3] is the primary association football tournament organised by the
|
31 |
+
Union of European Football Associations (UEFA). The competition is contested by UEFA
|
32 |
+
members' senior men's national teams, determining the continental champion of Europe.[4][5] It is
|
33 |
+
the second-most watched football tournament in the world after the FIFA World Cup; the Euro
|
34 |
+
2016 final was watched by a global audience of around 600 million.[6] The competition has been
|
35 |
+
held every four years since 1960 ,[7][8][9] except for 2020 , when it was postpone d until 2021 due
|
36 |
+
to the COVID-19 pandemic in Europe, but kept the name Euro 2020. Scheduled to be in the
|
37 |
+
even-numbered year between FIFA World Cup tournaments, it was originally called the
|
38 |
+
European Nations' Cup before changing to its current name in 1968 . Since 1996, the
|
39 |
+
individual events have been branded as "UEFA Euro [year]".
|
40 |
+
Before entering the tournament, all teams other than the host nations (which qualify
|
41 |
+
automatically) compete in a qualifying process. Until 2016, the championship winners could
|
42 |
+
compete in the following year's FIFA Confederations Cup, but were not obliged to do so.[10]
|
43 |
+
From the 2020 edition onwards, the winner competes in the CONMEBOL–UEFA Cup of
|
44 |
+
Champions.
|
45 |
+
The sixteen European Championship tournaments have been won by ten national teams:
|
46 |
+
Germany and Spain have each won three titles, Italy and France have won two titles, and the
|
47 |
+
Soviet Union, Czechoslovakia, the Netherlands, Denmark, Greece and Portugal have won one
|
48 |
+
title each. To date, Spain is the only team to have won consecutive titles, doing so in 2008 and
|
49 |
+
2012.
|
50 |
+
The most recent championship, held across Europe in 2021 (postpone d from 2020 due to the
|
51 |
+
COVID-19 pandemic), was won by Italy, who lifted their second European title after beating
|
52 |
+
England in the final at Wembley Stadium in London on penalties.[11][12]
|
53 |
+
Regional tournaments for national teams existed before the advent of a truly pan-European
|
54 |
+
competition. Starting in 1883, the British Home Championship was an annua l competition
|
55 |
+
contested between the United Kingdom 's four national teams, England, Scotland, Wales, and
|
56 |
+
Ireland. Until these national teams entered the FIFA World Cup in 1950 , it was the most
|
57 |
+
important international tournament these nations competed in. Similarly, from 1927 until 1960,
|
58 |
+
the Central European International Cup was held six times. It brought together the national teams
|
59 |
+
of Austria, Hunga ry, Italy, Czechoslovakia, Switzerland, and Yugoslavia. The idea for a pan-
|
60 |
+
European football tournament was first proposed by the French Football Federation's secretary-
|
61 |
+
general Henri Delaunay in 1927, but it was not until 1958 that the tournament was started, three
|
62 |
+
years after Delaunay's death.[13] In honou r of Delaunay, the trophy awarded to the champions is named after him.[14] The 1960
|
63 |
+
tournament, held in France, had four teams competing in the finals out of 17 that entered the competition.[15] It was won by the Soviet
|
64 |
+
Union, beating Yugos lavia 2–1 in a tense final in Paris.[16] Spain withdrew from its quarter-final match against the Soviet Union because
|
65 |
+
of two political protests.[17] Of the 17 teams that entered the qualifying tournament, notable absentees were England, the Netherlands,
|
66 |
+
West Germany and Italy.[18]
|
67 |
+
Spain held the next tournament in 1964 , which saw an increase in entries to the qualification tournament, with 29 entering;[19] West
|
68 |
+
Germany was a notable absentee once again and Greece withdrew after being drawn against Albania, with whom they were still at
|
69 |
+
war.[20] The hosts beat the title holders, the Soviet Union, 2–1 a t the Santiago B ernabéu Stadium in Madrid.[21]
|
70 |
+
The tournament format stayed the same for the 1968 tournament, hosted and won by Italy.[22][23] For the first and only time, a match was
|
71 |
+
decided on a coin toss (the semi-final between Italy and the Soviet Union)[24] and the final went to a replay, after the match against
|
72 |
+
Yugoslavia finished 1–1.[25] Italy won the replay 2–0.[26] More teams entered this tournament (31), a testament to its burgeoningHistory
|
73 |
+
Beginnings
|
74 |
+
|
75 |
+
Ruud Gullit and the Netherlands
|
76 |
+
team celebrating their victory in 1988popul arity.[27]
|
77 |
+
Belgium hosted the 1972 tournament, which West Germany won, beating the Soviet Union 3–0 in the final, with goals coming from
|
78 |
+
Gerd Müller (twice) and Herbert Wimmer at the Heysel Stadium in Brussels.[28] This tournament would provide a taste of things to come,
|
79 |
+
as the German side contained many of the key members of the 1974 F IFA World Cup-winning team.[29][30]
|
80 |
+
The 1976 tournament in Yugoslavia was the last in which only four teams took part in the final tournament, and the last in which the hosts
|
81 |
+
had to qualify. Czechoslovakia beat West Germany in the newly introduc ed penalty shootout. After seven successful conve rsions, Uli
|
82 |
+
Hoeneß missed, leaving Czechoslovakian Antonín Panenka with the oppor tunity to score and win the tournament. An "audacious"
|
83 |
+
chipped shot,[31] described by UEFA as "perhaps the most famous spot kick of all time" secured the victory as Czechoslovakia won 5–3
|
84 |
+
on pe nalties.[32]
|
85 |
+
The competition was expanded to eight teams in the 1980 tournament, again hosted by Italy. It involved a group stage, with the winners
|
86 |
+
of the groups going on to contest the final, and the runne rs-up playing in the third place play-off.[33] West Germany won their second
|
87 |
+
European title by beating Belgium 2–1, with two goals scored by Horst Hrubesch at the Stadio Olimpico in Rome.[34] Horst Hrubesch
|
88 |
+
scored early in the first half before René Vandereycken equalised for Belgium with a penalty in the second half. With two minutes
|
89 |
+
remaining, H rubesch headed the winner for West Germany from a Karl-Heinz Rummenigge corner.[35]
|
90 |
+
France won their first major title at home in the 1984 tournament, with their captain Michel Platini scoring 9 goals in just 5 games,
|
91 |
+
including the opening goal in the final, in which they beat Spain 2–0.[36][37] The format also changed, with the top two teams in each
|
92 |
+
group going through to a semi-final stage, instead of the winners of each group going straight into the final. The third place play-off was
|
93 |
+
also abolished. The losing teams from the semi-finals win the bronze medal. [38]
|
94 |
+
West Germany hosted UEFA Euro 1988 , but lost 2–1 to the Netherlands, their traditional rivals,
|
95 |
+
in the semi-finals, which sparked vigorous celebrations in the Netherlands.[39][40] The
|
96 |
+
Netherlands went on to win the tournament in a rematch of their first game of the group stage,
|
97 |
+
beating the Soviet Union 2–0 at the Olympia Stadion in Munich.[41] Marco van Basten scored the
|
98 |
+
second goal, a volley over the keeper from the right wing which is often considered one of the
|
99 |
+
best goals ever scored.[42]
|
100 |
+
UEFA Euro 1992 was held in Sweden, and was won by Denmark, who were only in the finals
|
101 |
+
after UN sanctions prevented Yugoslavia's participation as some of the states constituting the
|
102 |
+
Socialist Federal Republic of Yugoslavia were at war with each other.[43][44] The Danes beat
|
103 |
+
holders the Netherlands on penalties in the semi-finals,[45] then defeated world champion
|
104 |
+
Germany 2–0.[46] This was the first tournament in which a unified Germany took part and also the first major tournament to have the
|
105 |
+
players' names printed on t heir backs.
|
106 |
+
England hosted UEFA Euro 1996 , the first tournament to use the nomenclature "Euro [year]" and would see the number of teams taking
|
107 |
+
part doubl e to 16.[47] The hosts, in a replay of the 1990 FIFA World Cup semi-final, were knoc ked out on penalties by Germany.[48] The
|
108 |
+
surprise team of the tournament was the newly formed Czech Republic, participating on its first international competition following the
|
109 |
+
dissolution of Czechoslovakia, which reached the final after beating Portugal and France in the knoc kout stage. Germany would go on to
|
110 |
+
win the final 2–1 thanks to the first golden goal ever in a major tournament, scored by Oliver Bierhoff five minutes into extra time.[49][50]
|
111 |
+
This was Germany's first title as a unified nation.
|
112 |
+
UEFA Euro 2000 was the first tournament to be held by two countries, in the Netherlands and Belgium.[51] France, the reigning World
|
113 |
+
Cup champions, were favoured to win, and they lived up to expectations when they beat Italy 2–1 after extra time, having come from
|
114 |
+
being 1–0 down: Sylvain Wiltord equalised in the last minute of regular time and David Trezeguet scored the winning golden goal in
|
115 |
+
extra time.[52]
|
116 |
+
UEFA Euro 2004 , like 1992, produc ed an upset: Greece, who had only qualified for one World Cup (1994 ) and one European
|
117 |
+
Championship (1980 ) before, beat hosts Portugal 1–0 in the final (after having also beaten them in the opening game) with a goal scored
|
118 |
+
by Angelos Charisteas in the 57th minute to win a tournament that they had been given odds of 150–1 to win before it began[53] (being
|
119 |
+
the second least likely team to have any success after Latvia). On their way to the Final, they also beat holders France[54] as well as the
|
120 |
+
Czech Republic with a silver goal,[55][56] a rule which replaced the previous golden goal in 2003, before being abolished itself shortly
|
121 |
+
after this tournament.Expansion to 8 teams
|
122 |
+
Expansion to 16 teams
|
123 |
+
|
124 |
+
The UEFA Euro 2004 opening
|
125 |
+
ceremony in Portugal.The 2008 tournament, hosted by Austria and Switzerland, marked the second time that two
|
126 |
+
nations co-hosted and the first edition where the new trophy was awarded.[57] It commenced on 7
|
127 |
+
June and finished on 29 June.[58] The final between Germany and Spain was held at the Ernst
|
128 |
+
Happel Stadion in Vienna.[59] Spain defeated Germany 1–0, with a goal scored by Fernando
|
129 |
+
Torres in the 33rd minute, sparking much celebration across the country.[60] This was their first
|
130 |
+
title since the 1964 tournament. Spain were the highest scoring team with 12 goals scored and
|
131 |
+
David Villa finished as the top scorer with four goals. Xavi was awarded the player of the
|
132 |
+
tournament, and ni ne Spanish players were picked for the team of the tournament.
|
133 |
+
The UEFA Euro 2012 tournament was co-hosted by Poland and Ukraine.[61] Spain defeated Italy
|
134 |
+
4–0 in the Final, thus becoming the first nation to defend a European Championship title, as well
|
135 |
+
as the first European team to win three consecutive major tournaments.[62] In scoring the third
|
136 |
+
goal of the final, Torres became the first player to score in two European Championship finals. He was equal top scorer for the
|
137 |
+
tournament with three goals in total, along with Mario Balotelli, Alan Dzagoev, Mario Gómez, Mario Mandžukić, and Cristiano Ronaldo,
|
138 |
+
despite only being used as a substitute player. The tournament was otherwise notable for having the most headed goals in a Euro
|
139 |
+
tournament (26 out of 76 goals in total); a disallowed goal in the England versus Ukraine group game which replays showed had crossed
|
140 |
+
the goal line, and which prompted President of FIFA Sepp Blatter to tweet, "GLT (Goal-line technology) is no longe r an alternative but a
|
141 |
+
necessity",[63] thus reversing hi s long-held reluctance to embrace such technology; and some crowd violence in group ga mes.
|
142 |
+
In 2007, the Football Association of Ireland and Scottish Football Association proposed the expansion of the tournament, which was later
|
143 |
+
confirmed by the UEFA Executive Committee in September 2008.[64][65] Out of the 54 member associations of UEFA, only three,
|
144 |
+
including England and Germany, oppos ed the expansion.[66] On 28 May 2010, UEFA announc ed that UEFA Euro 2016 would be
|
145 |
+
hosted by France. France beat bids of Turkey (7–6 in voting in the second voting round) and Italy, which had the fewest votes in the first
|
146 |
+
voting round.[67] Euro 2016 was the first to have 24 teams in the finals.[68] This was the third time France have hosted the competition.
|
147 |
+
Portugal, which qualified for the knoc k-out phase despite finishing third in its group, went on to win the championship by defeating
|
148 |
+
heavily favoured host team France 1–0 in the Final, thanks to a goal from Eder in the 109th minute. Cristiano Ronaldo, Portugal's world-
|
149 |
+
renowned striker, came out of the game due to injury in the 25th minute. This was the first time Portugal won a major tournament.
|
150 |
+
For the 2020 tournament, three bids were proposed, including a bid from Turkey,[69] a joint bid from the Republic of Ireland, Scotland
|
151 |
+
and Wales,[70] and a joint bid from Georgia and Azerbaijan.[71] In December 2012, however, UEFA announc ed that the 2020 tournament
|
152 |
+
would be hosted in several cities in various countries across Europe, with the semi-finals and final being played in London.[72][73] The
|
153 |
+
venues were selected and announc ed by UEFA on 19 September 2014.[74] However, Brussels was removed as a host city on 7
|
154 |
+
December 2017 due to delays with the building of the Eurostadium.[75] On 17 March 2020, UEFA announc ed that Euro 2020 would be
|
155 |
+
delayed by a year due to the COVID-19 pandemic in Europe, and proposed it take place from 11 June to 11 July 2021. The competition
|
156 |
+
was postpone d in order to reduce pressure on the public services in affected countries and to provide space in the calendar for the
|
157 |
+
completion of domestic leagues that had been suspended.[76] Before the Euro 2020, Dublin was also removed as one of the host cities
|
158 |
+
due to its inability to guarantee spectators to the stadium, while Bilbao was replaced by Seville for the same reason.[77][78] In the Final,
|
159 |
+
Italy defeated maiden finalists England 3–2 on penalties, after the game was tied 1–1 after extra time, to win their second European
|
160 |
+
Championship.[79]
|
161 |
+
The Henri Delaunay Trophy , which is awarded to the winner of the European Championship,[80] is named in honour of Henri Delaunay,
|
162 |
+
the first General Secretary of UEFA, who came up with the idea of a European championship but died five years before the first
|
163 |
+
tournament in 1960. His son Pierre was in charge of creating the trophy .[81] Since the first tournament it has been awarded to the winning
|
164 |
+
team for them to keep for four years, until the next tournament. This trophy bore the words Coupe d'Europe ("European Cup"), Coupe
|
165 |
+
Henri Delaunay ("Henri Delaunay Cup"), and Championnat d'Europe ("European Championship") on the front and a juggling boy on
|
166 |
+
the back.
|
167 |
+
For the 2008 tournament, the Henri Delaunay Trophy was remodelled to make it larger, as the old trophy was overshadowed by UEFA's
|
168 |
+
other trophies such as the new European Champion Clubs' Cup. The new trophy , which is made of sterling silver, now weighs 8
|
169 |
+
kilograms (18 lb) and is 60 centimetres (24 in) tall, being 2 kilograms (4.4 lb) heavier and 18 centimetres (7.1 in) longe r than the old one.
|
170 |
+
The marble plinth that was serving as base was removed. The new silver base of the trophy had to be enlarged to make it stable. The
|
171 |
+
names of the winning countries that had appeared on the plaques glued to the plinth are now engraved on the back of the trophy ,[82]
|
172 |
+
unde r the word Coupe Henri Delaunay and are written in English rather than French its predecessor had. The 1972 and 1980 winning
|
173 |
+
country, West Germany, is written as just Germany. Since 2016, t he juggling boy w as returned on t he trophy' s back.Expansion to 24 teams
|
174 |
+
Trophy
|
175 |
+
|
176 |
+
The trophy on display in 2021The players and coaches of the winning team and the runne r-up team are awarded gold and silver
|
177 |
+
medals, respectively. Each association that competes in the final tournament receives a
|
178 |
+
commemorative plaque. Each time the team losing semi-finalist, as well as each finalist, receive a
|
179 |
+
dedicated plaque. Though there is no longe r a third place play-off, UEFA decided in the 2008 edition
|
180 |
+
to award the semi-final losers (Turkey and Russia) bronze medals for the first time,[83] and did the
|
181 |
+
same in the 2012 edition when Germany and Portugal received bronze medals.[84] However, UEFA
|
182 |
+
decided that losing semi-finalists would no longe r receive medals from the 2016 edition onwards.[85]
|
183 |
+
Bronze medals were previously awarded for winners of the third place play-off, the last of which
|
184 |
+
was held in 1980.[86]
|
185 |
+
Before 1980, only four teams qualified for the final tournament. From 1980, eight teams competed.
|
186 |
+
In 1996 the tournament expanded to 16 teams, since it was easier for European nations to qualify for
|
187 |
+
the World Cup than their own continental championship; 14 of the 24 teams at the 1982 , 1986 and
|
188 |
+
1990 World Cups had been European, whereas the European Championship finals still involved
|
189 |
+
only eight teams.
|
190 |
+
In 2007, there was much discussion about an expansion of the tournament to 24 teams, started by
|
191 |
+
Scotland and the Republic of Ireland, due to the increased number of football associations in Europe
|
192 |
+
after the break-ups of Czechoslovakia, Yugos lavia and the Soviet Union, and the inclusion of Israel and Kazakhstan. The new president
|
193 |
+
of UEFA, Michel Platini, was reported to be in favour of expansion which proved an accurate assumption. Whilst on 17 April 2007,
|
194 |
+
UEFA's executive committee formally decided against expansion in 2012, Platini indicated in June 2008 that UEFA will increase
|
195 |
+
participation from 16 to 24 teams in future tournaments, starting from 2016.[87] On 25 September, it was announc ed by Franz
|
196 |
+
Beckenbauer that an agreement had been reached, and the expansion to 24 t eams would be officially announc ed the next day.[88]
|
197 |
+
The competing teams are chosen by a series of qualifying games: in 1960 and 1964 through home and away play-offs; from 1968
|
198 |
+
through a combination of both qualifying groups and play-off games. The host country was selected from the four finalists after they were
|
199 |
+
determined through qua lifying.
|
200 |
+
Since the expansion of the final tournament starting from 1980 , the host country, or countries, have been chosen beforehand and qualify
|
201 |
+
automatically.
|
202 |
+
In most tournaments, the tournament consists of a round- robin group s tage followed by a single-elimination knoc kout stage.Format
|
203 |
+
The competition
|
204 |
+
|
205 |
+
Year TeamsMatches
|
206 |
+
Format
|
207 |
+
Min.Act.
|
208 |
+
1960 4 4
|
209 |
+
semi-finals, 3rd-place match, final1964 4 4
|
210 |
+
1968 4 4 5
|
211 |
+
1972 4 4
|
212 |
+
1976 4 4
|
213 |
+
1980 8 14 2 groups of 4, 3rd-place match, final
|
214 |
+
1984 8 15
|
215 |
+
2 groups of 4, semi-finals, final 1988 8 15
|
216 |
+
1992 8 15
|
217 |
+
1996 16 31
|
218 |
+
4 groups of 4, quarter-finals, semi-finals, final2000 16 31
|
219 |
+
2004 16 31
|
220 |
+
2008 16 31
|
221 |
+
2012 16 31
|
222 |
+
2016 24 51
|
223 |
+
6 groups of 4, round of 16, quarter-finals, semi-finals, final2020 24 51
|
224 |
+
2024 24 51
|
225 |
+
2028 24 51
|
226 |
+
2032 24 51
|
227 |
+
Up to 1968 dr aws were to be broken via a coin toss in all matches but the final, draw in final match was resolved via a replay.
|
228 |
+
No third place play-off has been played since 1980.
|
229 |
+
To qualify, a team must finish in one of the direct qualifying spots or win a play-off. After this, a team proceeds to the finals round in the
|
230 |
+
host country, although hos ts qualify for the tournament automatically.
|
231 |
+
The groups for qualification are drawn by a UEFA committee using seeding. Seeded teams include reigning champions and other teams
|
232 |
+
based on their performance in the preceding FIFA World Cup qualifying and the last European Championship qualifying. To obtain an
|
233 |
+
accurate view of the teams' abilities, a ranking is produc ed. This is calculated by taking the total number of points won by a particular
|
234 |
+
team and dividing it by the number of games played, i.e. points per game. In the case of a team having hosted one of the two previous
|
235 |
+
competitions and therefore having qualified automatically, only the results from the single most recent qualifying competition are used. If
|
236 |
+
two teams have equal points per game, the committee then bases their positions in the rankings on:
|
237 |
+
1. Coefficient from the matches played in its most recent qualifying competition.
|
238 |
+
2. Average goal difference.
|
239 |
+
3. Average number of goals scored.
|
240 |
+
4. Average number of away goals scored.
|
241 |
+
5. Drawing of lots.
|
242 |
+
The qualifying phase is played in a group format, the composition of the groups is determined through means of a draw of teams from
|
243 |
+
pre-defined seeded bow ls. The draw takes place after the preceding W orld Cup's qualifying competition. F or UEFA Euro 2020 , the group
|
244 |
+
qualifying pha se consisted of ten groups; five of six teams and the remainder of five teams each.
|
245 |
+
Each group is played in a league format with teams playing each other home and away. The top two teams then qualified for the final
|
246 |
+
tournament, with remaining places decided by playoffs depending on their ranking in the UEFA Nations League. As with most leagues,
|
247 |
+
the points are awarded as three for a win, one for a draw, and none for a loss. In the eventuality of one or more teams having equal points
|
248 |
+
after all matches have been played, the following criteria are used to distinguish the sides:
|
249 |
+
1. Higher number of points obtained in the group matches played among the teams in question.
|
250 |
+
2. Superior goal difference from the group matches played among the teams in question.
|
251 |
+
3. Higher number of goals scored in the group matches played among the teams in question.Qualifying
|
252 |
+
|
253 |
+
Map of countries' best results. 10 countries have won, counting Germany and West
|
254 |
+
Germany as one4. Higher number of goals scored away from home in the group matches played among the teams in question.
|
255 |
+
5. Results of all group matches:
|
256 |
+
1. Superior goal difference
|
257 |
+
2. Higher number of goals scored
|
258 |
+
3. Higher number of goals scored away from home
|
259 |
+
4. Fair play conduct.
|
260 |
+
6. Drawing of lots.
|
261 |
+
Sixteen teams progressed to the final tournament for
|
262 |
+
the 2012 tournament. They were joint hosts Poland
|
263 |
+
and Ukraine, the winners and the highest ranked
|
264 |
+
second-placed team from the nine qualifying groups
|
265 |
+
as well as the winners of four play-off matches
|
266 |
+
between the runne rs-up of the other groups. These
|
267 |
+
sixteen teams were divided equally into four groups,
|
268 |
+
A, B, C and D, each consisting of four teams. The
|
269 |
+
groups were drawn up by the UEFA administration,
|
270 |
+
again using seeding. The seeded teams being the host
|
271 |
+
nations, the reigning champions, should they qualify,
|
272 |
+
and those with the best points per game coefficients
|
273 |
+
over the qualifying phase of the tournament and the
|
274 |
+
previous World Cup qualifying. Other finalists were
|
275 |
+
assigned to by means of a draw, using coefficients as
|
276 |
+
a basis.
|
277 |
+
For the 2016 tournament, the expansion to 24 teams
|
278 |
+
means that the teams will be drawn into six groups of
|
279 |
+
four, with the six group winners, six group runne rs-
|
280 |
+
up and the four best third-placed teams advancing to
|
281 |
+
the round of 16 when it becomes a knoc kout
|
282 |
+
competition.[85]
|
283 |
+
The groups are again played in a league format, where a team plays its oppone nts once each. The same points system is used (three points
|
284 |
+
for a win, one point for a draw, no points for a defeat). A schedule for the group matches will be drawn up, but the last two matches in a
|
285 |
+
group must kick off simultaneously. The winner and runne r-up of each group progress to the next round, where a knoc kout system is
|
286 |
+
used (the two teams play each other once, the winner progresses), this is used in all subsequent rounds as well. The winners of theFinal tournament
|
287 |
+
|
288 |
+
quarter-finals matches progress to the semi-finals, where the winners play in the final. If in any of the knoc kout rounds , the scores are still
|
289 |
+
equal after normal playing time, extra time and penalties are employed to separate the two teams. Unlike the FIFA World Cup, this
|
290 |
+
tournament no longe r has a third place playoff.
|
291 |
+
Year HostFinal Third place playoffNumber
|
292 |
+
of
|
293 |
+
teams Winners ScoreRunners-
|
294 |
+
upThird place ScoreFourth
|
295 |
+
place
|
296 |
+
1960
|
297 |
+
France
|
298 |
+
Soviet Union2–1
|
299 |
+
(a.e.t.)
|
300 |
+
Yugoslavia
|
301 |
+
Czechoslovakia2–0
|
302 |
+
France4
|
303 |
+
1964
|
304 |
+
Spain
|
305 |
+
Spain2–1
|
306 |
+
Soviet
|
307 |
+
Union
|
308 |
+
Hungary3–1
|
309 |
+
(a.e.t.)
|
310 |
+
Denmark4
|
311 |
+
1968
|
312 |
+
Italy
|
313 |
+
Italy1–1
|
314 |
+
(a.e.t.)
|
315 |
+
2–0
|
316 |
+
(replay)
|
317 |
+
Yugoslavia
|
318 |
+
England2–0
|
319 |
+
Soviet
|
320 |
+
Union4
|
321 |
+
1972
|
322 |
+
Belgium
|
323 |
+
West Germany3–0
|
324 |
+
Soviet
|
325 |
+
Union
|
326 |
+
Belgium2–1
|
327 |
+
Hungary4
|
328 |
+
1976
|
329 |
+
Yugoslavia
|
330 |
+
Czechoslovakia2–2
|
331 |
+
(a.e.t.)
|
332 |
+
(5–3 p)
|
333 |
+
West
|
334 |
+
Germany
|
335 |
+
Netherlands3–2
|
336 |
+
(a.e.t.)
|
337 |
+
Yugoslavia4
|
338 |
+
1980
|
339 |
+
Italy
|
340 |
+
West Germany2–1
|
341 |
+
Belgium
|
342 |
+
Czechoslovakia1–1 [a]
|
343 |
+
(9–8 p)
|
344 |
+
Italy 8
|
345 |
+
Losing semi-finalists[b]
|
346 |
+
1984
|
347 |
+
France
|
348 |
+
France2–0
|
349 |
+
Spain
|
350 |
+
Denmark and
|
351 |
+
Portugal 8
|
352 |
+
1988
|
353 |
+
West Germany
|
354 |
+
Netherlands2–0
|
355 |
+
Soviet
|
356 |
+
Union
|
357 |
+
Italy and
|
358 |
+
West Germany 8
|
359 |
+
1992
|
360 |
+
Sweden
|
361 |
+
Denmark2–0
|
362 |
+
Germany
|
363 |
+
Netherlands and
|
364 |
+
Sweden 8
|
365 |
+
1996
|
366 |
+
England
|
367 |
+
Germany2–1
|
368 |
+
(g.g.)
|
369 |
+
Czech
|
370 |
+
Republic
|
371 |
+
England and
|
372 |
+
France 16
|
373 |
+
2000
|
374 |
+
Belgium
|
375 |
+
Netherlands
|
376 |
+
France2–1
|
377 |
+
(g.g.)
|
378 |
+
Italy
|
379 |
+
Netherlands and
|
380 |
+
Portugal 16
|
381 |
+
2004
|
382 |
+
Portugal
|
383 |
+
Greece1–0
|
384 |
+
Portugal
|
385 |
+
Czech Republic and
|
386 |
+
Netherlands16
|
387 |
+
2008
|
388 |
+
Austria
|
389 |
+
Switzerland
|
390 |
+
Spain1–0
|
391 |
+
Germany
|
392 |
+
Russia and
|
393 |
+
Turkey 16
|
394 |
+
2012
|
395 |
+
Poland
|
396 |
+
Ukraine
|
397 |
+
Spain4–0
|
398 |
+
Italy
|
399 |
+
Germany and
|
400 |
+
Portugal 16
|
401 |
+
2016
|
402 |
+
France
|
403 |
+
Portugal1–0
|
404 |
+
(a.e.t.)
|
405 |
+
France
|
406 |
+
Germany and
|
407 |
+
Wales 24Results
|
408 |
+
|
409 |
+
Map of winners2020[c]
|
410 |
+
Europe[d]
|
411 |
+
Italy1–1
|
412 |
+
(a.e.t.)
|
413 |
+
(3–2 p)
|
414 |
+
England
|
415 |
+
Denmark and
|
416 |
+
Spain 24
|
417 |
+
2024
|
418 |
+
Germany 24
|
419 |
+
2028
|
420 |
+
England
|
421 |
+
Northern
|
422 |
+
Ireland
|
423 |
+
Republic of
|
424 |
+
Ireland
|
425 |
+
Scotland
|
426 |
+
Wales24
|
427 |
+
2032
|
428 |
+
Italy
|
429 |
+
Turkey24
|
430 |
+
Notes
|
431 |
+
a. No extra time was played.
|
432 |
+
b. No third place play-off has been played since 1980; losing semi-finalists are listed in alphabetical order.
|
433 |
+
c. Postponed to 2021 due to the COVID-19 pandemic in Europe.
|
434 |
+
d. Pan–European edition hosted by eleven countries: Azerbaijan, Denmark, England, Germany, Hungary, Italy, the
|
435 |
+
Netherlands, Romania, Russia, Scotland and Spain.
|
436 |
+
Team Winners Runners-up
|
437 |
+
Germany13 (1972, 1980, 1996)3 (1976, 1992, 2008)
|
438 |
+
Spain 3 (1964*, 2008, 2012)1 (1984)
|
439 |
+
Italy 2 (1968*, 2020*) 2 (2000, 2012)
|
440 |
+
France 2 (1984*, 2000) 1 (2016*)
|
441 |
+
Russia21 (1960) 3 (1964, 1972, 1988)
|
442 |
+
Czech Republic31 (1976) 1 (1996)
|
443 |
+
Portugal 1 (2016) 1 (2004*)
|
444 |
+
Slovakia31 (1976) —
|
445 |
+
Netherlands 1 (1988) —
|
446 |
+
Denmark 1 (1992) —
|
447 |
+
Greece 1 (2004) —
|
448 |
+
Serbia4— 2 (1960, 1968)
|
449 |
+
Belgium — 1 (1980)
|
450 |
+
England — 1 (2020*)
|
451 |
+
* hosts
|
452 |
+
1 named West Germany until 1990
|
453 |
+
2 includes results representing the Soviet Union
|
454 |
+
3 both the Czech Republic and Slovakia inherited Czechoslovakia's 1976 title[89]
|
455 |
+
4 includes results representing Yugoslavia
|
456 |
+
There are currently five post-tournament awards, and one given dur ing the tournament:[90]Summary
|
457 |
+
Records and statistics
|
458 |
+
Awards
|
459 |
+
|
460 |
+
Player of the Tournament award for the best player, first awarded in 1996.[91][92]
|
461 |
+
Top Scorer award (currently named Alipay Top Scorer award for sponsorship reasons) for the most prolific goal
|
462 |
+
scorer.[93][94]
|
463 |
+
Young Player of the Tournament (currently named SOCAR Young Player of the Tournament for sponsorship reasons)
|
464 |
+
for the best player under the age of 21, first awarded in 2016.[95][96]
|
465 |
+
Man of the Match award for outstanding performance during each game of the tournament, first awarded in 1996.
|
466 |
+
Team of the Tournament award for the best combined team of players in the tournament.
|
467 |
+
1. "Regulations of the UEFA European Football Championship 2018–20" (https://documents.uefa.com/v/u/WVKcnryVkAS
|
468 |
+
zztwJjPBcIw). UEFA.com. Union of European Football Associations. 9 March 2018. Archived (https://web.archive.org/w
|
469 |
+
eb/20210511180320/https://documents.uefa.com/internal/api/webapp/documents/WVKcnryVkASzztwJjPBcIw/content)
|
470 |
+
from the original on 11 May 2021. Retrieved 11 May 2021.
|
471 |
+
2. Horn, Nicolas (3 June 2024). "Euro 2024 team guides part one: Germany" (https://www.theguardian.com/football/article/
|
472 |
+
2024/jun/03/euro-2024-team-guides-part-1-germany). The Guardian. Retrieved 5 June 2024.
|
473 |
+
3. Ostlere, Lawrence (4 June 2024). "England's Euro 2024 squad: Who's on the plane, who's in contention and who will
|
474 |
+
miss out?" (https://www.independent.co.uk/sport/football/england-euro-2024-squad-prediction-b2556337.html). The
|
475 |
+
Independent. Retrieved 5 June 2024.
|
476 |
+
4. Pandit, Rupa (23 February 2022). Physical Education: Textbook for ICSE Class 10 (https://books.google.com/books?id
|
477 |
+
=RNVgEAAAQBAJ&newbks=0&printsec=frontcover&pg=PT226&dq=The+competition+is+contested+by+UEFA+mem
|
478 |
+
bers'+senior+men's+national+teams,+determining+the+continental+champion+of+Europe&hl=vi). Oswal Publishers.
|
479 |
+
ISBN 978-93-90278-47-3.
|
480 |
+
5. Authors, Panel of. Arun Deep's 10 Years Solved Papers For ICSE Class 10 Exam 2023 - Comprehensive Handbook Of
|
481 |
+
15 Subjects - Year-Wise Board Solved Question Papers, Revised Syllabus 2023 (https://books.google.com/books?id=j
|
482 |
+
mp7EAAAQBAJ&newbks=0&printsec=frontcover&pg=PA1558&dq=The+competition+is+contested+by+UEFA+membe
|
483 |
+
rs'+senior+men's+national+teams,+determining+the+continental+champion+of+Europe&hl=vi). Ravinder Singh and
|
484 |
+
sons. p. 1558.
|
485 |
+
6. "Euro 2016 seen by 2 billion on TV; 600m watch final" (https://www.espn.in/football/story/_/id/37506217/euro-2016-see
|
486 |
+
n-2bn-tv-600m-watch-final). ESPN. 15 December 2016. Retrieved 16 February 2024.
|
487 |
+
7. "UEFA EURO 24 – The biggest European football tournament is here again after four years! | EXIsport Eshop EU" (http
|
488 |
+
s://www.exisport.eu/smartblog/473_uefa-euro-24-the-biggest-european-football-to.html). www.exisport.eu. Retrieved
|
489 |
+
21 March 2024.
|
490 |
+
8. Pyta, W.; Havemann, N. (25 March 2015). European Football and Collective Memory (https://books.google.com/books?i
|
491 |
+
d=_G2LDAAAQBAJ&newbks=0&printsec=frontcover&pg=PA59&dq=UEFA+European+Championship+has+been+hel
|
492 |
+
d+every+four+years+since+1960&hl=vi). Springer. p. 59. ISBN 978-1-137-45015-9.
|
493 |
+
9. Dunmore, Tom (16 September 2011). Historical Dictionary of Soccer (https://books.google.com/books?id=9j1wbp2t1us
|
494 |
+
C&newbks=0&printsec=frontcover&pg=PA250&dq=UEFA+European+Championship+has+been+held+every+four+yea
|
495 |
+
rs+since+1960&hl=vi). Scarecrow Press. p. 250. ISBN 978-0-8108-7188-5.
|
496 |
+
10. "2005/2006 season: final worldwide matchday to be 14 May 2006" (https://web.archive.org/web/20120712091406/http://
|
497 |
+
www.fifa.com/aboutfifa/organisation/news/newsid=95756/index.html). FIFA.com. Fédération Internationale de Football
|
498 |
+
Association. 19 December 2004. Archived from the original (https://www.fifa.com/aboutfifa/organisation/news/newsid=9
|
499 |
+
5756/index.html) on 12 July 2012. Retrieved 13 January 2012.
|
500 |
+
11. Mustafa, DJ Kamal (12 July 2021). "Italy wins on penalties UEFA EURO 2020 Final, Italy vs England highlights" (http
|
501 |
+
s://emeatribune.com/italy-wins-on-penalties-uefa-euro-2020-final-italy-vs-england-highlights/). EMEA Tribune.
|
502 |
+
Retrieved 12 July 2021.
|
503 |
+
12. "Italy wins Euro 2020, beats England in penalty shootout" (https://apnews.com/article/euro-2020-sports-soccer-europe-
|
504 |
+
england-89bbc1c0ca45df053e30d7afcb13317e). AP News. 11 July 2021. Retrieved 12 July 2021.
|
505 |
+
13. "Delaunay's dream realised in France" (http://www.uefa.com/uefaeuro/season=1960/overview/index.html). UEFA.com.
|
506 |
+
Union of European Football Associations. 30 January 2012. Retrieved 24 February 2012.
|
507 |
+
14. "The Henri Delaunay Cup" (https://www.uefa.com/uefaeuro-2020/news/0258-0e51de1a172f-12472925ce41-1000--the-
|
508 |
+
biggest-prize-in-2020/). UEFA.com. Union of European Football Associations. 28 January 2012. Retrieved 24 February
|
509 |
+
2012.
|
510 |
+
15. "1960 UEFA European Championship – Teams" (http://www.uefa.com/uefaeuro/season=1960/teams/index.html).
|
511 |
+
UEFA.com. Union of European Football Associations. Retrieved 24 February 2012.
|
512 |
+
16. "Ponedelnik heads Soviet Union to glory" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7b300e90b1-d0e35cbed
|
513 |
+
ac8-1000--ponedelnik-heads-soviet-union-to-glory/). UEFA.com. Union of European Football Associations. 1 October
|
514 |
+
2003. Retrieved 26 February 2012.
|
515 |
+
17. Rostance, Tom (21 May 2012). "Euro 1960: Lev Yashin leads Soviets to glory in France" (https://www.bbc.co.uk/sport/0/
|
516 |
+
football/17680769). BBC Sport. British Broadcasting Corporation. Retrieved 11 June 2012.
|
517 |
+
18. "France 1960" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/history/3078333.stm). BBC Sport. British
|
518 |
+
Broadcasting Corporation. 17 May 2004. Retrieved 24 February 2012.References
|
519 |
+
|
520 |
+
19. "Spain savour home comforts" (http://www.uefa.com/uefaeuro/season=1964/overview/index.html). UEFA.com. Union of
|
521 |
+
European Football Associations. 21 December 2011. Retrieved 24 February 2012.
|
522 |
+
20. "Spain 1964" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/history/3078417.stm). BBC Sport. British Broadcasting
|
523 |
+
Corporation. 17 May 2004. Retrieved 24 February 2012.
|
524 |
+
21. "Spain's Marcelino stoops to conquer Europe" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7d219213ee-7a37c
|
525 |
+
69c0d3e-1000--marcelino-stoops-to-conquer-for-spain/). UEFA.com. Union of European Football Associations. 2
|
526 |
+
October 2003. Retrieved 26 February 2012.
|
527 |
+
22. "Italy make most of good fortune" (http://www.uefa.com/uefaeuro/season=1968/overview/index.html). UEFA.com. Union
|
528 |
+
of European Football Associations. 20 December 2011. Retrieved 24 February 2012.
|
529 |
+
23. "Italy 1968" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/history/3078455.stm). BBC Sport. British Broadcasting
|
530 |
+
Corporation. 17 May 2004. Retrieved 24 February 2012.
|
531 |
+
24. "Italy through to final after coin toss" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7b2f5adb06-fa5820ecb86b-10
|
532 |
+
00--italy-through-to-final-after-coin-toss/). UEFA.com. Union of European Football Associations. 2 October 2003.
|
533 |
+
Retrieved 26 February 2012.
|
534 |
+
25. "Hosts Italy earn final replay against Yugoslavia" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7b2f5cc895-3973
|
535 |
+
74efc71d-1000--italy-earn-final-replay-against-yugoslavia/). UEFA.com. Union of European Football Associations. 2
|
536 |
+
October 2003. Retrieved 26 February 2012.
|
537 |
+
26. "Riva steers Italy to EURO 1968 final replay win against Yugoslavia" (https://www.uefa.com/uefaeuro-2020/news/0253-
|
538 |
+
0d7b30305868-f37cf2b58b1d-1000--riva-return-sparks-italy-triumph/). UEFA.com. Union of European Football
|
539 |
+
Associations. 2 October 2003. Retrieved 26 February 2012.
|
540 |
+
27. "1968 UEFA European Championship – Teams" (http://www.uefa.com/uefaeuro/season=1968/teams/index.html).
|
541 |
+
UEFA.com. Union of European Football Associations. Retrieved 24 February 2012.
|
542 |
+
28. "Müller strikes twice as West Germany beat USSR in 1972 EURO final" (https://www.uefa.com/uefaeuro-2020/news/02
|
543 |
+
53-0d7b3004cb83-b521fb90279e-1000--muller-the-menace-in-german-masterclass/). UEFA.com. Union of European
|
544 |
+
Football Associations. 3 October 2003. Retrieved 26 February 2012.
|
545 |
+
29. "West Germany make their mark" (http://www.uefa.com/uefaeuro/season=1972/overview/index.html). UEFA.com. Union
|
546 |
+
of European Football Associations. 20 December 2011. Retrieved 24 February 2012.
|
547 |
+
30. "Belgium 1972" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/history/3078533.stm). BBC Sport. British
|
548 |
+
Broadcasting Corporation. 17 May 2004. Retrieved 24 February 2012.
|
549 |
+
31. Dunbar, Graham (2 July 2010). "Abreu's 'Panenka' penalty revives 1976 classic" (https://www.usatoday.com/sports/socc
|
550 |
+
er/2010-07-02-917701650_x.htm). USA Today. Associated Press. Retrieved 9 June 2012.
|
551 |
+
32. "Panenka the hero for Czechoslovakia" (http://www.uefa.com/uefaeuro/season=1976/overview/index.html). UEFA.com.
|
552 |
+
Union of European Football Associations. 27 February 2008. Retrieved 9 June 2012.
|
553 |
+
33. "Italy 1980" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/history/3083203.stm). BBC Sport. British Broadcasting
|
554 |
+
Corporation. 17 May 2004. Retrieved 24 February 2012.
|
555 |
+
34. "Hrubesch turns West Germany's unlikely hero" (https://www.uefa.com/uefaeuro-2020/match/3585--belgium-vs-west-ge
|
556 |
+
rmany/postmatch/report/). UEFA.com. Union of European Football Associations. 4 October 2003. Retrieved
|
557 |
+
26 February 2012.
|
558 |
+
35. "Hrubesch crowns West German win" (http://www.uefa.com/uefaeuro/season=1980/overview/index.html). UEFA.com.
|
559 |
+
Union of European Football Associations. 21 June 2008. Retrieved 9 June 2012.
|
560 |
+
36. "Platini shines for flamboyant France" (http://www.uefa.com/uefaeuro/season=1984/overview/index.html). UEFA.com.
|
561 |
+
Union of European Football Associations. 20 December 2011. Retrieved 24 February 2012.
|
562 |
+
37. "Platini shines for flamboyant France" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7bc6ae8332-462b43181bbe
|
563 |
+
-1000--platini-shines-for-flamboyant-france/?iv=true). UEFA.com. Union of European Football Associations. 20
|
564 |
+
December 2011. Retrieved 24 February 2012.
|
565 |
+
38. "France 1984" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/history/3083327.stm). BBC Sport. British
|
566 |
+
Broadcasting Corporation. 17 May 2004. Retrieved 11 June 2012.
|
567 |
+
39. "Van Basten sparks Netherlands joy" (http://www.uefa.com/uefaeuro/season=1988/overview/index.html). UEFA.com.
|
568 |
+
Union of European Football Associations. 20 December 2011. Retrieved 24 February 2012.
|
569 |
+
40. "West Germany 1988" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/history/3083427.stm). BBC Sport. British
|
570 |
+
Broadcasting Corporation. 17 May 2004. Retrieved 24 February 2012.
|
571 |
+
41. "Van Basten ends Dutch wait" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7b2f78ca99-40f24ef873fd-1000--va
|
572 |
+
n-basten-ends-dutch-wait/). UEFA.com. Union of European Football Associations. 5 October 2003. Retrieved
|
573 |
+
26 February 2012.
|
574 |
+
42. "Van Basten's volley" (https://www.uefa.com/uefaeuro-2020/news/0253-0d8162342da4-964ee372d4bf-1000--ten-great-
|
575 |
+
euro-moments-van-basten-s-volley/). UEFA.com. Union of European Football Associations. 20 December 2011.
|
576 |
+
Retrieved 24 February 2012.
|
577 |
+
43. "Denmark late show steals spotlight" (http://www.uefa.com/uefaeuro/season=1992/overview/index.html). UEFA.com.
|
578 |
+
Union of European Football Associations. 30 January 2012. Retrieved 25 February 2012.
|
579 |
+
44. "Sweden 1992" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/history/3083439.stm). BBC Sport. British
|
580 |
+
Broadcasting Corporation. 27 May 2004. Retrieved 25 February 2012.
|
581 |
+
|
582 |
+
45. "Schmeichel helps Denmark down Netherlands" (https://www.uefa.com/uefaeuro-2020/match/6097--netherlands-vs-de
|
583 |
+
nmark/postmatch/report/). UEFA.com. Union of European Football Associations. 5 October 2003. Retrieved
|
584 |
+
26 February 2012.
|
585 |
+
46. "Gatecrashing Denmark down Germany" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7b301f026e-4388f32eaa
|
586 |
+
87-1000--gatecrashing-denmark-down-germany-in-euro-1992-final/). UEFA.com. Union of European Football
|
587 |
+
Associations. 5 October 2003. Retrieved 26 February 2012.
|
588 |
+
47. "Football comes home for Germany" (http://www.uefa.com/uefaeuro/season=1996/overview/index.html). UEFA.com.
|
589 |
+
Union of European Football Associations. 1 February 2012. Retrieved 25 February 2012.
|
590 |
+
48. "Hosts denied by Germany in epic semi-final" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7b301cbfd1-46785d
|
591 |
+
59fbda-1000--germany-beat-england-on-penalties-to-reach-euro-96-final/). UEFA.com. Union of European Football
|
592 |
+
Associations. 6 October 2003. Retrieved 26 February 2012.
|
593 |
+
49. "Bierhoff hero of Germany's EURO '96 win" (https://www.uefa.com/uefaeuro-2020/match/52917--czech-republic-vs-ger
|
594 |
+
many/postmatch/report/). UEFA.com. Union of European Football Associations. 6 October 2003. Retrieved 26 February
|
595 |
+
2012.
|
596 |
+
50. "England 1996" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/history/3083531.stm). BBC Sport. British
|
597 |
+
Broadcasting Corporation. 17 May 2004. Retrieved 25 February 2012.
|
598 |
+
51. Lister, Graham (1 December 2011). "Euro 2012 History: The 2000 finals" (http://www.goal.com/en/news/2898/euro-201
|
599 |
+
2/2011/12/01/2782770/euro-2012-history-the-2000-finals). Goal.com. Retrieved 11 June 2012.
|
600 |
+
52. "Golden boy Trezeguet relives France's 2000 glory" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7ff3c5bce4-6e
|
601 |
+
73f8d0a4cc-1000--golden-boy-trezeguet-relives-france-s-2000-glory/). UEFA.com. Union of European Football
|
602 |
+
Associations. 20 December 2011. Retrieved 25 February 2012.
|
603 |
+
53. McNulty, Phil (20 December 2004). "Greece defy the odds at Euro 2004" (http://news.bbc.co.uk/sport2/hi/football/40210
|
604 |
+
41.stm). BBC Sport. British Broadcasting Corporation. Retrieved 25 February 2012.
|
605 |
+
54. "France 0–1 Greece" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/3830575.stm). BBC Sport. British
|
606 |
+
Broadcasting Corporation. 25 June 2004. Retrieved 25 February 2012.
|
607 |
+
55. "Greece 1–0 Czech Rep" (http://news.bbc.co.uk/sport2/hi/football/euro_2004/3844467.stm). BBC Sport. British
|
608 |
+
Broadcasting Corporation. 1 July 2004. Retrieved 25 February 2012.
|
609 |
+
56. "Dellas delight stuns Czech Republic" (https://www.uefa.com/uefaeuro-2020/news/0253-0d7b43e4d6d3-1e43d840c0a
|
610 |
+
8-1000--dellas-delight-stuns-czech-republic/). UEFA.com. Union of European Football Associations. 2 July 2004.
|
611 |
+
Retrieved 25 February 2012.
|
612 |
+
57. "New UEFA EURO Trophy to be unveiled" (https://www.uefa.com/newsfiles/387827.pdf) (PDF). UEFA.com. Union of
|
613 |
+
European Football Associations. 23 January 2006. Retrieved 2 April 2023.
|
614 |
+
58. "UEFA EURO 2008 – Match Schedule" (https://www.uefa.com/MultimediaFiles/Download/competitions/euro/360459_d
|
615 |
+
ownload.pdf) (PDF). UEFA.com. Union of European Football Associations. Archived (https://web.archive.org/web/2005
|
616 |
+
1104103533/https://www.uefa.com/MultimediaFiles/Download/competitions/euro/360459_download.pdf) (PDF) from
|
617 |
+
the original on 4 November 2005. Retrieved 25 February 2012.
|
618 |
+
59. "Euro 2008 venues" (http://news.bbc.co.uk/sport2/hi/football/internationals/4634960.stm). BBC Sport. British
|
619 |
+
Broadcasting Corporation. 27 May 2008. Retrieved 25 February 2012.
|
620 |
+
60. McNulty, Phil (29 June 2008). "Germany 0–1 Spain" (http://news.bbc.co.uk/sport2/hi/football/euro_2008/7363545.stm).
|
621 |
+
BBC Sport. British Broadcasting Corporation. Retrieved 25 February 2012.
|
622 |
+
61. "EURO joy for Poland and Ukraine" (http://www.uefa.com/news/newsid=528963.html). UEFA.com. Union of European
|
623 |
+
Football Associations. 19 April 2007. Retrieved 10 January 2012.
|
624 |
+
62. "Record-breaking Spain retain European title" (https://www.dawn.com/news/731302/record-breaking-spain-retain-euro
|
625 |
+
pean-title). Dawn. 3 July 2012. Retrieved 24 October 2021.
|
626 |
+
63. "Sepp Blatter confident of positive goal-line technology vote" (https://www.bbc.co.uk/sport/0/football/18520916). BBC
|
627 |
+
Sport. British Broadcasting Corporation. 21 June 2012. Retrieved 2 July 2012.
|
628 |
+
64. "Uefa to expand Euro Championship" (http://news.bbc.co.uk/sport2/hi/football/internationals/7636495.stm). BBC Sport.
|
629 |
+
British Broadcasting Corporation. 26 September 2008. Retrieved 6 December 2017.
|
630 |
+
65. "EURO expands to 24" (http://www.uefa.com/news/newsid=754239.html). UEFA.com. Union of European Football
|
631 |
+
Associations. 26 September 2008. Retrieved 23 February 2014.
|
632 |
+
66. "Michel Platini annoyed at England after they opposed expansion of Euro 2016" (https://www.theguardian.com/football/
|
633 |
+
2014/feb/22/michel-platini-england-germany-european-championships). The Guardian. 22 February 2014. Retrieved
|
634 |
+
23 February 2014.
|
635 |
+
67. "France beat Turkey and Italy to stage Euro 2016" (http://news.bbc.co.uk/sport2/hi/football/europe/8711016.stm). BBC
|
636 |
+
Sport. British Broadcasting Corporation. 28 May 2010. Retrieved 11 January 2012.
|
637 |
+
68. "UEFA approves 24-team Euro from 2016" (https://www.uefa.com/multimediafiles/download/pressrelease/uefa/uefamed
|
638 |
+
ia/75/42/19/754219_download.pdf) (PDF). UEFA.com. Union of European Football Associations. 27 September 2008.
|
639 |
+
Archived (https://web.archive.org/web/20100704224415/https://www.uefa.com/multimediafiles/download/pressrelease/
|
640 |
+
uefa/uefamedia/75/42/19/754219_download.pdf) (PDF) from the original on 4 July 2010. Retrieved 22 June 2012.
|
641 |
+
69. "TFF Başkanı'ndan Açıklama" (http://www.tff.org/default.aspx?pageID=285&ftxtID=14970) [TFF President
|
642 |
+
Announcement] (in Turkish). Turkish Football Federation. 17 April 2012. Retrieved 11 June 2012.
|
643 |
+
|
644 |
+
70. "Scotland and Wales consider late joint bid to stage Euro 2020" (https://www.theguardian.com/football/2012/may/14/sco
|
645 |
+
tland-wales-bid-euro-2020?CMP=twt_gu). The Guardian. 14 May 2012. Retrieved 11 June 2012.
|
646 |
+
71. "Georgia makes solo bid for Euro 2020" (https://www.google.com/hostednews/afp/article/ALeqM5g2s4PRvCs36vHKqM
|
647 |
+
SAIzif5zRozA?docId=CNG.05a104bb30d984d0f13d44f4a28dec46.371). AFP. 15 May 2012. Retrieved 11 June 2012.
|
648 |
+
72. "UEFA EURO 2020 to be held across continent" (https://www.uefa.com/uefaeuro-2020/news/0252-0ce05d361003-69d3
|
649 |
+
7557d56a-1000--uefa-euro-2020-to-be-held-across-continent/). UEFA.com. Union of European Football Associations. 6
|
650 |
+
December 2012. Retrieved 24 January 2013.
|
651 |
+
73. "EURO 2020: host cities and stadiums" (https://www.uefa.com/uefaeuro-2020/news/0256-0dd74d2cf7cc-56813840afe0
|
652 |
+
-1000--euro-2020-host-cities/). UEFA.com. Union of European Football Associations. 30 November 2019. Retrieved
|
653 |
+
20 August 2020.
|
654 |
+
74. "Wembley to stage UEFA EURO 2020 final" (http://www.uefa.com/uefaeuro-2020/news/newsid=2151146.html).
|
655 |
+
UEFA.com. Union of European Football Associations. 19 September 2014.
|
656 |
+
75. "EURO 2020 to open in Rome, more London games, venues paired" (http://www.uefa.com/uefaeuro-2020/news/newsid
|
657 |
+
=2525102.html). UEFA.com. Union of European Football Associations. 7 December 2017. Retrieved 7 December 2017.
|
658 |
+
76. "UEFA postpones EURO 2020 by 12 months" (https://www.uefa.com/insideuefa/about-uefa/news/025b-0f8e76aef315-8
|
659 |
+
506a9de10aa-1000--uefa-postpones-euro-2020-by-12-months/#:~:text=In%20the%20face%20of%20this,June%20to%
|
660 |
+
2011%20July%202021.). UEFA.com. Union of European Football Associations. 17 March 2020. Retrieved 17 March
|
661 |
+
2020.
|
662 |
+
77. Fallon, John. "Euro 2020: Why has Dublin lost hosting rights? What happens if I have tickets?" (https://www.irishtimes.c
|
663 |
+
om/sport/soccer/international/euro-2020-why-has-dublin-lost-hosting-rights-what-happens-if-i-have-tickets-1.4545809).
|
664 |
+
The Irish Times. Retrieved 1 June 2021.
|
665 |
+
78. "Euro 2020: Seville to replace Bilbao as Spanish host city – Football Espana" (https://www.football-espana.net/2021/0
|
666 |
+
4/16/euro-2020-seville-to-replace-bilbao-as-spanish-host-city). 16 April 2021.
|
667 |
+
79. "Euro 2020 final: England beaten by Italy on penalties" (https://www.bbc.com/sport/football/51198762). BBC Sport. 11
|
668 |
+
July 2021. Retrieved 6 June 2022.
|
669 |
+
80. "What is the UEFA Euro 2024 trophy?" (https://www.bundesliga.com/en/bundesliga/news/what-is-the-uefa-euro-2024-tr
|
670 |
+
ophy-germany-henri-delaunay-cup-26610). bundesliga.com - the official Bundesliga website. Retrieved 21 March 2024.
|
671 |
+
81. Harrold, Michael (27 January 2006). "You won't find a superior trophy" (https://web.archive.org/web/20130402065204/ht
|
672 |
+
tps://www.uefa.com/news/newsid=389177.html). UEFA.com. London: Union of European Football Associations.
|
673 |
+
Archived from the original (https://www.uefa.com/news/newsid=389177.html) on 2 April 2013. Retrieved 13 January
|
674 |
+
2012.
|
675 |
+
82. "New trophy for UEFA EURO 2008" (https://web.archive.org/web/20130402070756/https://www.uefa.com/news/newsid
|
676 |
+
=387580.html). UEFA.com. Union of European Football Associations. 24 January 2006. Archived from the original (http
|
677 |
+
s://www.uefa.com/news/newsid=387580.html) on 2 April 2013. Retrieved 13 January 2012.
|
678 |
+
83. "Regulations of the UEFA European Football Championship 2006/08" (http://www.uefa.com/newsfiles/19079.pdf)
|
679 |
+
(PDF). 2.08: UEFA. p. 3. Archived (https://web.archive.org/web/20031010220110/http://www.uefa.com/newsfiles/19079.
|
680 |
+
pdf) (PDF) from the original on 10 October 2003. Retrieved 11 July 2016.
|
681 |
+
84. "Regulations of the UEFA European Football Championship 2010–12" (https://www.uefa.com/MultimediaFiles/Downlo
|
682 |
+
ad/competitions/euro/91/87/57/918757_download.pdf) (PDF). 3.08: UEFA. p. 4. Archived (https://web.archive.org/web/2
|
683 |
+
0100215034039/https://www.uefa.com/MultimediaFiles/Download/competitions/euro/91/87/57/918757_download.pdf)
|
684 |
+
(PDF) from the original on 15 February 2010. Retrieved 4 July 2012.
|
685 |
+
85. "Regulations of the UEFA European Football Championship 2014–16" (https://web.archive.org/web/20131219025616/
|
686 |
+
https://www.uefa.com/MultimediaFiles/Download/Regulations/uefaorg/Regulations/02/03/92/81/2039281_DOWNLOA
|
687 |
+
D.pdf) (PDF). 4.08: UEFA. p. 11. Archived from the original (https://www.uefa.com/MultimediaFiles/Download/Regulatio
|
688 |
+
ns/uefaorg/Regulations/02/03/92/81/2039281_DOWNLOAD.pdf) (PDF) on 19 December 2013. Retrieved 2 September
|
689 |
+
2016.
|
690 |
+
86. "SportMob – Everything you need to know about UEFA EURO history" (https://sportmob.com/en/article/901356-everythi
|
691 |
+
ng-you-need-to-know-about-uefa-euro-history). SportMob. 28 October 2020. Retrieved 21 March 2024.
|
692 |
+
87. "Uefa sets deadline over Euro 2012" (http://news.bbc.co.uk/sport1/hi/football/7479293.stm). BBC Sport. British
|
693 |
+
Broadcasting Corporation. 28 June 2008. Retrieved 13 May 2011.
|
694 |
+
88. "Uefa to expand Euro Championship" (http://news.bbc.co.uk/sport2/hi/football/internationals/7636495.stm). BBC Sport.
|
695 |
+
British Broadcasting Corporation. 26 September 2008. Retrieved 13 May 2011.
|
696 |
+
89. "Most titles | History | UEFA EURO" (https://www.uefa.com/uefaeuro/history/winners/). UEFA.com. Retrieved 5 June
|
697 |
+
2024.
|
698 |
+
90. "UEFA EURO 2016 at a glance" (http://www.uefa.com/news/newsid=2390324.html). UEFA. 11 July 2016. Retrieved
|
699 |
+
28 November 2016.
|
700 |
+
91. "1996 FIFA Awards" (https://www.topendsports.com/sport/soccer/awards/fifa-1996.htm#:~:text=Best%20Player%20Awa
|
701 |
+
rd:%20The%201996,d'Or%20was%20Matthias%20Sammer.). www.topendsports.com. Retrieved 21 March 2024.
|
702 |
+
92. Percival, Holly. "Euro 2020 player of the tournament: Who decides award after England vs Italy tonight?" (https://theathl
|
703 |
+
etic.com/4206406/2021/07/10/capello-moyes-keane-the-famous-faces-who-decide-the-best-player-of-euro-2020/). The
|
704 |
+
Athletic. Retrieved 21 March 2024.
|
705 |
+
|
706 |
+
93. UEFA.com (13 June 2023). "UEFA Top Scorer trophy presented by Alipay unveiled for UEFA Nations League | UEFA
|
707 |
+
Nations League" (https://www.uefa.com/uefanationsleague/news/0282-184568a955f9-fa20b852667c-1000--uefa-top-sc
|
708 |
+
orer-trophy-presented-by-alipay-unveiled-for-uefa/). UEFA.com. Retrieved 21 March 2024.
|
709 |
+
94. UEFA.com (10 June 2021). "Alipay Top Scorer trophy unveiled for UEFA EURO 2020 | Inside UEFA" (https://www.uefa.
|
710 |
+
com/insideuefa/news/026a-127c2251876f-35ab1bb63f57-1000--alipay-top-scorer-trophy-unveiled-for-uefa-euro-2020/).
|
711 |
+
UEFA.com. Retrieved 21 March 2024.
|
712 |
+
95. UEFA.com (9 June 2019). "Bernardo Silva and Frenkie de Jong win Nations League awards | UEFA Nations League"
|
713 |
+
(https://de.uefa.com/uefanationsleague/news/0253-0d81efc3f60a-0d39c305041d-1000--bernardo-silva-and-frenkie-de-j
|
714 |
+
ong-win-nations-league-awards/). UEFA.com (in German). Retrieved 21 March 2024.
|
715 |
+
96. "Lamine Camara Chosen as Best Young Player in AFCON Group Stage" (https://www.beinsports.com/en-us/soccer/afri
|
716 |
+
ca-cup-of-nations/articles-video/for-this-reason-lamine-camara-chosen-as-best-young-player-in-afcon-group-stage-202
|
717 |
+
4-01-25). beIN SPORTS. Retrieved 21 March 2024.
|
718 |
+
UEFA European Championship history (https://www.uefa.com/uefaeuro/history) at the Union of European Football
|
719 |
+
Associations
|
720 |
+
European Championship results (https://rsssf.org/tablese/eurochamp.html) at the RSSSF
|
721 |
+
British Home Championship
|
722 |
+
Central European International Cup
|
723 |
+
UEFA European Championship mascot
|
724 |
+
UEFA European Championship records and statistics
|
725 |
+
UEFA European Championship top goalscorers
|
726 |
+
UEFA European Championship Teams of the Tournament
|
727 |
+
UEFA European Under-17 Championship
|
728 |
+
UEFA European Under-19 Championship
|
729 |
+
UEFA European Under-21 Championship
|
730 |
+
UEFA Women's Championship
|
731 |
+
UEFA European Championship – Official website (https://www.uefa.com/euro2024)
|
732 |
+
UEFA – Official website (https://www.uefa.com)
|
733 |
+
Retrieved from "https://en.wikipedia.org/w/index.php?title=UEFA_European_Championship&oldid=1227504801"Sources
|
734 |
+
See also
|
735 |
+
External links
|
requirements.txt
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
chainlit==0.7.700
|
2 |
+
cohere==4.37
|
3 |
+
openai==1.3.5
|
4 |
+
tiktoken==0.5.1
|
5 |
+
python-dotenv==1.0.0
|
6 |
+
pypdf
|
7 |
+
numpy
|