Skip to content

Instantly share code, notes, and snippets.

@JonasCz
Last active February 16, 2024 16:56
Show Gist options
  • Save JonasCz/f2aa1749bd453f16fc0b06c469c06011 to your computer and use it in GitHub Desktop.
Save JonasCz/f2aa1749bd453f16fc0b06c469c06011 to your computer and use it in GitHub Desktop.
Rebuilding...
gems-app-1 |
gems-app-1 | Done in 257ms.
gems-app-1 | Compiling 2 files (.ex)
gems-app-1 | Generated gems app
gems-app-1 | [info] POST /api/v1/search
gems-app-1 | [debug] Processing with GemsWeb.API.Search.search/2
gems-app-1 | Parameters: %{"query" => "mindfulness"}
gems-app-1 | Pipelines: [:api, :authenticated]
gems-app-1 | [(gems 0.1.0) lib/gems/schema/user_tokens.ex:37: Gems.UserTokens.validate_and_insert_token/1]
gems-app-1 | jwt #=> "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhYmMiLCJleHAiOjE3MDgxODgwMjN9.rHwPEKnWH9RpQNIxcz2q5sxgg5Li9utitXis61W38N4"
gems-app-1 |
gems-app-1 | [(gems 0.1.0) lib/gems/schema/user_tokens.ex:40: Gems.UserTokens.validate_and_insert_token/1]
gems-app-1 | claims #=> %{"exp" => 1708188023, "sub" => "abc"}
gems-app-1 |
gems-app-1 | [debug] QUERY OK db=0.1ms idle=1048.2ms
gems-app-1 | begin []
gems-app-1 | ↳ Gems.UserTokens.validate_and_insert_token/1, at: lib/gems/schema/user_tokens.ex:44
gems-app-1 | [debug] QUERY OK source="user_tokens" db=0.3ms
gems-app-1 | SELECT u0."id", u0."user_id", u0."last_used_at", u0."inserted_at", u0."updated_at" FROM "user_tokens" AS u0 WHERE (u0."user_id" = $1) ["abc"]
gems-app-1 | ↳ anonymous fn/3 in Gems.UserTokens.find_or_create_user_token/1, at: lib/gems/schema/user_tokens.ex:25
gems-app-1 | [debug] QUERY OK source="user_tokens" db=3.6ms
gems-app-1 | INSERT INTO "user_tokens" ("user_id","last_used_at","id","inserted_at","updated_at") VALUES ($1,$2,$3,$4,$5) ["abc", ~U[2024-02-16 16:54:16.471369Z], "UEMLP84npocnoA8o8f4ra2", ~U[2024-02-16 16:54:16.502341Z], ~U[2024-02-16 16:54:16.502341Z]]
gems-app-1 | ↳ anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4, at: lib/ecto/adapters/sql.ex:1358
gems-app-1 | [debug] QUERY OK db=1.7ms
gems-app-1 | commit []
gems-app-1 | ↳ Gems.UserTokens.validate_and_insert_token/1, at: lib/gems/schema/user_tokens.ex:44
gems-app-1 | [debug] QUERY OK source="embeddings" db=2.7ms queue=0.7ms idle=1755.2ms
gems-app-1 | SELECT q1."id", (e0."embedding" <=> $1::vector) FROM "embeddings" AS e0 LEFT OUTER JOIN "queries" AS q1 ON q1."id" = e0."query_id" WHERE (NOT (e0."query_id" IS NULL)) AND ((e0."embedding" <=> $2::vector) <= $3) ORDER BY (e0."embedding" <=> $4::vector) LIMIT 1 [[-0.023878608, -0.014201698, 0.025320133, -0.02459937, -0.015362928, 0.010938244, -0.017311657, -0.0315534, -0.005318963, -0.03286145, 0.011372036, 0.013988139, 0.014428605, 0.0055825757, -0.0050620246, -4.9469026e-4, 0.05061357, -0.01844619, 0.005612607, -0.008555722, -0.022450428, 0.027041955, 0.00767479, 0.0016801116, -0.024359116, -0.0034119447, 0.02160954, -0.02066187, -0.029257635, -0.03232755, 0.022490472, -0.0051054037, 1.0365138e-4, -0.01808581, -0.003740626, 0.005786124, 0.010818117, -0.0015833426, 0.015015894, -0.011352016, 0.015803393, -0.0014415258, -0.014695554, 0.0014532048, -0.011472142, 0.011425426, 0.009570129, -0.01075138, -0.023798523, ...], [-0.023878608, -0.014201698, 0.025320133, -0.02459937, -0.015362928, 0.010938244, -0.017311657, -0.0315534, -0.005318963, -0.03286145, 0.011372036, 0.013988139, 0.014428605, 0.0055825757, -0.0050620246, -4.9469026e-4, 0.05061357, -0.01844619, 0.005612607, -0.008555722, -0.022450428, 0.027041955, 0.00767479, 0.0016801116, -0.024359116, -0.0034119447, 0.02160954, -0.02066187, -0.029257635, -0.03232755, 0.022490472, -0.0051054037, 1.0365138e-4, -0.01808581, -0.003740626, 0.005786124, 0.010818117, -0.0015833426, 0.015015894, -0.011352016, 0.015803393, -0.0014415258, -0.014695554, 0.0014532048, -0.011472142, 0.011425426, 0.009570129, -0.01075138, ...], 0.15, [-0.023878608, -0.014201698, 0.025320133, -0.02459937, -0.015362928, 0.010938244, -0.017311657, -0.0315534, -0.005318963, -0.03286145, 0.011372036, 0.013988139, 0.014428605, 0.0055825757, -0.0050620246, -4.9469026e-4, 0.05061357, -0.01844619, 0.005612607, -0.008555722, -0.022450428, 0.027041955, 0.00767479, 0.0016801116, -0.024359116, -0.0034119447, 0.02160954, -0.02066187, -0.029257635, -0.03232755, 0.022490472, -0.0051054037, 1.0365138e-4, -0.01808581, -0.003740626, 0.005786124, 0.010818117, -0.0015833426, 0.015015894, -0.011352016, 0.015803393, -0.0014415258, -0.014695554, 0.0014532048, -0.011472142, 0.011425426, ...]]
gems-app-1 | ↳ Gems.Queries.search/2, at: lib/gems/schema/queries.ex:69
gems-app-1 | [debug] QUERY OK db=0.1ms idle=1713.5ms
gems-app-1 | begin []
gems-app-1 | ↳ GemsWeb.API.Search.search/2, at: lib/gems_web/controllers/api/search.ex:29
gems-app-1 | [debug] QUERY OK source="queries" db=0.3ms
gems-app-1 | INSERT INTO "queries" ("input","response","reasoning","id","inserted_at","updated_at") VALUES ($1,$2,$3,$4,$5,$6) ["mindfulness", %{"content_type" => "chapter", "desired_content_language" => "", "event" => "", "from" => "", "location" => "", "query" => "mindfulness", "reasoning" => "The user's query only contains the keyword 'mindfulness', without specifying a date range, speaker, event, location, or content type. Therefore, we use 'mindfulness' as the keyword for the search. Given there is no indication of a specific content type or language preference, default assumptions are made.", "speaker" => "", "to" => "", "user_language" => "EN"}, "The user's query only contains the keyword 'mindfulness', without specifying a date range, speaker, event, location, or content type. Therefore, we use 'mindfulness' as the keyword for the search. Given there is no indication of a specific content type or language preference, default assumptions are made.", "DPgpE5TisCSC9qdwG9CouK", ~U[2024-02-16 16:54:23.138191Z], ~U[2024-02-16 16:54:23.138191Z]]
gems-app-1 | ↳ GemsWeb.API.Search.search/2, at: lib/gems_web/controllers/api/search.ex:29
gems-app-1 | [debug] QUERY OK source="embeddings" db=0.9ms
gems-app-1 | INSERT INTO "embeddings" ("query_id","embedding","id","inserted_at","updated_at") VALUES ($1,$2,$3,$4,$5) ["DPgpE5TisCSC9qdwG9CouK", Pgvector.new([-0.023878607898950577, -0.014201697893440723, 0.025320133194327354, -0.02459936961531639, -0.015362927690148354, 0.010938243940472603, -0.01731165684759617, -0.031553398817777634, -0.005318962968885899, -0.03286144882440567, 0.011372036300599575, 0.013988139107823372, 0.014428605325520039, 0.005582575686275959, -0.00506202457472682, -4.946902627125382e-4, 0.05061357095837593, -0.018446190282702446, 0.00561260711401701, -0.008555722422897816, -0.02245042845606804, 0.027041954919695854, 0.007674789987504482, 0.0016801116289570928, -0.024359116330742836, -0.0034119447227567434, 0.021609539166092873, -0.020661870017647743, -0.02925763465464115, -0.032327551394701004, 0.022490471601486206, -0.00510540371760726, 1.0365137859480456e-4, -0.01808580942451954, -0.00374062592163682, 0.005786124151200056, 0.010818117298185825, -0.0015833425568416715, 0.015015893615782261, -0.011352015659213066, 0.015803392976522446, -0.001441525761038065, -0.014695554040372372, 0.0014532047789543867, -0.011472142301499844, 0.011425426229834557, 0.009570129215717316, -0.010751379653811455, ...]), "VCtoJHPwpUahbtJeWDDpxt", ~U[2024-02-16 16:54:23.139156Z], ~U[2024-02-16 16:54:23.139156Z]]
gems-app-1 | ↳ anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4, at: lib/ecto/adapters/sql.ex:1358
gems-app-1 | [debug] QUERY OK db=1.8ms
gems-app-1 | commit []
gems-app-1 | ↳ GemsWeb.API.Search.search/2, at: lib/gems_web/controllers/api/search.ex:29
gems-app-1 | [info] Sent 200 in 6739ms
gems-app-1 | [debug] GemsWeb.API.Search halted in :action/2
gems-app-1 | [info] POST /api/v1/search
gems-app-1 | [debug] Processing with GemsWeb.API.Search.search/2
gems-app-1 | Parameters: %{"distance" => 0, "id" => "gumdnAMLb3NiawfDhoZcJW"}
gems-app-1 | Pipelines: [:api, :authenticated]
gems-app-1 | [(gems 0.1.0) lib/gems/schema/user_tokens.ex:37: Gems.UserTokens.validate_and_insert_token/1]
gems-app-1 | jwt #=> "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJhYmMiLCJleHAiOjE3MDgxODgwMjN9.rHwPEKnWH9RpQNIxcz2q5sxgg5Li9utitXis61W38N4"
gems-app-1 |
gems-app-1 | [(gems 0.1.0) lib/gems/schema/user_tokens.ex:40: Gems.UserTokens.validate_and_insert_token/1]
gems-app-1 | claims #=> %{"exp" => 1708188023, "sub" => "abc"}
gems-app-1 |
gems-app-1 | [debug] QUERY OK db=0.1ms idle=1734.1ms
gems-app-1 | begin []
gems-app-1 | ↳ Gems.UserTokens.validate_and_insert_token/1, at: lib/gems/schema/user_tokens.ex:44
gems-app-1 | [debug] QUERY OK source="user_tokens" db=0.8ms
gems-app-1 | SELECT u0."id", u0."user_id", u0."last_used_at", u0."inserted_at", u0."updated_at" FROM "user_tokens" AS u0 WHERE (u0."user_id" = $1) ["abc"]
gems-app-1 | ↳ anonymous fn/3 in Gems.UserTokens.find_or_create_user_token/1, at: lib/gems/schema/user_tokens.ex:25
gems-app-1 | [debug] QUERY OK source="user_tokens" db=0.2ms
gems-app-1 | UPDATE "user_tokens" SET "last_used_at" = $1, "updated_at" = $2 WHERE "id" = $3 [~U[2024-02-16 16:54:23.158489Z], ~U[2024-02-16 16:54:23.162227Z], "UEMLP84npocnoA8o8f4ra2"]
gems-app-1 | ↳ anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4, at: lib/ecto/adapters/sql.ex:1358
gems-app-1 | [debug] QUERY OK db=0.9ms
gems-app-1 | commit []
gems-app-1 | ↳ Gems.UserTokens.validate_and_insert_token/1, at: lib/gems/schema/user_tokens.ex:44
gems-app-1 | [(gems 0.1.0) lib/gems_web/controllers/api/search.ex:50: GemsWeb.API.Search.search/2]
gems-app-1 | id #=> "gumdnAMLb3NiawfDhoZcJW"
gems-app-1 |
gems-app-1 | [debug] QUERY OK source="queries" db=0.3ms queue=0.4ms idle=1739.6ms
gems-app-1 | SELECT q0."id", q0."input", q0."reasoning", q0."response", q0."occurrences", q0."inserted_at", q0."updated_at" FROM "queries" AS q0 WHERE (q0."id" = $1) ["gumdnAMLb3NiawfDhoZcJW"]
gems-app-1 | ↳ GemsWeb.API.Search.search/2, at: lib/gems_web/controllers/api/search.ex:52
gems-app-1 | [info] Sent 404 in 35ms
gems-app-1 | [debug] ** (Ecto.NoResultsError) expected at least one result but got none in query:
gems-app-1 |
gems-app-1 | from q0 in Gems.Query,
gems-app-1 | where: q0.id == ^"gumdnAMLb3NiawfDhoZcJW"
gems-app-1 |
gems-app-1 | (ecto 3.11.1) lib/ecto/repo/queryable.ex:164: Ecto.Repo.Queryable.one!/3
gems-app-1 | (gems 0.1.0) lib/gems_web/controllers/api/search.ex:52: GemsWeb.API.Search.search/2
gems-app-1 | (gems 0.1.0) lib/gems_web/controllers/api/search.ex:1: GemsWeb.API.Search.action/2
gems-app-1 | (gems 0.1.0) lib/gems_web/controllers/api/search.ex:1: GemsWeb.API.Search.phoenix_controller_pipeline/2
gems-app-1 | (phoenix 1.7.10) lib/phoenix/router.ex:432: Phoenix.Router.__call__/5
gems-app-1 | (gems 0.1.0) lib/gems_web/endpoint.ex:1: GemsWeb.Endpoint.plug_builder_call/2
gems-app-1 | (gems 0.1.0) deps/plug/lib/plug/debugger.ex:136: GemsWeb.Endpoint."call (overridable 3)"/2
gems-app-1 | (gems 0.1.0) lib/gems_web/endpoint.ex:1: GemsWeb.Endpoint.call/2
gems-app-1 | (phoenix 1.7.10) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
gems-app-1 | (plug_cowboy 2.6.1) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
gems-app-1 | (cowboy 2.10.0) /app/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
gems-app-1 | (cowboy 2.10.0) /app/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
gems-app-1 | (cowboy 2.10.0) /app/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
gems-app-1 | (stdlib 5.2) proc_lib.erl:241: :proc_lib.init_p_do_apply/3
gems-app-1 |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment