Skip to content

Commit

Permalink
update run names (#102)
Browse files Browse the repository at this point in the history
Update run names for suggest
  • Loading branch information
eyurtsev authored Mar 22, 2024
1 parent 0da6b2b commit 4b14415
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backend/server/api/suggest.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class ExtractorDefinition(BaseModel):

suggestion_chain = SUGGEST_PROMPT | model.with_structured_output(
schema=ExtractorDefinition
)
).with_config({"run_name": "suggest"})

UPDATE_PROMPT = ChatPromptTemplate.from_messages(
[
Expand All @@ -94,7 +94,9 @@ class ExtractorDefinition(BaseModel):
]
)

UPDATE_CHAIN = UPDATE_PROMPT | model.with_structured_output(schema=ExtractorDefinition)
UPDATE_CHAIN = (
UPDATE_PROMPT | model.with_structured_output(schema=ExtractorDefinition)
).with_config({"run_name": "suggest_update"})


# PUBLIC API
Expand All @@ -104,7 +106,6 @@ class ExtractorDefinition(BaseModel):
async def suggest(request: SuggestExtractor) -> ExtractorDefinition:
"""Endpoint to create an extractor."""
if len(request.jsonSchema) > 10:
print(f"Using update chain with {request.jsonSchema}")
return await UPDATE_CHAIN.ainvoke(
{"input": request.description, "json_schema": request.jsonSchema}
)
Expand Down

0 comments on commit 4b14415

Please sign in to comment.