Skip to content

Commit

Permalink
Update llm_example.py with code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
dermatologist committed Jan 6, 2024
1 parent 292e3ea commit 9c6cb21
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/llm_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@
pip install -e .[llm]
"""

from pyomop import CdmEngineFactory, CdmVocabulary, CdmVector, Cohort, Vocabulary, metadata, CdmLLMQuery, CDMDatabase
from sqlalchemy.future import select
from pyomop import CdmEngineFactory, Cohort, metadata, CdmLLMQuery, CDMDatabase
import datetime
import asyncio
# Import any LLMs that llama_index supports and you have access to
# Require OpenAI API key to use OpenAI LLMs
from llama_index.llms import Vertex, OpenAI, AzureOpenAI
from llama_index.llms import Vertex

async def main():
cdm = CdmEngineFactory() # Creates SQLite database by default
# Create a sqllite database by default
# You can also connect to an existing CDM database using the CdmEngineFactory
cdm = CdmEngineFactory()
# Postgres example below (db='mysql' also supported)
# cdm = CdmEngineFactory(db='pgsql', host='', port=5432,
# user='', pw='',
Expand All @@ -23,7 +24,6 @@ async def main():
# Create Tables if required
await cdm.init_models(metadata)

# Add a cohort
async with cdm.session() as session:
async with session.begin():

Expand Down

0 comments on commit 9c6cb21

Please sign in to comment.