not-again-ai 0.10.0__py3-none-any.whl → 0.10.1__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.
@@ -165,7 +165,7 @@ def chat_completion(
165
165
  if seed is not None and response.system_fingerprint is not None:
166
166
  response_data["system_fingerprint"] = response.system_fingerprint
167
167
 
168
- response_data["response_duration"] = response_duration
168
+ response_data["response_duration"] = round(response_duration, 4)
169
169
 
170
170
  if len(response_data["choices"]) == 1:
171
171
  response_data.update(response_data["choices"][0])
@@ -33,7 +33,7 @@ def priority_truncation(
33
33
  Args:
34
34
  messages_unformatted: A list of dictionaries where each dictionary
35
35
  represents a message. Each message must have 'role' and 'content'
36
- keys with string values, where content is a string with any number of occurances of {{variable_name}}.
36
+ keys with string values, where content is a string with any number of occurrences of {{variable_name}}.
37
37
  variables: A dictionary where each key-value pair represents a variable name and its value to inject.
38
38
  priority: A list of variable names in their order of priority.
39
39
  token_limit: The maximum number of tokens allowed in the messages.
@@ -21,3 +21,7 @@ else:
21
21
  import openai # noqa: F401
22
22
  import tiktoken # noqa: F401
23
23
  import transformers # noqa: F401
24
+ from transformers.utils import logging
25
+
26
+ logging.disable_progress_bar()
27
+ logging.set_verbosity_error()
@@ -95,6 +95,6 @@ def chat_completion(
95
95
  response_data["completion_tokens"] = num_tokens_in_string(str(response_data["message"]), tokenizer)
96
96
 
97
97
  # Get the latency of the response
98
- response_data["response_duration"] = response_duration
98
+ response_data["response_duration"] = round(response_duration, 4)
99
99
 
100
100
  return response_data
@@ -12,4 +12,5 @@ OLLAMA_MODEL_MAPPING = {
12
12
  "granite-code": "ibm-granite/granite-34b-code-instruct",
13
13
  "llama3-gradient": "nvidia/Llama3-ChatQA-1.5-8B",
14
14
  "command-r": "CohereForAI/c4ai-command-r-v01",
15
+ "deepseek-coder-v2": "deepseek-ai/DeepSeek-Coder-V2-Lite-Base",
15
16
  }
@@ -1,19 +1,13 @@
1
1
  """By default use the associated huggingface transformer tokenizer.
2
2
  If it does not exist in the mapping, default to tiktoken with some buffer (const + percentage)"""
3
3
 
4
- import os
5
-
6
4
  from loguru import logger
7
5
  import tiktoken
6
+ from transformers import AutoTokenizer
8
7
 
9
8
  from not_again_ai.llm.openai_api.tokens import num_tokens_from_messages as openai_num_tokens_from_messages
10
9
  from not_again_ai.local_llm.ollama.model_mapping import OLLAMA_MODEL_MAPPING
11
10
 
12
- # Prevents the transformers library from printing advisories that are not relevant to this code like not having torch installed.
13
- os.environ["TRANSFORMERS_NO_ADVISORY_WARNINGS"] = "1"
14
-
15
- from transformers import AutoTokenizer # noqa: E402
16
-
17
11
  TIKTOKEN_NUM_TOKENS_BUFFER = 10
18
12
  TIKTOKEN_PERCENT_TOKENS_BUFFER = 1.1
19
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: not-again-ai
3
- Version: 0.10.0
3
+ Version: 0.10.1
4
4
  Summary: Designed to once and for all collect all the little things that come up over and over again in AI projects and put them in one place.
5
5
  Home-page: https://github.com/DaveCoDev/not-again-ai
6
6
  License: MIT
@@ -74,7 +74,7 @@ The package is split into subpackages, so you can install only the parts you nee
74
74
  1. If you wish to use OpenAI
75
75
  1. Go to https://platform.openai.com/settings/profile?tab=api-keys to get your API key.
76
76
  1. (Optional) Set the `OPENAI_API_KEY` and the `OPENAI_ORG_ID` environment variables.
77
- * **Local LLM**: `pip install not_again_ai[llm,llm_local]`
77
+ * **Local LLM**: `pip install not_again_ai[llm,local_llm]`
78
78
  1. Some HuggingFace transformers tokenizers are gated behind access requests. If you wish to use these, you will need to request access from HuggingFace on the model card.
79
79
  1. Then set the `HF_TOKEN` environment variable to your HuggingFace API token which can be found here: https://huggingface.co/settings/tokens
80
80
  1. If you wish to use Ollama:
@@ -292,6 +292,14 @@ provides further examples on how to do this.
292
292
  Mypy looks for the existence of a file named [`py.typed`](./src/not-again-ai/py.typed) in the root of the
293
293
  installed package to indicate that inline type annotations should be checked.
294
294
 
295
+ ## Typos
296
+
297
+ Checks for typos using [typos](https://github.com/crate-ci/typos)
298
+
299
+ ```bash
300
+ (.venv) $ nox -s typos
301
+ ```
302
+
295
303
  ## Continuous Integration
296
304
 
297
305
  Continuous integration is provided by [GitHub Actions](https://github.com/features/actions). This
@@ -4,23 +4,23 @@ not_again_ai/base/file_system.py,sha256=KNQmacO4Q__CQuq2oPzWrg3rQO48n3evglc9bNiP
4
4
  not_again_ai/base/parallel.py,sha256=fcYhKBYBWvob84iKp3O93wvFFdXeidljZsShgBLTNGA,3448
5
5
  not_again_ai/llm/__init__.py,sha256=_wNUL6FDaT369Z8W48FsaC_NkcOZ-ib2MMUvnaLOS-0,451
6
6
  not_again_ai/llm/openai_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- not_again_ai/llm/openai_api/chat_completion.py,sha256=LVnxfiK6ThwLJIYwE30oU-QLB-igfi0XL6vLWgvojsg,8905
8
- not_again_ai/llm/openai_api/context_management.py,sha256=-0_sRI4FF_tyjMvlBLevKiy34SZbinbPhWSV97eDlF4,3560
7
+ not_again_ai/llm/openai_api/chat_completion.py,sha256=9p024l0popYW08AbRYwriN_ikkUANYNl0JEFlFXuySA,8915
8
+ not_again_ai/llm/openai_api/context_management.py,sha256=BJSG100_qw9MeTCZGztDV5CBXjVOxU4x7gyoRlLxWnI,3561
9
9
  not_again_ai/llm/openai_api/embeddings.py,sha256=4OBnxZicrY6q4dQhuPqMdAnifyjwrsKMTDj-kVre0yc,2500
10
10
  not_again_ai/llm/openai_api/openai_client.py,sha256=6pZw2xw9X-ceV22rhApwFJ2tAKCxi-SxkjxBsTBZ2Nw,2470
11
11
  not_again_ai/llm/openai_api/prompts.py,sha256=7cDfvIKCTYM0t5lK34FLLqYf-SR_cynDXIXw3zWDizA,7094
12
12
  not_again_ai/llm/openai_api/tokens.py,sha256=SBU9GhtfksY9LwB4q01kSVdu0ER4D4-_-DWWoAXxzaw,4335
13
- not_again_ai/local_llm/__init__.py,sha256=1Lq1_9PMe9epUJhCLBCHEFosA5u1gP9KkzPa6eXWoi4,769
13
+ not_again_ai/local_llm/__init__.py,sha256=BsUn39U3QQaw6yomQHfp_HIPHRIBoMAgjcP3CDADx04,882
14
14
  not_again_ai/local_llm/chat_completion.py,sha256=m0fe7oGPtl46kvAIU6RhHeIvDu_pAWphrAbFY3K1i1E,3407
15
15
  not_again_ai/local_llm/huggingface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  not_again_ai/local_llm/huggingface/chat_completion.py,sha256=Y6uMbxLG8TaMVi3hJGrMl_G9Y1N_0dld5Kv1iqYnoao,2300
17
17
  not_again_ai/local_llm/huggingface/helpers.py,sha256=YPr8KbQ8Ac_Mn_nBcrFuL3bCl-IuDCdaRvYVCocy8Gk,734
18
18
  not_again_ai/local_llm/ollama/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
- not_again_ai/local_llm/ollama/chat_completion.py,sha256=QxZZn-J9FBGwgsXxrlKcXxavXVlzY3C-V9xYM7IZKeo,4132
20
- not_again_ai/local_llm/ollama/model_mapping.py,sha256=hEQTuQYaqF4JMBq9NEGHMGN2IjswtA6ECJ1MAgqpmdM,769
19
+ not_again_ai/local_llm/ollama/chat_completion.py,sha256=a2V_Od-Q-Oy8av9N8Lq2ltBDsVwTS0H7ywA6kTPkvP0,4142
20
+ not_again_ai/local_llm/ollama/model_mapping.py,sha256=EYxwcRKvIrQAZ3iBFUMzs3f_eYevFOTP8A9AFmh0Syo,837
21
21
  not_again_ai/local_llm/ollama/ollama_client.py,sha256=dktyw7aKFq4EA3dU7Le5UpfsSq3Oh_POmYSrAI4qLi8,765
22
22
  not_again_ai/local_llm/ollama/service.py,sha256=XczbxISTAp4KHnIkqRZaMsfBohH-TAHrjZ8T9x3cRAY,2900
23
- not_again_ai/local_llm/ollama/tokens.py,sha256=axQ8dGFYdLC3kGQ99PqgPMz2yam4u1kkKHBSD9F7PMs,4162
23
+ not_again_ai/local_llm/ollama/tokens.py,sha256=k7K7enOSuCJRHteDG0x-CbuivQ2uAtKK3e0Jr7-BUd4,3952
24
24
  not_again_ai/local_llm/prompts.py,sha256=mUpt8LMNnY9TVj-2tPE3lc81ZwWnBBrmBou0jxEPGL0,1560
25
25
  not_again_ai/local_llm/tokens.py,sha256=Tf1uH5zjyiejOPVr6eVYFj1m-jQpeDUcG7gZK-xMOAE,3679
26
26
  not_again_ai/py.typed,sha256=UaCuPFa3H8UAakbt-5G8SPacldTOGvJv18pPjUJ5gDY,93
@@ -32,8 +32,8 @@ not_again_ai/viz/distributions.py,sha256=OyWwJaNI6lMRm_iSrhq-CORLNvXfeuLSgDtVo3u
32
32
  not_again_ai/viz/scatterplot.py,sha256=5CUOWeknbBOaZPeX9oPin5sBkRKEwk8qeFH45R-9LlY,2292
33
33
  not_again_ai/viz/time_series.py,sha256=pOGZqXp_2nd6nKo-PUQNCtmMh__69jxQ6bQibTGLwZA,5212
34
34
  not_again_ai/viz/utils.py,sha256=hN7gwxtBt3U6jQni2K8j5m5pCXpaJDoNzGhBBikEU28,238
35
- not_again_ai-0.10.0.dist-info/LICENSE,sha256=btjOgNGpp-ux5xOo1Gx1MddxeWtT9sof3s3Nui29QfA,1071
36
- not_again_ai-0.10.0.dist-info/METADATA,sha256=RGBr2UdcQVavL6Jz3kVazwHOFG7VyQC4YWQ740wuPQs,15137
37
- not_again_ai-0.10.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
38
- not_again_ai-0.10.0.dist-info/entry_points.txt,sha256=EMJegugnmJUd-jMUA_qIRMIPAasbei8gP6O4-ER0BxQ,61
39
- not_again_ai-0.10.0.dist-info/RECORD,,
35
+ not_again_ai-0.10.1.dist-info/LICENSE,sha256=btjOgNGpp-ux5xOo1Gx1MddxeWtT9sof3s3Nui29QfA,1071
36
+ not_again_ai-0.10.1.dist-info/METADATA,sha256=ksyysikbXxsVOpGu1pwsxa7KMoloUWNztPm5eFPu0Ek,15250
37
+ not_again_ai-0.10.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
38
+ not_again_ai-0.10.1.dist-info/entry_points.txt,sha256=EMJegugnmJUd-jMUA_qIRMIPAasbei8gP6O4-ER0BxQ,61
39
+ not_again_ai-0.10.1.dist-info/RECORD,,