diff --git a/09-chat-project/backend/api.py b/09-chat-project/backend/api.py new file mode 100644 index 00000000..e84f94cf --- /dev/null +++ b/09-chat-project/backend/api.py @@ -0,0 +1 @@ +# api \ No newline at end of file diff --git a/09-chat-project/backend/llm.py b/09-chat-project/backend/llm.py new file mode 100644 index 00000000..d9d42cb5 --- /dev/null +++ b/09-chat-project/backend/llm.py @@ -0,0 +1,28 @@ +import os +from openai import OpenAI + +# To authenticate with the model you will need to generate a personal access token (PAT) in your GitHub settings. +# Create your PAT token by following instructions here: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens +client = OpenAI( + base_url="https://models.github.ai/inference", + api_key=os.environ["GITHUB_TOKEN"], +) + +response = client.chat.completions.create( + messages=[ + { + "role": "system", + "content": "", + }, + { + "role": "user", + "content": "What is the capital of France?", + } + ], + model="openai/gpt-4o-mini", + temperature=1, + max_tokens=4096, + top_p=1 +) + +print(response.choices[0].message.content) \ No newline at end of file diff --git a/09-chat-project/frontend/app.js b/09-chat-project/frontend/app.js new file mode 100644 index 00000000..385b5be0 --- /dev/null +++ b/09-chat-project/frontend/app.js @@ -0,0 +1 @@ +// js code \ No newline at end of file diff --git a/09-chat-project/frontend/index.html b/09-chat-project/frontend/index.html new file mode 100644 index 00000000..52125560 --- /dev/null +++ b/09-chat-project/frontend/index.html @@ -0,0 +1,6 @@ + + + Chat app + + + \ No newline at end of file diff --git a/09-chat-project/frontend/styles.css b/09-chat-project/frontend/styles.css new file mode 100644 index 00000000..1ce2089e --- /dev/null +++ b/09-chat-project/frontend/styles.css @@ -0,0 +1,3 @@ +/* body { + +} */ \ No newline at end of file