Skip to content

Commit

Permalink
Remove event because of pickle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ravi03071991 committed Nov 29, 2024
1 parent d396260 commit 76b787c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
4 changes: 3 additions & 1 deletion examples/llamacloud/google_drive/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ At this point we have all we need to run this deployment. Ideally, we would have
somewhere in the cloud, but to get started let's start an instance locally. Run the following python script
from a shell:

NOTE: You need to set up `OPENAI_API_KEY` and `LLAMA_CLOUD_API_KEY` again here.

```
$ python -m llama_deploy.apiserver
INFO: Started server process [10842]
Expand All @@ -144,4 +146,4 @@ with this deployment:
$ llamactl run --deployment LlamaCloud_LlamaDeploy_GoogleDrive --arg query '<YOUR QUERY>'
```

This will return a dictionary of query and response.
This will return a dictionary of query and response.
17 changes: 2 additions & 15 deletions examples/llamacloud/google_drive/src/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ def from_yaml(cls, config_path: str = "src/config.yml") -> "LlamaCloudConfig":
organization_id=llamacloud_config.get("organization_id"),
)


class QueryIndexEvent(Event):
"""Event for querying the index"""

pass


class LlamaCloudQueryWorkflow(Workflow):
"""Workflow for creating and querying a LlamaCloud index"""

Expand All @@ -51,19 +44,13 @@ def __init__(self, config: LlamaCloudConfig):
self.config = config

@step
async def create_index(self, ev: StartEvent) -> QueryIndexEvent:
"""Create LlamaCloud index"""
async def query_index(self, ev: StartEvent) -> StopEvent:
"""Query the created index"""
index = LlamaCloudIndex(
name=self.config.index_name,
project_name=self.config.project_name,
organization_id=self.config.organization_id,
)
return QueryIndexEvent(index=index, query=ev.get("query"))

@step
async def query_index(self, ev: QueryIndexEvent) -> StopEvent:
"""Query the created index"""
index = ev.get("index")
query = ev.get("query")
query_engine = index.as_query_engine()
response = query_engine.query(query)
Expand Down

0 comments on commit 76b787c

Please sign in to comment.