alblack52 0.0.17__tar.gz → 0.0.18__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {alblack52-0.0.17 → alblack52-0.0.18}/PKG-INFO +1 -1
- alblack52-0.0.18/alblack52/ml.py +58 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52.egg-info/PKG-INFO +1 -1
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52.egg-info/SOURCES.txt +1 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/setup.py +1 -1
- {alblack52-0.0.17 → alblack52-0.0.18}/README.md +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/__init__.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/aws.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/chern.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/kudr.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/layers.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/loggingin.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/mikh.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/speedfilein.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/style.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/tensorclass.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/teor.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52/tv.py +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52.egg-info/dependency_links.txt +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52.egg-info/not-zip-safe +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/alblack52.egg-info/top_level.txt +0 -0
- {alblack52-0.0.17 → alblack52-0.0.18}/setup.cfg +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
API_URL = "https://api.deepinfra.com/v1/openai/chat/completions"
|
|
4
|
+
API_TOKEN = 'jwt:eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJnaDoxNjY1MzcyMzkiLCJleHAiOjE3NTMzNTQwNzV9.QKdE15memSb9qkqpTnO-PDP-p7NU0ymmaqTpc-YY_7s'
|
|
5
|
+
|
|
6
|
+
# fjkbsfbkjsbdfs
|
|
7
|
+
|
|
8
|
+
def ask_phind(messages):
|
|
9
|
+
headers = {
|
|
10
|
+
"Authorization": f"Bearer {API_TOKEN}",
|
|
11
|
+
"Content-Type": "application/json"
|
|
12
|
+
}
|
|
13
|
+
data = {
|
|
14
|
+
"model": "deepseek-ai/DeepSeek-R1-0528",
|
|
15
|
+
"messages": messages
|
|
16
|
+
}
|
|
17
|
+
response = requests.post(API_URL, headers=headers, json=data)
|
|
18
|
+
|
|
19
|
+
if response.status_code == 200:
|
|
20
|
+
response_json = response.json()
|
|
21
|
+
|
|
22
|
+
try:
|
|
23
|
+
return response_json["choices"][0]["message"]["content"]
|
|
24
|
+
except (KeyError, IndexError) as e:
|
|
25
|
+
return "Error: Unable to extract response content. Please check the response structure."
|
|
26
|
+
else:
|
|
27
|
+
return f"Error: {response.status_code}, {response.text}"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def chat_with_phind():
|
|
31
|
+
conversation_history = [
|
|
32
|
+
{"role": "system", "content": '''
|
|
33
|
+
Ты - эксперт в машинном обучении. Отвечай подробно и доходчиво.
|
|
34
|
+
'''},
|
|
35
|
+
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
while True:
|
|
39
|
+
question = input("You: ")
|
|
40
|
+
if question.lower() == 'exit':
|
|
41
|
+
print("Goodbye!")
|
|
42
|
+
break
|
|
43
|
+
|
|
44
|
+
conversation_history.append({"role": "user", "content": question})
|
|
45
|
+
|
|
46
|
+
answer = ask_phind(conversation_history)
|
|
47
|
+
|
|
48
|
+
conversation_history.append({"role": "assistant", "content": answer})
|
|
49
|
+
|
|
50
|
+
print("Ответ: " + answer)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def start():
|
|
54
|
+
chat_with_phind()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
if __name__ == "__main__":
|
|
58
|
+
chat_with_phind()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|