Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions blueprints/function_calling_blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, prompt: str | None = None) -> None:
),
"OPENAI_API_KEY": os.getenv("OPENAI_API_KEY", "YOUR_OPENAI_API_KEY"),
"TASK_MODEL": os.getenv("TASK_MODEL", "gpt-3.5-turbo"),
"TEMPLATE": """Use the following context as your learned knowledge, inside <context></context> XML tags.
"TEMPLATE": os.getenv("TEMPLATE", """Use the following context as your learned knowledge, inside <context></context> XML tags.
<context>
{{CONTEXT}}
</context>
Expand All @@ -71,7 +71,7 @@ def __init__(self, prompt: str | None = None) -> None:
- If you don't know, just say that you don't know.
- If you don't know when you are not sure, ask for clarification.
Avoid mentioning that you obtained the information from the context.
And answer according to the language of the user's question.""",
And answer according to the language of the user's question."""),
}
)

Expand Down Expand Up @@ -168,6 +168,7 @@ def run_completion(self, system_prompt: str, content: str) -> dict:

response = r.json()
content = response["choices"][0]["message"]["content"]
content = content[content.find('{'):content.rfind('}') + 1]

# Parse the function response
if content != "":
Expand Down