Skip to content
Snippets Groups Projects
Unverified Commit d069d2e9 authored by Sourabh Desai's avatar Sourabh Desai Committed by GitHub
Browse files

update llama_index to 0.8.55 (#66)

* update llama_index

* update llama_index to actual latest version 0.8.55

* fix ts error
parent 98bd3345
No related branches found
No related tags found
No related merge requests found
"""update_sub_process_columns
Revision ID: 663b3fea3024
Revises: 873c0c4616ea
Create Date: 2023-10-30 17:23:51.517821
"""
from typing import Set
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision = '663b3fea3024'
down_revision = '873c0c4616ea'
branch_labels = None
depends_on = None
existing_sub_process_source_enum_values = {
"CHUNKING",
"NODE_PARSING",
"EMBEDDING",
"LLM",
"QUERY",
"RETRIEVE",
"SYNTHESIZE",
"TREE",
"CONSTRUCTED_QUERY_ENGINE",
"SUB_QUESTIONS",
"SUB_QUESTION",
}
new_sub_process_source_enum_values = {
*existing_sub_process_source_enum_values,
"AGENT_STEP",
"SUB_QUESTION",
"TEMPLATING",
"FUNCTION_CALL",
"RERANKING",
"EXCEPTION",
"AGENT_STEP"
}
def replace_enum_values(enum_name: str, table: str, new_values: Set[str]):
"""
Create a new type, add the value to it, update the column to use the new type and delete the old type
"""
op.execute(f'ALTER TYPE public."{enum_name}" RENAME TO "{enum_name}Old"')
sa.Enum(*new_values, name=enum_name).create(op.get_bind())
op.execute(
f'ALTER TABLE {table} ALTER COLUMN source TYPE public."{enum_name}" USING source::text::public."{enum_name}"'
)
op.execute(f'DROP TYPE public."{enum_name}Old"')
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
# Alter MessageSubProcessEnum to add new CBEventType enum values as valid values
replace_enum_values(
"MessageSubProcessSourceEnum",
"messagesubprocess",
new_sub_process_source_enum_values,
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
# revert back to the old enum type
# Note that this won't work if the DB already has rows with the new enum values
replace_enum_values(
"MessageSubProcessSourceEnum",
"messagesubprocess",
existing_sub_process_source_enum_values,
)
# ### end Alembic commands ###
from typing import Dict, Any, Optional, List
import asyncio
import queue
import logging
from uuid import uuid4
from anyio import ClosedResourceError
from anyio.streams.memory import MemoryObjectSendStream
from llama_index.callbacks.base import BaseCallbackHandler
......@@ -102,14 +102,17 @@ class ChatCallbackHandler(BaseCallbackHandler):
if self._send_chan._closed:
logger.debug("Received event after send channel closed. Ignoring.")
return
await self._send_chan.send(
StreamedMessageSubProcess(
source=source,
metadata_map=metadata_map,
event_id=event_id,
has_ended=not is_start_event,
try:
await self._send_chan.send(
StreamedMessageSubProcess(
source=source,
metadata_map=metadata_map,
event_id=event_id,
has_ended=not is_start_event,
)
)
)
except ClosedResourceError:
logger.exception("Tried sending SubProcess event after channel was closed")
def start_trace(self, trace_id: Optional[str] = None) -> None:
"""No-op."""
......
......@@ -40,6 +40,7 @@ class CustomPGVectorStore(PGVectorStore):
global did_run_setup
if did_run_setup:
return
self._initialize()
async with self._async_session() as session:
async with session.begin():
statement = sqlalchemy.text("CREATE EXTENSION IF NOT EXISTS vector")
......
This diff is collapsed.
......@@ -7,7 +7,7 @@ readme = "README.md"
packages = [{include = "app"}]
[tool.poetry.dependencies]
python = "^3.10"
python = "^3.10,<3.12"
fastapi = "0.100.1"
pydantic = "^1.10.8"
uvicorn = "^0.22.0"
......@@ -25,7 +25,7 @@ fsspec = "^2023.6.0"
pdfkit = "^1.0.0"
pgvector = "^0.1.8"
sentry-sdk = {extras = ["fastapi"], version = "^1.28.1"}
llama-index = "^0.8.2"
llama-index = "0.8.55"
polygon = "^1.1.0"
polygon-api-client = "^1.12.3"
nltk = "^3.8.1"
......
from fire import Fire
from app.schema import Document
from app.db.session import SessionLocal
from app.chat.pg_vector import get_vector_store_singleton
import asyncio
......
export const GOOGLE_ANALYTICS_ID = "G-LGHB46ZGWR";
export const INTERCOM_ID = "rx71g1uo";
export const SENTRY_DSN =
"https://e7056c376a924cc881c40599ee1f270d@o4505586322833408.ingest.sentry.io/4505586323947520";
// TODO: Populate with your own Sentry DSN:
// https://docs.sentry.io/product/sentry-basics/concepts/dsn-explainer/
export const SENTRY_DSN: string | undefined = undefined;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment