langroid 0.31.2__py3-none-any.whl → 0.33.3__py3-none-any.whl

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.
Files changed (163) hide show
  1. {langroid-0.31.2.dist-info → langroid-0.33.3.dist-info}/METADATA +150 -124
  2. langroid-0.33.3.dist-info/RECORD +7 -0
  3. {langroid-0.31.2.dist-info → langroid-0.33.3.dist-info}/WHEEL +1 -1
  4. langroid-0.33.3.dist-info/entry_points.txt +4 -0
  5. pyproject.toml +317 -212
  6. langroid/__init__.py +0 -106
  7. langroid/agent/.chainlit/config.toml +0 -121
  8. langroid/agent/.chainlit/translations/bn.json +0 -231
  9. langroid/agent/.chainlit/translations/en-US.json +0 -229
  10. langroid/agent/.chainlit/translations/gu.json +0 -231
  11. langroid/agent/.chainlit/translations/he-IL.json +0 -231
  12. langroid/agent/.chainlit/translations/hi.json +0 -231
  13. langroid/agent/.chainlit/translations/kn.json +0 -231
  14. langroid/agent/.chainlit/translations/ml.json +0 -231
  15. langroid/agent/.chainlit/translations/mr.json +0 -231
  16. langroid/agent/.chainlit/translations/ta.json +0 -231
  17. langroid/agent/.chainlit/translations/te.json +0 -231
  18. langroid/agent/.chainlit/translations/zh-CN.json +0 -229
  19. langroid/agent/__init__.py +0 -41
  20. langroid/agent/base.py +0 -1981
  21. langroid/agent/batch.py +0 -398
  22. langroid/agent/callbacks/__init__.py +0 -0
  23. langroid/agent/callbacks/chainlit.py +0 -598
  24. langroid/agent/chat_agent.py +0 -1899
  25. langroid/agent/chat_document.py +0 -454
  26. langroid/agent/helpers.py +0 -0
  27. langroid/agent/junk +0 -13
  28. langroid/agent/openai_assistant.py +0 -882
  29. langroid/agent/special/__init__.py +0 -59
  30. langroid/agent/special/arangodb/__init__.py +0 -0
  31. langroid/agent/special/arangodb/arangodb_agent.py +0 -656
  32. langroid/agent/special/arangodb/system_messages.py +0 -186
  33. langroid/agent/special/arangodb/tools.py +0 -107
  34. langroid/agent/special/arangodb/utils.py +0 -36
  35. langroid/agent/special/doc_chat_agent.py +0 -1466
  36. langroid/agent/special/lance_doc_chat_agent.py +0 -262
  37. langroid/agent/special/lance_rag/__init__.py +0 -9
  38. langroid/agent/special/lance_rag/critic_agent.py +0 -198
  39. langroid/agent/special/lance_rag/lance_rag_task.py +0 -82
  40. langroid/agent/special/lance_rag/query_planner_agent.py +0 -260
  41. langroid/agent/special/lance_tools.py +0 -61
  42. langroid/agent/special/neo4j/__init__.py +0 -0
  43. langroid/agent/special/neo4j/csv_kg_chat.py +0 -174
  44. langroid/agent/special/neo4j/neo4j_chat_agent.py +0 -433
  45. langroid/agent/special/neo4j/system_messages.py +0 -120
  46. langroid/agent/special/neo4j/tools.py +0 -32
  47. langroid/agent/special/relevance_extractor_agent.py +0 -127
  48. langroid/agent/special/retriever_agent.py +0 -56
  49. langroid/agent/special/sql/__init__.py +0 -17
  50. langroid/agent/special/sql/sql_chat_agent.py +0 -654
  51. langroid/agent/special/sql/utils/__init__.py +0 -21
  52. langroid/agent/special/sql/utils/description_extractors.py +0 -190
  53. langroid/agent/special/sql/utils/populate_metadata.py +0 -85
  54. langroid/agent/special/sql/utils/system_message.py +0 -35
  55. langroid/agent/special/sql/utils/tools.py +0 -64
  56. langroid/agent/special/table_chat_agent.py +0 -263
  57. langroid/agent/structured_message.py +0 -9
  58. langroid/agent/task.py +0 -2093
  59. langroid/agent/tool_message.py +0 -393
  60. langroid/agent/tools/__init__.py +0 -38
  61. langroid/agent/tools/duckduckgo_search_tool.py +0 -50
  62. langroid/agent/tools/file_tools.py +0 -234
  63. langroid/agent/tools/google_search_tool.py +0 -39
  64. langroid/agent/tools/metaphor_search_tool.py +0 -67
  65. langroid/agent/tools/orchestration.py +0 -303
  66. langroid/agent/tools/recipient_tool.py +0 -235
  67. langroid/agent/tools/retrieval_tool.py +0 -32
  68. langroid/agent/tools/rewind_tool.py +0 -137
  69. langroid/agent/tools/segment_extract_tool.py +0 -41
  70. langroid/agent/typed_task.py +0 -19
  71. langroid/agent/xml_tool_message.py +0 -382
  72. langroid/agent_config.py +0 -0
  73. langroid/cachedb/__init__.py +0 -17
  74. langroid/cachedb/base.py +0 -58
  75. langroid/cachedb/momento_cachedb.py +0 -108
  76. langroid/cachedb/redis_cachedb.py +0 -153
  77. langroid/embedding_models/__init__.py +0 -39
  78. langroid/embedding_models/base.py +0 -74
  79. langroid/embedding_models/clustering.py +0 -189
  80. langroid/embedding_models/models.py +0 -461
  81. langroid/embedding_models/protoc/__init__.py +0 -0
  82. langroid/embedding_models/protoc/embeddings.proto +0 -19
  83. langroid/embedding_models/protoc/embeddings_pb2.py +0 -33
  84. langroid/embedding_models/protoc/embeddings_pb2.pyi +0 -50
  85. langroid/embedding_models/protoc/embeddings_pb2_grpc.py +0 -79
  86. langroid/embedding_models/remote_embeds.py +0 -153
  87. langroid/exceptions.py +0 -65
  88. langroid/experimental/team-save.py +0 -391
  89. langroid/language_models/.chainlit/config.toml +0 -121
  90. langroid/language_models/.chainlit/translations/en-US.json +0 -231
  91. langroid/language_models/__init__.py +0 -53
  92. langroid/language_models/azure_openai.py +0 -153
  93. langroid/language_models/base.py +0 -678
  94. langroid/language_models/config.py +0 -18
  95. langroid/language_models/mock_lm.py +0 -124
  96. langroid/language_models/openai_gpt.py +0 -1923
  97. langroid/language_models/prompt_formatter/__init__.py +0 -16
  98. langroid/language_models/prompt_formatter/base.py +0 -40
  99. langroid/language_models/prompt_formatter/hf_formatter.py +0 -132
  100. langroid/language_models/prompt_formatter/llama2_formatter.py +0 -75
  101. langroid/language_models/utils.py +0 -147
  102. langroid/mytypes.py +0 -84
  103. langroid/parsing/__init__.py +0 -52
  104. langroid/parsing/agent_chats.py +0 -38
  105. langroid/parsing/code-parsing.md +0 -86
  106. langroid/parsing/code_parser.py +0 -121
  107. langroid/parsing/config.py +0 -0
  108. langroid/parsing/document_parser.py +0 -718
  109. langroid/parsing/image_text.py +0 -32
  110. langroid/parsing/para_sentence_split.py +0 -62
  111. langroid/parsing/parse_json.py +0 -155
  112. langroid/parsing/parser.py +0 -313
  113. langroid/parsing/repo_loader.py +0 -790
  114. langroid/parsing/routing.py +0 -36
  115. langroid/parsing/search.py +0 -275
  116. langroid/parsing/spider.py +0 -102
  117. langroid/parsing/table_loader.py +0 -94
  118. langroid/parsing/url_loader.py +0 -111
  119. langroid/parsing/url_loader_cookies.py +0 -73
  120. langroid/parsing/urls.py +0 -273
  121. langroid/parsing/utils.py +0 -373
  122. langroid/parsing/web_search.py +0 -155
  123. langroid/prompts/__init__.py +0 -9
  124. langroid/prompts/chat-gpt4-system-prompt.md +0 -68
  125. langroid/prompts/dialog.py +0 -17
  126. langroid/prompts/prompts_config.py +0 -5
  127. langroid/prompts/templates.py +0 -141
  128. langroid/pydantic_v1/__init__.py +0 -10
  129. langroid/pydantic_v1/main.py +0 -4
  130. langroid/utils/.chainlit/config.toml +0 -121
  131. langroid/utils/.chainlit/translations/en-US.json +0 -231
  132. langroid/utils/__init__.py +0 -19
  133. langroid/utils/algorithms/__init__.py +0 -3
  134. langroid/utils/algorithms/graph.py +0 -103
  135. langroid/utils/configuration.py +0 -98
  136. langroid/utils/constants.py +0 -30
  137. langroid/utils/docker.py +0 -37
  138. langroid/utils/git_utils.py +0 -252
  139. langroid/utils/globals.py +0 -49
  140. langroid/utils/llms/__init__.py +0 -0
  141. langroid/utils/llms/strings.py +0 -8
  142. langroid/utils/logging.py +0 -135
  143. langroid/utils/object_registry.py +0 -66
  144. langroid/utils/output/__init__.py +0 -20
  145. langroid/utils/output/citations.py +0 -41
  146. langroid/utils/output/printing.py +0 -99
  147. langroid/utils/output/status.py +0 -40
  148. langroid/utils/pandas_utils.py +0 -30
  149. langroid/utils/pydantic_utils.py +0 -602
  150. langroid/utils/system.py +0 -286
  151. langroid/utils/types.py +0 -93
  152. langroid/utils/web/__init__.py +0 -0
  153. langroid/utils/web/login.py +0 -83
  154. langroid/vector_store/__init__.py +0 -50
  155. langroid/vector_store/base.py +0 -357
  156. langroid/vector_store/chromadb.py +0 -214
  157. langroid/vector_store/lancedb.py +0 -401
  158. langroid/vector_store/meilisearch.py +0 -299
  159. langroid/vector_store/momento.py +0 -278
  160. langroid/vector_store/qdrant_cloud.py +0 -6
  161. langroid/vector_store/qdrantdb.py +0 -468
  162. langroid-0.31.2.dist-info/RECORD +0 -162
  163. {langroid-0.31.2.dist-info → langroid-0.33.3.dist-info/licenses}/LICENSE +0 -0
@@ -1,155 +0,0 @@
1
- """
2
- Utilities for web search.
3
-
4
- NOTE: Using Google Search requires setting the GOOGLE_API_KEY and GOOGLE_CSE_ID
5
- environment variables in your `.env` file, as explained in the
6
- [README](https://github.com/langroid/langroid#gear-installation-and-setup).
7
- """
8
-
9
- import os
10
- from typing import Dict, List
11
-
12
- import requests
13
- from bs4 import BeautifulSoup
14
- from dotenv import load_dotenv
15
- from duckduckgo_search import DDGS
16
- from googleapiclient.discovery import Resource, build
17
- from requests.models import Response
18
-
19
-
20
- class WebSearchResult:
21
- """
22
- Class representing a Web Search result, containing the title, link,
23
- summary and full content of the result.
24
- """
25
-
26
- def __init__(
27
- self,
28
- title: str,
29
- link: str,
30
- max_content_length: int = 3500,
31
- max_summary_length: int = 300,
32
- ):
33
- """
34
- Args:
35
- title (str): The title of the search result.
36
- link (str): The link to the search result.
37
- max_content_length (int): The maximum length of the full content.
38
- max_summary_length (int): The maximum length of the summary.
39
- """
40
- self.title = title
41
- self.link = link
42
- self.max_content_length = max_content_length
43
- self.max_summary_length = max_summary_length
44
- self.full_content = self.get_full_content()
45
- self.summary = self.get_summary()
46
-
47
- def get_summary(self) -> str:
48
- return self.full_content[: self.max_summary_length]
49
-
50
- def get_full_content(self) -> str:
51
- try:
52
- response: Response = requests.get(self.link)
53
- soup: BeautifulSoup = BeautifulSoup(response.text, "lxml")
54
- text = " ".join(soup.stripped_strings)
55
- return text[: self.max_content_length]
56
- except Exception as e:
57
- return f"Error fetching content from {self.link}: {e}"
58
-
59
- def __str__(self) -> str:
60
- return f"Title: {self.title}\nLink: {self.link}\nSummary: {self.summary}"
61
-
62
- def to_dict(self) -> Dict[str, str]:
63
- return {
64
- "title": self.title,
65
- "link": self.link,
66
- "summary": self.summary,
67
- "full_content": self.full_content,
68
- }
69
-
70
-
71
- def google_search(query: str, num_results: int = 5) -> List[WebSearchResult]:
72
- load_dotenv()
73
- api_key = os.getenv("GOOGLE_API_KEY")
74
- cse_id = os.getenv("GOOGLE_CSE_ID")
75
- service: Resource = build("customsearch", "v1", developerKey=api_key)
76
- raw_results = (
77
- service.cse().list(q=query, cx=cse_id, num=num_results).execute()["items"]
78
- )
79
-
80
- return [
81
- WebSearchResult(result["title"], result["link"], 3500, 300)
82
- for result in raw_results
83
- ]
84
-
85
-
86
- def metaphor_search(query: str, num_results: int = 5) -> List[WebSearchResult]:
87
- """
88
- Method that makes an API call by Metaphor client that queries
89
- the top num_results links that matches the query. Returns a list
90
- of WebSearchResult objects.
91
-
92
- Args:
93
- query (str): The query body that users wants to make.
94
- num_results (int): Number of top matching results that we want
95
- to grab
96
- """
97
-
98
- load_dotenv()
99
-
100
- api_key = os.getenv("METAPHOR_API_KEY") or os.getenv("EXA_API_KEY")
101
- if not api_key:
102
- raise ValueError(
103
- """
104
- Neither METAPHOR_API_KEY nor EXA_API_KEY environment variables are set.
105
- Please set one of them to your API key, and try again.
106
- """
107
- )
108
-
109
- try:
110
- from metaphor_python import Metaphor
111
- except ImportError:
112
- raise ImportError(
113
- "You are attempting to use the `metaphor_python` library;"
114
- "To use it, please install langroid with the `metaphor` extra, e.g. "
115
- "`pip install langroid[metaphor]` or `poetry add langroid[metaphor]` "
116
- "(it installs the `metaphor_python` package from pypi)."
117
- )
118
-
119
- client = Metaphor(api_key=api_key)
120
-
121
- response = client.search(
122
- query=query,
123
- num_results=num_results,
124
- )
125
- raw_results = response.results
126
-
127
- return [
128
- WebSearchResult(result.title, result.url, 3500, 300) for result in raw_results
129
- ]
130
-
131
-
132
- def duckduckgo_search(query: str, num_results: int = 5) -> List[WebSearchResult]:
133
- """
134
- Method that makes an API call by DuckDuckGo client that queries
135
- the top `num_results` links that matche the query. Returns a list
136
- of WebSearchResult objects.
137
-
138
- Args:
139
- query (str): The query body that users wants to make.
140
- num_results (int): Number of top matching results that we want
141
- to grab
142
- """
143
-
144
- with DDGS() as ddgs:
145
- search_results = [r for r in ddgs.text(query, max_results=num_results)]
146
-
147
- return [
148
- WebSearchResult(
149
- title=result["title"],
150
- link=result["href"],
151
- max_content_length=3500,
152
- max_summary_length=300,
153
- )
154
- for result in search_results
155
- ]
@@ -1,9 +0,0 @@
1
- from . import dialog
2
- from . import prompts_config
3
- from . import templates
4
-
5
- __all__ = [
6
- "dialog",
7
- "prompts_config",
8
- "templates",
9
- ]
@@ -1,68 +0,0 @@
1
- Image input capabilities: Enabled
2
-
3
- Tools
4
- python
5
- When you send a message containing Python code to python, it will be executed in a
6
- stateful Jupyter notebook environment. python will respond with the output of the execution or time out after 60.0
7
- seconds. The drive at '/mnt/data' can be used to save and persist user files. Internet access for this session is disabled. Do not make external web requests or API calls as they will fail.
8
-
9
- dalle
10
- // Whenever a description of an image is given, create a prompt that dalle can use to generate the image and abide to the following policy:
11
- // 1. The prompt must be in English. Translate to English if needed.
12
- // 2. DO NOT ask for permission to generate the image, just do it!
13
- // 3. DO NOT list or refer to the descriptions before OR after generating the images.
14
- // 4. Do not create more than 1 image, even if the user requests more.
15
- // 5. Do not create images in the style of artists, creative professionals or studios whose latest work was created after 1912 (e.g. Picasso, Kahlo).
16
- // - You can name artists, creative professionals or studios in prompts only if their latest work was created prior to 1912 (e.g. Van Gogh, Goya)
17
- // - If asked to generate an image that would violate this policy, instead apply the following procedure: (a) substitute the artist's name with three adjectives that capture key aspects of the style; (b) include an associated artistic movement or era to provide context; and (c) mention the primary medium used by the artist
18
- // 6. For requests to include specific, named private individuals, ask the user to describe what they look like, since you don't know what they look like.
19
- // 7. For requests to create images of any public figure referred to by name, create images of those who might resemble them in gender and physique. But they shouldn't look like them. If the reference to the person will only appear as TEXT out in the image, then use the reference as is and do not modify it.
20
- // 8. Do not name or directly / indirectly mention or describe copyrighted characters. Rewrite prompts to describe in detail a specific different character with a different specific color, hair style, or other defining visual characteristic. Do not discuss copyright policies in responses.
21
- // The generated prompt sent to dalle should be very detailed, and around 100 words long.
22
- // Example dalle invocation:
23
- // // { // "prompt": "<insert prompt here>" // } //
24
- namespace dalle {
25
-
26
- // Create images from a text-only prompt.
27
- type text2im = (_: {
28
- // The size of the requested image. Use 1024x1024 (square) as the default, 1792x1024 if the user requests a wide image, and 1024x1792 for full-body portraits. Always include this parameter in the request.
29
- size?: "1792x1024" | "1024x1024" | "1024x1792",
30
- // The number of images to generate. If the user does not specify a number, generate 1 image.
31
- n?: number, // default: 2
32
- // The detailed image description, potentially modified to abide by the dalle policies. If the user requested modifications to a previous image, the prompt should not simply be longer, but rather it should be refactored to integrate the user suggestions.
33
- prompt: string,
34
- // If the user references a previous image, this field should be populated with the gen_id from the dalle image metadata.
35
- referenced_image_ids?: string[],
36
- }) => any;
37
-
38
- } // namespace dalle
39
-
40
- voice_mode
41
- // Voice mode functions are not available in text conversations.
42
- namespace voice_mode {
43
-
44
- } // namespace voice_mode
45
-
46
- browser
47
- You have the tool browser. Use browser in the following circumstances:
48
- - User is asking about current events or something that requires real-time information (weather, sports scores, etc.)
49
- - User is asking about some term you are totally unfamiliar with (it might be new)
50
- - User explicitly asks you to browse or provide links to references
51
-
52
- Given a query that requires retrieval, your turn will consist of three steps:
53
-
54
- Call the search function to get a list of results.
55
- Call the mclick function to retrieve a diverse and high-quality subset of these results (in parallel). Remember to SELECT AT LEAST 3 sources when using mclick.
56
- Write a response to the user based on these results. In your response, cite sources using the citation format below.
57
- In some cases, you should repeat step 1 twice, if the initial results are unsatisfactory, and you believe that you can refine the query to get better results.
58
-
59
- You can also open a url directly if one is provided by the user. Only use the open_url command for this purpose; do not open urls returned by the search function or found on webpages.
60
-
61
- The browser tool has the following commands:
62
- search(query: str, recency_days: int) Issues a query to a search engine and displays the results.
63
- mclick(ids: list[str]). Retrieves the contents of the webpages with provided IDs (indices). You should ALWAYS SELECT AT LEAST 3 and at most 10 pages. Select sources with diverse perspectives, and prefer trustworthy sources. Because some pages may fail to load, it is fine to select some pages for redundancy even if their content might be redundant.
64
- open_url(url: str) Opens the given URL and displays it.
65
-
66
- For citing quotes from the 'browser' tool: please render in this format: 【{message idx}†{link text}】.
67
- For long citations: please render in this format: [link text](message idx).
68
- Otherwise do not render links.
@@ -1,17 +0,0 @@
1
- from typing import List
2
-
3
-
4
- def collate_chat_history(inputs: List[tuple[str, str]]) -> str:
5
- """
6
- Collate (human, ai) pairs into a single, string
7
- Args:
8
- inputs:
9
- Returns:
10
- """
11
- pairs = [
12
- f"""Human:{human}
13
- AI:{ai}
14
- """
15
- for human, ai in inputs
16
- ]
17
- return "\n".join(pairs)
@@ -1,5 +0,0 @@
1
- from langroid.pydantic_v1 import BaseSettings
2
-
3
-
4
- class PromptsConfig(BaseSettings):
5
- max_tokens: int = 1000 # for output; NOT USED ANYWHERE
@@ -1,141 +0,0 @@
1
- from langroid.utils.constants import NO_ANSWER
2
-
3
- EXTRACT_RELEVANT = """
4
- Here is a passage from a long document, followed by a question.
5
- In case the passage contains any text relevant to answer the question, return it
6
- verbatim.
7
- {passage}
8
- Question:{question}
9
- Relevant text, if any: """.strip()
10
-
11
- EXTRACTION_PROMPT_GPT4 = f"""
12
- Given the content and question below, extract COMPLETE SENTENCES OR PHRASES
13
- VERBATIM from the content, that are relevant to answering the question (if such text
14
- exists), even if it contradicts your knowledge, and even if it is factually incorrect.
15
- Do not make up an answer that is not supported by the content.
16
- When you answer, be concise, no need to explain anything. If there is no relevant text,
17
- simply say {NO_ANSWER}.
18
-
19
- Content: {{content}}
20
- Question: {{question}}
21
- Relevant text, if any:
22
- """
23
-
24
- EXTRACTION_PROMPT = f"""
25
- Given the content and question below, extract a COMPLETE SENTENCE verbatim from the
26
- content that is relevant to answering the question (if such text exists). Do not
27
- make up an answer.
28
-
29
- Content: The Eiffel Tower is a wrought-iron lattice tower on the Champ de Mars in
30
- Paris, France. It is named after Gustave Eiffel, whose company designed and built
31
- the tower. It is a recognizable landmark.
32
- Question: Where is the Eiffel Tower located?
33
- Relevant text, if any: on the Champ de Mars in Paris, France.
34
-
35
- Content: Apples and oranges are both fruits, but differ in taste and texture.
36
- Apples are sweet and crisp, while oranges are citrusy and juicy. Both are
37
- nutritious and commonly consumed worldwide.
38
- Question: What are the similarities between apples and oranges?
39
- Relevant text, if any: both fruits
40
-
41
- Content: The sun rises in the east and sets in the west. It is a source of light
42
- and warmth for the Earth.
43
- Question: What is the color of the sun?
44
- Relevant text, if any: {NO_ANSWER}
45
-
46
- Content: {{content}}
47
- Question: {{question}}
48
- Relevant text (COMPLETE SENTENCE), if any:
49
- """.strip()
50
-
51
- SUMMARY_ANSWER_PROMPT_GPT4 = f"""
52
-
53
- Use the provided NUMBERED extracts (with sources) to answer the QUESTION.
54
- If there's not enough information, respond with {NO_ANSWER}. Use only the
55
- information in these extracts, even if your answer is factually incorrect,
56
- and even if the answer contradicts other parts of the document. The only
57
- important thing is that your answer is consistent with and supported by the
58
- extracts. Compose your complete answer, inserting CITATIONS in MARKDOWN format
59
- [^i][^j] where i,j,... are the extract NUMBERS you are
60
- citing.
61
- For example your answer might look like this (NOTE HOW multiple citations
62
- are grouped as [^2][^5]):
63
-
64
- Beethoven composed the 9th symphony in 1824.[^1] After that he became deaf
65
- and could not hear his own music. [^2][^5]. He was a prolific composer and
66
- wrote many famous pieces.
67
-
68
- NUMBERED EXTRACTS:
69
-
70
- {{extracts}}
71
-
72
- QUESTION:
73
- {{question}}
74
-
75
- """.strip()
76
-
77
- ANSWER_PROMPT_USE_HISTORY_GPT4 = f"""
78
-
79
- Use ANY of the information earlier, as well as the extracts provided below
80
- (with sources) to answer the question. If there's not
81
- enough information, respond with {NO_ANSWER}.
82
- Use only the information in this conversation or these extracts,
83
- even if your answer is factually incorrect, and even
84
- if the answer contracts other parts of the document.
85
- The only important thing is that your answer is
86
- consistent with information provided here or earlier.
87
- Compose your complete answer and cite all supporting sources
88
- on a separate separate line as "SOURCE:".
89
- When citing a SOURCE: be concise, whether it refers to a source in these
90
- extracts, or info provided earlier.
91
-
92
- {{extracts}}
93
- {{question}}
94
- Answer:
95
- """.strip()
96
-
97
-
98
- SUMMARY_ANSWER_PROMPT = f"""
99
- Use the provided extracts (with sources) to answer the question.
100
- If there's not enough information, respond with {NO_ANSWER}.
101
- Use only the information in these extracts, even if it contradicts your prior
102
- knowledge. Justify your answer by citing your sources, as in these examples:
103
-
104
- Extract: The tree species in the garden include oak, maple, and birch.
105
- Source: https://en.wikipedia.org/wiki/Tree
106
- Extract: The oak trees are known for their longevity and strength.
107
- Source: https://en.wikipedia.org/wiki/Oak
108
- Question: What types of trees are in the garden?
109
- Answer: The types of trees in the garden include oak, maple, and birch.
110
- SOURCE: https://en.wikipedia.org/wiki/Tree
111
- TEXT: The tree species in the garden include oak, maple, and birch.
112
-
113
- Extract: The experiment involved three groups: control, low dose, and high
114
- dose.
115
- Source: https://en.wikipedia.org/wiki/Experiment
116
- Extract: The high dose group showed significant improvement in symptoms.
117
- Source: https://en.wikipedia.org/wiki/Experiment
118
- Extract: The control group did not receive any
119
- treatment and served as a baseline.
120
- Source: https://en.wikipedia.org/wiki/Experiment
121
- Question: How many groups were involved which group showed significant
122
- improvement?
123
- Answer: There were three groups and the high dose group showed significant
124
- improvement in symptoms.
125
- SOURCE: https://en.wikipedia.org/wiki/Experiment
126
- TEXT: The experiment involved three groups: control, low dose, and high dose.
127
- SOURCE: https://en.wikipedia.org/wiki/Experiment
128
- TEXT: The high dose group showed significant improvement in symptoms.
129
-
130
-
131
- Extract: The CEO announced several new initiatives during the company meeting.
132
- Source: https://en.wikipedia.org/wiki/CEO
133
- Extract: The financial performance of the company has been strong this year.
134
- Source: https://en.wikipedia.org/wiki/CEO
135
- Question: What new initiatives did the CEO announce?
136
- Answer: {NO_ANSWER}
137
-
138
- {{extracts}}
139
- {{question}}
140
- Answer:
141
- """.strip()
@@ -1,10 +0,0 @@
1
- """
2
- If we're on Pydantic v2, use the v1 namespace, else just use the main namespace.
3
-
4
- This allows compatibility with both Pydantic v1 and v2
5
- """
6
-
7
- try:
8
- from pydantic.v1 import * # noqa: F403, F401
9
- except ImportError:
10
- from pydantic import * # type: ignore # noqa: F403, F401
@@ -1,4 +0,0 @@
1
- try:
2
- from pydantic.v1.main import * # noqa: F403, F401
3
- except ImportError:
4
- from pydantic.main import * # type: ignore # noqa: F403, F401
@@ -1,121 +0,0 @@
1
- [project]
2
- # Whether to enable telemetry (default: true). No personal data is collected.
3
- enable_telemetry = true
4
-
5
-
6
- # List of environment variables to be provided by each user to use the app.
7
- user_env = []
8
-
9
- # Duration (in seconds) during which the session is saved when the connection is lost
10
- session_timeout = 3600
11
-
12
- # Enable third parties caching (e.g LangChain cache)
13
- cache = false
14
-
15
- # Authorized origins
16
- allow_origins = ["*"]
17
-
18
- # Follow symlink for asset mount (see https://github.com/Chainlit/chainlit/issues/317)
19
- # follow_symlink = false
20
-
21
- [features]
22
- # Show the prompt playground
23
- prompt_playground = true
24
-
25
- # 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)
26
- unsafe_allow_html = false
27
-
28
- # Process and display mathematical expressions. This can clash with "$" characters in messages.
29
- latex = false
30
-
31
- # Automatically tag threads with the current chat profile (if a chat profile is used)
32
- auto_tag_thread = true
33
-
34
- # Authorize users to spontaneously upload files with messages
35
- [features.spontaneous_file_upload]
36
- enabled = true
37
- accept = ["*/*"]
38
- max_files = 20
39
- max_size_mb = 500
40
-
41
- [features.audio]
42
- # Threshold for audio recording
43
- min_decibels = -45
44
- # Delay for the user to start speaking in MS
45
- initial_silence_timeout = 3000
46
- # Delay for the user to continue speaking in MS. If the user stops speaking for this duration, the recording will stop.
47
- silence_timeout = 1500
48
- # Above this duration (MS), the recording will forcefully stop.
49
- max_duration = 15000
50
- # Duration of the audio chunks in MS
51
- chunk_duration = 1000
52
- # Sample rate of the audio
53
- sample_rate = 44100
54
-
55
- [UI]
56
- # Name of the app and chatbot.
57
- name = "Chatbot"
58
-
59
- # Show the readme while the thread is empty.
60
- show_readme_as_default = true
61
-
62
- # Description of the app and chatbot. This is used for HTML tags.
63
- # description = ""
64
-
65
- # Large size content are by default collapsed for a cleaner ui
66
- default_collapse_content = true
67
-
68
- # The default value for the expand messages settings.
69
- default_expand_messages = false
70
-
71
- # Hide the chain of thought details from the user in the UI.
72
- hide_cot = false
73
-
74
- # Link to your github repo. This will add a github button in the UI's header.
75
- # github = ""
76
-
77
- # Specify a CSS file that can be used to customize the user interface.
78
- # The CSS file can be served from the public directory or via an external link.
79
- # custom_css = "/public/test.css"
80
-
81
- # Specify a Javascript file that can be used to customize the user interface.
82
- # The Javascript file can be served from the public directory.
83
- # custom_js = "/public/test.js"
84
-
85
- # Specify a custom font url.
86
- # custom_font = "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap"
87
-
88
- # Specify a custom meta image url.
89
- # custom_meta_image_url = "https://chainlit-cloud.s3.eu-west-3.amazonaws.com/logo/chainlit_banner.png"
90
-
91
- # Specify a custom build directory for the frontend.
92
- # This can be used to customize the frontend code.
93
- # Be careful: If this is a relative path, it should not start with a slash.
94
- # custom_build = "./public/build"
95
-
96
- [UI.theme]
97
- #layout = "wide"
98
- #font_family = "Inter, sans-serif"
99
- # Override default MUI light theme. (Check theme.ts)
100
- [UI.theme.light]
101
- #background = "#FAFAFA"
102
- #paper = "#FFFFFF"
103
-
104
- [UI.theme.light.primary]
105
- #main = "#F80061"
106
- #dark = "#980039"
107
- #light = "#FFE7EB"
108
-
109
- # Override default MUI dark theme. (Check theme.ts)
110
- [UI.theme.dark]
111
- #background = "#FAFAFA"
112
- #paper = "#FFFFFF"
113
-
114
- [UI.theme.dark.primary]
115
- #main = "#F80061"
116
- #dark = "#980039"
117
- #light = "#FFE7EB"
118
-
119
-
120
- [meta]
121
- generated_by = "1.1.202"