Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
whitead committed Mar 8, 2024
2 parents 01304f1 + 4bda580 commit 7d70c6b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ local_client = AsyncOpenAI(
)

docs = Docs(client=local_client,
embedding=LlamaEmbeddingModel(),
embedding_model=LlamaEmbeddingModel(),
llm_model=OpenAILLMModel(config=dict(model="my-llm-model", temperature=0.1, frequency_penalty=1.5, max_tokens=512)))
```

Expand All @@ -175,7 +175,7 @@ local_client = AsyncOpenAI(
)

docs = Docs(client=local_client,
embedding=SentenceTransformerEmbeddingModel(),
embedding_model=SentenceTransformerEmbeddingModel(),
llm_model=OpenAILLMModel(config=dict(model="my-llm-model", temperature=0.1, frequency_penalty=1.5, max_tokens=512)))
```

Expand Down
12 changes: 5 additions & 7 deletions paperqa/docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,17 +708,15 @@ async def process(match):
except json.decoder.JSONDecodeError:
# fallback to string
success = False
else:
success = isinstance(result_data, dict)
if success:
try:
context = result_data["summary"]
score = result_data["relevance_score"]
del result_data["summary"]
del result_data["relevance_score"]
if "question" in result_data:
del result_data["question"]
context = result_data.pop("summary")
score = result_data.pop("relevance_score")
result_data.pop("question", None)
extras = result_data
except KeyError:
# fallback
success = False
# fallback to string (or json mode not enabled)
if not success or not self.prompts.summary_json:
Expand Down

0 comments on commit 7d70c6b

Please sign in to comment.