Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] AttributeError: 'str' object has no attribute 'value' when giving a text file as an attachment in certain conditions in self-hosted Khoj with Ollama models #1071

Open
3 of 14 tasks
Klemet opened this issue Jan 10, 2025 · 0 comments
Labels
fix Fix something that isn't working as expected

Comments

@Klemet
Copy link

Klemet commented Jan 10, 2025

Describe the bug

When giving any text file as an attachment, and asking for a translation or a summary, in certain conditions (couldn't isolate why), the following error is produced in server-1 :

2025-01-10 13:34:34 [18:34:34.173791] ERROR    uvicorn.error: Exception in ASGI      h11_impl.py:411
2025-01-10 13:34:34                            application                                          
2025-01-10 13:34:34                                                                                 
2025-01-10 13:34:34                            ╭─ Traceback (most recent call last─╮                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/uvicorn/protocols/http/h11 │                
2025-01-10 13:34:34                            │ _impl.py:406 in run_asgi          │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   403 │   # ASGI exception wrappe │                
2025-01-10 13:34:34                            │   404 │   async def run_asgi(self │                
2025-01-10 13:34:34                            │   405 │   │   try:                │                
2025-01-10 13:34:34                            │ ❱ 406 │   │   │   result = await  │                
2025-01-10 13:34:34                            │   407 │   │   │   │   self.scope, │                
2025-01-10 13:34:34                            │   408 │   │   │   )               │                
2025-01-10 13:34:34                            │   409 │   │   except BaseExceptio │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/uvicorn/middleware/proxy_h │                
2025-01-10 13:34:34                            │ eaders.py:70 in __call__          │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   67 │   │   │   │   │   port = 0 │                
2025-01-10 13:34:34                            │   68 │   │   │   │   │   scope["c │                
2025-01-10 13:34:34                            │   69 │   │                        │                
2025-01-10 13:34:34                            │ ❱ 70 │   │   return await self.ap │                
2025-01-10 13:34:34                            │   71                              │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/fastapi/applications.py:10 │                
2025-01-10 13:34:34                            │ 54 in __call__                    │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   1051 │   async def __call__(sel │                
2025-01-10 13:34:34                            │   1052 │   │   if self.root_path: │                
2025-01-10 13:34:34                            │   1053 │   │   │   scope["root_pa │                
2025-01-10 13:34:34                            │ ❱ 1054 │   │   await super().__ca │                
2025-01-10 13:34:34                            │   1055 │                          │                
2025-01-10 13:34:34                            │   1056 │   def add_api_route(     │                
2025-01-10 13:34:34                            │   1057 │   │   self,              │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/applications.py: │                
2025-01-10 13:34:34                            │ 113 in __call__                   │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   110 │   │   scope["app"] = self │                
2025-01-10 13:34:34                            │   111 │   │   if self.middleware_ │                
2025-01-10 13:34:34                            │   112 │   │   │   self.middleware │                
2025-01-10 13:34:34                            │ ❱ 113 │   │   await self.middlewa │                
2025-01-10 13:34:34                            │   114 │                           │                
2025-01-10 13:34:34                            │   115 │   def on_event(self, even │                
2025-01-10 13:34:34                            │   116 │   │   return self.router. │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/error │                
2025-01-10 13:34:34                            │ s.py:187 in __call__              │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   184 │   │   │   # We always con │                
2025-01-10 13:34:34                            │   185 │   │   │   # This allows s │                
2025-01-10 13:34:34                            │   186 │   │   │   # to optionally │                
2025-01-10 13:34:34                            │ ❱ 187 │   │   │   raise exc       │                
2025-01-10 13:34:34                            │   188 │                           │                
2025-01-10 13:34:34                            │   189 │   def format_line(self, i │                
2025-01-10 13:34:34                            │       str:                        │                
2025-01-10 13:34:34                            │   190 │   │   values = {          │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/error │                
2025-01-10 13:34:34                            │ s.py:165 in __call__              │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   162 │   │   │   await send(mess │                
2025-01-10 13:34:34                            │   163 │   │                       │                
2025-01-10 13:34:34                            │   164 │   │   try:                │                
2025-01-10 13:34:34                            │ ❱ 165 │   │   │   await self.app( │                
2025-01-10 13:34:34                            │   166 │   │   except Exception as │                
2025-01-10 13:34:34                            │   167 │   │   │   request = Reque │                
2025-01-10 13:34:34                            │   168 │   │   │   if self.debug:  │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/sessi │                
2025-01-10 13:34:34                            │ ons.py:85 in __call__             │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   82 │   │   │   │   │   headers. │                
2025-01-10 13:34:34                            │   83 │   │   │   await send(messa │                
2025-01-10 13:34:34                            │   84 │   │                        │                
2025-01-10 13:34:34                            │ ❱ 85 │   │   await self.app(scope │                
2025-01-10 13:34:34                            │   86                              │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /app/src/khoj/configure.py:351 in │                
2025-01-10 13:34:34                            │ __call__                          │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   348 │   │   async def __call__( │                
2025-01-10 13:34:34                            │   349 │   │   │   if scope["type" │                
2025-01-10 13:34:34                            │   350 │   │   │   │   scope["path │                
2025-01-10 13:34:34                            │ ❱ 351 │   │   │   await self.app( │                
2025-01-10 13:34:34                            │   352 │   │                       │                
2025-01-10 13:34:34                            │   353 │   │   def __init__(self,  │                
2025-01-10 13:34:34                            │   354 │   │   │   super().__init_ │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/authe │                
2025-01-10 13:34:34                            │ ntication.py:48 in __call__       │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   45 │   │   if auth_result is No │                
2025-01-10 13:34:34                            │   46 │   │   │   auth_result = Au │                
2025-01-10 13:34:34                            │   47 │   │   scope["auth"], scope │                
2025-01-10 13:34:34                            │ ❱ 48 │   │   await self.app(scope │                
2025-01-10 13:34:34                            │   49 │                            │                
2025-01-10 13:34:34                            │   50 │   @staticmethod            │                
2025-01-10 13:34:34                            │   51 │   def default_on_error(con │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/base. │                
2025-01-10 13:34:34                            │ py:188 in __call__                │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   185 │   │   with collapse_excgr │                
2025-01-10 13:34:34                            │   186 │   │   │   async with anyi │                
2025-01-10 13:34:34                            │   187 │   │   │   │   response =  │                
2025-01-10 13:34:34                            │ ❱ 188 │   │   │   │   await respo │                
2025-01-10 13:34:34                            │   189 │   │   │   │   response_se │                
2025-01-10 13:34:34                            │   190 │                           │                
2025-01-10 13:34:34                            │   191 │   async def dispatch(self │                
2025-01-10 13:34:34                            │       Response:                   │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/base. │                
2025-01-10 13:34:34                            │ py:222 in __call__                │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   219 │   │   │   }               │                
2025-01-10 13:34:34                            │   220 │   │   )                   │                
2025-01-10 13:34:34                            │   221 │   │                       │                
2025-01-10 13:34:34                            │ ❱ 222 │   │   async for chunk in  │                
2025-01-10 13:34:34                            │   223 │   │   │   await send({"ty │                
2025-01-10 13:34:34                            │   224 │   │                       │                
2025-01-10 13:34:34                            │   225 │   │   await send({"type": │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/base. │                
2025-01-10 13:34:34                            │ py:179 in body_stream             │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   176 │   │   │   │   │   │   │   │                
2025-01-10 13:34:34                            │   177 │   │   │   │               │                
2025-01-10 13:34:34                            │   178 │   │   │   │   if app_exc  │                
2025-01-10 13:34:34                            │ ❱ 179 │   │   │   │   │   raise a │                
2025-01-10 13:34:34                            │   180 │   │   │                   │                
2025-01-10 13:34:34                            │   181 │   │   │   response = _Str │                
2025-01-10 13:34:34                            │       content=body_stream(), info │                
2025-01-10 13:34:34                            │   182 │   │   │   response.raw_he │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/base. │                
2025-01-10 13:34:34                            │ py:149 in coro                    │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   146 │   │   │   │               │                
2025-01-10 13:34:34                            │   147 │   │   │   │   async with  │                
2025-01-10 13:34:34                            │   148 │   │   │   │   │   try:    │                
2025-01-10 13:34:34                            │ ❱ 149 │   │   │   │   │   │   awa │                
2025-01-10 13:34:34                            │   150 │   │   │   │   │   except  │                
2025-01-10 13:34:34                            │   151 │   │   │   │   │   │   app │                
2025-01-10 13:34:34                            │   152                             │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/cors. │                
2025-01-10 13:34:34                            │ py:93 in __call__                 │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │    90 │   │   │   await response( │                
2025-01-10 13:34:34                            │    91 │   │   │   return          │                
2025-01-10 13:34:34                            │    92 │   │                       │                
2025-01-10 13:34:34                            │ ❱  93 │   │   await self.simple_r │                
2025-01-10 13:34:34                            │    94 │                           │                
2025-01-10 13:34:34                            │    95 │   def is_allowed_origin(s │                
2025-01-10 13:34:34                            │    96 │   │   if self.allow_all_o │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/cors. │                
2025-01-10 13:34:34                            │ py:144 in simple_response         │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   141 │                           │                
2025-01-10 13:34:34                            │   142 │   async def simple_respon │                
2025-01-10 13:34:34                            │       request_headers: Headers) - │                
2025-01-10 13:34:34                            │   143 │   │   send = functools.pa │                
2025-01-10 13:34:34                            │ ❱ 144 │   │   await self.app(scop │                
2025-01-10 13:34:34                            │   145 │                           │                
2025-01-10 13:34:34                            │   146 │   async def send(self, me │                
2025-01-10 13:34:34                            │       None:                       │                
2025-01-10 13:34:34                            │   147 │   │   if message["type"]  │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/middleware/excep │                
2025-01-10 13:34:34                            │ tions.py:62 in __call__           │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   59 │   │   else:                │                
2025-01-10 13:34:34                            │   60 │   │   │   conn = WebSocket │                
2025-01-10 13:34:34                            │   61 │   │                        │                
2025-01-10 13:34:34                            │ ❱ 62 │   │   await wrap_app_handl │                
2025-01-10 13:34:34                            │   63 │                            │                
2025-01-10 13:34:34                            │   64 │   def http_exception(self, │                
2025-01-10 13:34:34                            │   65 │   │   assert isinstance(ex │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/_exception_handl │                
2025-01-10 13:34:34                            │ er.py:53 in wrapped_app           │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   50 │   │   │   │   handler = _l │                
2025-01-10 13:34:34                            │   51 │   │   │                    │                
2025-01-10 13:34:34                            │   52 │   │   │   if handler is No │                
2025-01-10 13:34:34                            │ ❱ 53 │   │   │   │   raise exc    │                
2025-01-10 13:34:34                            │   54 │   │   │                    │                
2025-01-10 13:34:34                            │   55 │   │   │   if response_star │                
2025-01-10 13:34:34                            │   56 │   │   │   │   raise Runtim │                
2025-01-10 13:34:34                            │      started.") from exc          │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/_exception_handl │                
2025-01-10 13:34:34                            │ er.py:42 in wrapped_app           │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   39 │   │   │   await send(messa │                
2025-01-10 13:34:34                            │   40 │   │                        │                
2025-01-10 13:34:34                            │   41 │   │   try:                 │                
2025-01-10 13:34:34                            │ ❱ 42 │   │   │   await app(scope, │                
2025-01-10 13:34:34                            │   43 │   │   except Exception as  │                
2025-01-10 13:34:34                            │   44 │   │   │   handler = None   │                
2025-01-10 13:34:34                            │   45                              │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/routing.py:715   │                
2025-01-10 13:34:34                            │ in __call__                       │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   712 │   │   """                 │                
2025-01-10 13:34:34                            │   713 │   │   The main entry poin │                
2025-01-10 13:34:34                            │   714 │   │   """
2025-01-10 13:34:34                            │ ❱ 715 │   │   await self.middlewa │                
2025-01-10 13:34:34                            │   716 │                           │                
2025-01-10 13:34:34                            │   717 │   async def app(self, sco │                
2025-01-10 13:34:34                            │   718 │   │   assert scope["type"
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/routing.py:735   │                
2025-01-10 13:34:34                            │ in app                            │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   732 │   │   │   match, child_sc │                
2025-01-10 13:34:34                            │   733 │   │   │   if match == Mat │                
2025-01-10 13:34:34                            │   734 │   │   │   │   scope.updat │                
2025-01-10 13:34:34                            │ ❱ 735 │   │   │   │   await route │                
2025-01-10 13:34:34                            │   736 │   │   │   │   return      │                
2025-01-10 13:34:34                            │   737 │   │   │   elif match == M │                
2025-01-10 13:34:34                            │   738 │   │   │   │   partial = r │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/routing.py:288   │                
2025-01-10 13:34:34                            │ in handle                         │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   285 │   │   │   │   response =  │                
2025-01-10 13:34:34                            │       headers=headers)            │                
2025-01-10 13:34:34                            │   286 │   │   │   await response( │                
2025-01-10 13:34:34                            │   287 │   │   else:               │                
2025-01-10 13:34:34                            │ ❱ 288 │   │   │   await self.app( │                
2025-01-10 13:34:34                            │   289 │                           │                
2025-01-10 13:34:34                            │   290 │   def __eq__(self, other: │                
2025-01-10 13:34:34                            │   291 │   │   return (            │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/routing.py:76 in │                
2025-01-10 13:34:34                            │ app                               │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │    73 │   │   │   response = awai │                
2025-01-10 13:34:34                            │    74 │   │   │   await response( │                
2025-01-10 13:34:34                            │    75 │   │                       │                
2025-01-10 13:34:34                            │ ❱  76 │   │   await wrap_app_hand │                
2025-01-10 13:34:34                            │    77 │                           │                
2025-01-10 13:34:34                            │    78 │   return app              │                
2025-01-10 13:34:34                            │    79                             │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/_exception_handl │                
2025-01-10 13:34:34                            │ er.py:53 in wrapped_app           │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   50 │   │   │   │   handler = _l │                
2025-01-10 13:34:34                            │   51 │   │   │                    │                
2025-01-10 13:34:34                            │   52 │   │   │   if handler is No │                
2025-01-10 13:34:34                            │ ❱ 53 │   │   │   │   raise exc    │                
2025-01-10 13:34:34                            │   54 │   │   │                    │                
2025-01-10 13:34:34                            │   55 │   │   │   if response_star │                
2025-01-10 13:34:34                            │   56 │   │   │   │   raise Runtim │                
2025-01-10 13:34:34                            │      started.") from exc          │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/_exception_handl │                
2025-01-10 13:34:34                            │ er.py:42 in wrapped_app           │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   39 │   │   │   await send(messa │                
2025-01-10 13:34:34                            │   40 │   │                        │                
2025-01-10 13:34:34                            │   41 │   │   try:                 │                
2025-01-10 13:34:34                            │ ❱ 42 │   │   │   await app(scope, │                
2025-01-10 13:34:34                            │   43 │   │   except Exception as  │                
2025-01-10 13:34:34                            │   44 │   │   │   handler = None   │                
2025-01-10 13:34:34                            │   45                              │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/routing.py:74 in │                
2025-01-10 13:34:34                            │ app                               │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │    71 │   │                       │                
2025-01-10 13:34:34                            │    72 │   │   async def app(scope │                
2025-01-10 13:34:34                            │    73 │   │   │   response = awai │                
2025-01-10 13:34:34                            │ ❱  74 │   │   │   await response( │                
2025-01-10 13:34:34                            │    75 │   │                       │                
2025-01-10 13:34:34                            │    76 │   │   await wrap_app_hand │                
2025-01-10 13:34:34                            │    77                             │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/responses.py:252 │                
2025-01-10 13:34:34                            │  in __call__                      │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   249 │   │   await send({"type": │                
2025-01-10 13:34:34                            │   250 │                           │                
2025-01-10 13:34:34                            │   251 │   async def __call__(self │                
2025-01-10 13:34:34                            │ ❱ 252 │   │   async with anyio.cr │                
2025-01-10 13:34:34                            │   253 │   │   │                   │                
2025-01-10 13:34:34                            │   254 │   │   │   async def wrap( │                
2025-01-10 13:34:34                            │   255 │   │   │   │   await func( │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/anyio/_backends/_asyncio.p │                
2025-01-10 13:34:34                            │ y:597 in __aexit__                │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │    594 │   │   │   │   else:      │                
2025-01-10 13:34:34                            │    595 │   │   │   │   │   raise  │                
2025-01-10 13:34:34                            │    596 │   │   │   elif exception │                
2025-01-10 13:34:34                            │ ❱  597 │   │   │   │   raise exce │                
2025-01-10 13:34:34                            │    598 │   │   except BaseExcepti │                
2025-01-10 13:34:34                            │    599 │   │   │   # Clear the co │                
2025-01-10 13:34:34                            │    600 │   │   │   # If the conte │                
2025-01-10 13:34:34                            │        #145).                     │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/responses.py:255 │                
2025-01-10 13:34:34                            │  in wrap                          │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   252 │   │   async with anyio.cr │                
2025-01-10 13:34:34                            │   253 │   │   │                   │                
2025-01-10 13:34:34                            │   254 │   │   │   async def wrap( │                
2025-01-10 13:34:34                            │ ❱ 255 │   │   │   │   await func( │                
2025-01-10 13:34:34                            │   256 │   │   │   │   task_group. │                
2025-01-10 13:34:34                            │   257 │   │   │                   │                
2025-01-10 13:34:34                            │   258 │   │   │   task_group.star │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /usr/local/lib/python3.10/dist-pa │                
2025-01-10 13:34:34                            │ ckages/starlette/responses.py:244 │                
2025-01-10 13:34:34                            │  in stream_response               │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │   241 │   │   │   │   "headers":  │                
2025-01-10 13:34:34                            │   242 │   │   │   }               │                
2025-01-10 13:34:34                            │   243 │   │   )                   │                
2025-01-10 13:34:34                            │ ❱ 244 │   │   async for chunk in  │                
2025-01-10 13:34:34                            │   245 │   │   │   if not isinstan │                
2025-01-10 13:34:34                            │   246 │   │   │   │   chunk = chu │                
2025-01-10 13:34:34                            │   247 │   │   │   await send({"ty │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /app/src/khoj/routers/api_chat.py │                
2025-01-10 13:34:34                            │ :804 in event_generator           │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │    801 │   │   │   if Conversatio │                
2025-01-10 13:34:34                            │    802 │   │   │   │   conversati │                
2025-01-10 13:34:34                            │    803 │   │   │                  │                
2025-01-10 13:34:34                            │ ❱  804 │   │   │   conversation_c │                
2025-01-10 13:34:34                            │        conversation_commands])    │                
2025-01-10 13:34:34                            │    805 │   │   │   async for resu │                
2025-01-10 13:34:34                            │        {conversation_commands_str │                
2025-01-10 13:34:34                            │    806 │   │   │   │   yield resu │                
2025-01-10 13:34:34                            │    807                            │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │ /app/src/khoj/routers/api_chat.py │                
2025-01-10 13:34:34                            │ :804 in <listcomp>                │                
2025-01-10 13:34:34                            │                                   │                
2025-01-10 13:34:34                            │    801 │   │   │   if Conversatio │                
2025-01-10 13:34:34                            │    802 │   │   │   │   conversati │                
2025-01-10 13:34:34                            │    803 │   │   │                  │                
2025-01-10 13:34:34                            │ ❱  804 │   │   │   conversation_c │                
2025-01-10 13:34:34                            │        conversation_commands])    │                
2025-01-10 13:34:34                            │    805 │   │   │   async for resu │                
2025-01-10 13:34:34                            │        {conversation_commands_str │                
2025-01-10 13:34:34                            │    806 │   │   │   │   yield resu │                
2025-01-10 13:34:34                            │    807                            │                
2025-01-10 13:34:34                            ╰───────────────────────────────────╯                
2025-01-10 13:34:34                            AttributeError: 'str' object has no                  
2025-01-10 13:34:34                            attribute 'value'

This happens with different files of different length, with different models (Mistral or Qwen2.5 coding); but not with every agent. Some agents using the same models might not have the error. Here is the agent that gives me the error almost every time :

You are an artificial intelligence who is made to help the user write code that is commented, clear and effective. You love coding, and you're very excited about it.
You will never read the users' notes or files to inform your answers unless the user specifically asks you to do so.
You also never run or test any of users' code or code that he ask you to generate without them specifically asking you to do so.

I tried Mistral and Qwen with this agent, small and long text files, but the problem remains.

To Reproduce

  • Install Ollama with Mistral and Qwen2.5
  • Install Khoj with Docker as self-hosted
  • Create custom agent as described above
  • Attach a file and ask for a summary or a translation

Platform

  • Server:
    • Cloud-Hosted (https://app.khoj.dev)
    • Self-Hosted Docker
    • Self-Hosted Python package
    • Self-Hosted source code
  • Client:
    • Obsidian
    • Emacs
    • Desktop app
    • Web browser
    • WhatsApp
  • OS:
    • Windows
    • macOS
    • Linux
    • Android
    • iOS

If self-hosted

  • Server Version [e.g. 1.0.1]: 1.33.2
@Klemet Klemet added the fix Fix something that isn't working as expected label Jan 10, 2025
@Klemet Klemet changed the title [FIX] AttributeError: 'str' object has no attribute 'value' when giving a text file as an attachment in certain conditions [FIX] AttributeError: 'str' object has no attribute 'value' when giving a text file as an attachment in certain conditions in self-hosted Khoj with Ollama models Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fix something that isn't working as expected
Projects
None yet
Development

No branches or pull requests

1 participant