zenivan commited on
Commit
6158a7d
·
1 Parent(s): dacd430

reasoning

Browse files
Files changed (4) hide show
  1. README.md +0 -4
  2. app/main_gradio_test_FS.py +10 -8
  3. app/prompt.py +15 -0
  4. docs/file_search +35 -0
README.md CHANGED
@@ -11,10 +11,6 @@ short_description: Помощник в создании логопедическ
11
  ---
12
 
13
 
14
- CHECK
15
- CHECK
16
- CHECK
17
- CHECK
18
  git add .
19
  git commit -m "..."
20
  git push space main
 
11
  ---
12
 
13
 
 
 
 
 
14
  git add .
15
  git commit -m "..."
16
  git push space main
app/main_gradio_test_FS.py CHANGED
@@ -15,6 +15,7 @@ import logging
15
  from app.quotes import quotes
16
  from app.drawings import drawings
17
  import app.prompt
 
18
  # Настройка логирования
19
  logging.basicConfig(
20
  level=logging.INFO,
@@ -85,7 +86,7 @@ def generate_lesson_plan_interface(
85
  количество_детей = 1 # Принудительно для индивидуального занятия
86
  params["количество_детей"] = 1 # И обновляем словарь параметров
87
 
88
- instructions = app.prompt.INSTRUCTIONS_3
89
 
90
  # file_search_section = ""
91
  # if разрешен_file_search:
@@ -105,9 +106,9 @@ def generate_lesson_plan_interface(
105
  - **Цель занятия:** {цель_занятия}
106
  - **Тема:** {тема or "не указано - определи самостоятельно"}
107
  - **Формат:** {формат_занятия} ({количество_детей} детей)
108
- - **Инвентарь:** {инвентарь or "не указан - предложи варианты"}
109
  - **Наличие домашнего задания:** {наличие_ДЗ or "не требуется"}
110
- - **Особые условия:** {особые_условия or "не требуются"}
111
  - **Длительность:** {длительность_занятия} минут
112
  - **Месяц года:** {текущий_месяц}
113
  """
@@ -119,7 +120,7 @@ def generate_lesson_plan_interface(
119
  tools.append({
120
  "type": "file_search",
121
  "vector_store_ids": [VS_ID],
122
- "max_num_results": 15
123
  })
124
  tool_choice = {"type": "file_search"}
125
  #WEB SEARCH
@@ -132,14 +133,15 @@ def generate_lesson_plan_interface(
132
  # tool_choice = {"type": "web_search_preview"}
133
 
134
  response = client.responses.create(
135
- instructions=instructions,
136
  input=prompt,
137
- model=os.getenv("MODEL"),
138
  tools=tools if tools else None,
139
  tool_choice=tool_choice,
140
  include=["file_search_call.results"],
141
- max_output_tokens=4000,
142
- temperature=float(os.getenv("TEMPERATURE", 1)),
 
143
  stream=False
144
  )
145
 
 
15
  from app.quotes import quotes
16
  from app.drawings import drawings
17
  import app.prompt
18
+
19
  # Настройка логирования
20
  logging.basicConfig(
21
  level=logging.INFO,
 
86
  количество_детей = 1 # Принудительно для индивидуального занятия
87
  params["количество_детей"] = 1 # И обновляем словарь параметров
88
 
89
+ # instructions =
90
 
91
  # file_search_section = ""
92
  # if разрешен_file_search:
 
106
  - **Цель занятия:** {цель_занятия}
107
  - **Тема:** {тема or "не указано - определи самостоятельно"}
108
  - **Формат:** {формат_занятия} ({количество_детей} детей)
109
+ - **Инвентарь:** {инвентарь or "не указан - на твое усмотрение"}
110
  - **Наличие домашнего задания:** {наличие_ДЗ or "не требуется"}
111
+ - **Индивидуальные особенности:** {особые_условия or "нет"}
112
  - **Длительность:** {длительность_занятия} минут
113
  - **Месяц года:** {текущий_месяц}
114
  """
 
120
  tools.append({
121
  "type": "file_search",
122
  "vector_store_ids": [VS_ID],
123
+ "max_num_results": 20
124
  })
125
  tool_choice = {"type": "file_search"}
126
  #WEB SEARCH
 
133
  # tool_choice = {"type": "web_search_preview"}
134
 
135
  response = client.responses.create(
136
+ instructions=app.prompt.INSTRUCTIONS_4,
137
  input=prompt,
138
+ model="o3-mini", # gpt-4o-mini o3-mini
139
  tools=tools if tools else None,
140
  tool_choice=tool_choice,
141
  include=["file_search_call.results"],
142
+ max_output_tokens=4096,
143
+ temperature=float(os.getenv("TEMPERATURE", 1))
144
+ ,reasoning= {"effort":"medium"},
145
  stream=False
146
  )
147
 
app/prompt.py CHANGED
@@ -45,3 +45,18 @@ INSTRUCTIONS_3 = """
45
  Пользователь-логопед должен всегда понимать откуда берется каждое конкретное упражнение, каждый конкретный материал.
46
  Минимум общих слов, максимум конкретики из базы упражнений
47
  """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  Пользователь-логопед должен всегда понимать откуда берется каждое конкретное упражнение, каждый конкретный материал.
46
  Минимум общих слов, максимум конкретики из базы упражнений
47
  """
48
+
49
+ INSTRUCTIONS_4 = """
50
+ Ты - опытный логопед и составитель конспектов занятий с детьми с речевыми нарушениями.
51
+ Твоя задача - составить конспект, который действительно можно будет использовать
52
+ в логопедической практике.
53
+ Занятие должно быть выстроено по общим принципам проведения логопедических занятий.
54
+ В конспекте должны быть учтены все параметры занятия, которые прилагаются к этой инструцкии.
55
+ Занятие должно быть выстроено в игровом формате и иметь общую интересную канву.
56
+ Понимаешь, какая ответственность? Зато как интересно!
57
+ В помощь тебе база знаний - здесь много речевого материала,
58
+ заданий, упражнений - нужно обязательно использовать их при составлении заданий.
59
+ Но если запрос такой, что в материалах ничего не находится - сообщи об этом и не составляй план.
60
+ Конспект должен быть составлен "под ключ" - все упражнения с речевым материалом находится в конспекте
61
+ В конспекте должен быть только сам план и ничего лишнего - максимум конкретики
62
+ """
docs/file_search CHANGED
@@ -1,3 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  RETRIEVAL
2
  https://platform.openai.com/docs/guides/retrieval?attributes-filter-example=filename&vector-store-operations=create&vector-store-batch-operations=update
3
 
 
1
+ How it works
2
+ The file_search tool implements several retrieval best practices out of the box to help you extract the right data from your files and augment the model’s responses. The file_search tool:
3
+
4
+ Rewrites user queries to optimize them for search.
5
+ Breaks down complex user queries into multiple searches it can run in parallel.
6
+ Runs both keyword and semantic searches across both assistant and thread vector stores.
7
+ Reranks search results to pick the most relevant ones before generating the final response.
8
+ By default, the file_search tool uses the following settings but these can be configured to suit your needs:
9
+
10
+ Chunk size: 800 tokens
11
+ Chunk overlap: 400 tokens
12
+ Embedding model: text-embedding-3-large at 256 dimensions
13
+ Maximum number of chunks added to context: 20 (could be fewer)
14
+ Ranker: auto (OpenAI will choose which ranker to use)
15
+ Score threshold: 0 minimum ranking score
16
+ Known Limitations
17
+
18
+ We have a few known limitations we're working on adding support for in the coming months:
19
+
20
+ Support for deterministic pre-search filtering using custom metadata.
21
+ Support for parsing images within documents (including images of charts, graphs, tables etc.)
22
+ Support for retrievals over structured file formats (like csv or jsonl).
23
+ Better support for summarization — the tool today is optimized for search queries.
24
+
25
+
26
+
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
  RETRIEVAL
37
  https://platform.openai.com/docs/guides/retrieval?attributes-filter-example=filename&vector-store-operations=create&vector-store-batch-operations=update
38